add RF API and add concept of energy usage to machines + controllers

This commit is contained in:
Raoul Van den Berge
2015-12-09 12:53:34 +01:00
parent 26ae82ead0
commit d5ec3faf5a
17 changed files with 724 additions and 18 deletions

View File

@@ -1,7 +1,9 @@
package storagecraft.block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import storagecraft.tile.TileController;
@@ -15,6 +17,18 @@ public class BlockController extends BlockSC implements ITileEntityProvider {
return new TileController();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileController controller = (TileController) world.getTileEntity(x, y, z);
player.addChatComponentMessage(new ChatComponentText("RF stored: " + controller.getEnergyStored(null)));
player.addChatComponentMessage(new ChatComponentText("RF/t usage: " + controller.getEnergyUsage()));
}
return true;
}
@Override
public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
((TileController) world.getTileEntity(x, y, z)).onDestroyed();