add RF API and add concept of energy usage to machines + controllers
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user