Fixed block interaction internal logic
This commit is contained in:
parent
0e68bea2f2
commit
f0bcfd48b4
18 changed files with 149 additions and 153 deletions
|
@ -26,27 +26,27 @@ public abstract class BlockAbstractContainer extends BlockContainer {
|
|||
}
|
||||
|
||||
// FIXME untested
|
||||
/*
|
||||
/*
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean hasResponse = false;
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IUpgradable) {
|
||||
IUpgradable upgradable = (IUpgradable) te;
|
||||
ItemStack is = player.inventory.getCurrentItem();
|
||||
if (is != null) {
|
||||
Item i = is.getItem();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof IUpgradable) {
|
||||
IUpgradable upgradable = (IUpgradable) tileEntity;
|
||||
ItemStack itemStack = entityPlayer.inventory.getCurrentItem();
|
||||
if (itemStack != null) {
|
||||
Item i = itemStack.getItem();
|
||||
if (i instanceof ItemWarpUpgrade) {
|
||||
if (upgradable.takeUpgrade(EnumUpgradeTypes.values()[is.getItemDamage()], false)) {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
player.addChatMessage("Upgrade accepted");
|
||||
if (upgradable.takeUpgrade(EnumUpgradeTypes.values()[itemStack.getItemDamage()], false)) {
|
||||
if (!entityPlayer.capabilities.isCreativeMode)
|
||||
entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, 1);
|
||||
entityPlayer.addChatMessage("Upgrade accepted");
|
||||
} else {
|
||||
player.addChatMessage("Upgrade declined");
|
||||
entityPlayer.addChatMessage("Upgrade declined");
|
||||
}
|
||||
hasResponse = true;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.api.IAirCanister;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
|
@ -82,30 +81,31 @@ public class BlockAirGenerator extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityAbstractEnergy tileEntity = (TileEntityAbstractEnergy) world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null) {
|
||||
ItemStack heldItemStack = player.getHeldItem();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityAirGenerator) {
|
||||
TileEntityAirGenerator airGenerator = (TileEntityAirGenerator)tileEntity;
|
||||
ItemStack heldItemStack = entityPlayer.getHeldItem();
|
||||
if (heldItemStack == null) {
|
||||
WarpDrive.addChatMessage(player, tileEntity.getStatus());
|
||||
WarpDrive.addChatMessage(entityPlayer, airGenerator.getStatus());
|
||||
return true;
|
||||
} else {
|
||||
Item heldItem = heldItemStack.getItem();
|
||||
if (heldItem != null && (heldItem instanceof IAirCanister)) {
|
||||
IAirCanister airCanister = (IAirCanister) heldItem;
|
||||
if (airCanister.canContainAir(heldItemStack) && tileEntity.consumeEnergy(WarpDriveConfig.AIRGEN_ENERGY_PER_CANISTER, true)) {
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
if (airCanister.canContainAir(heldItemStack) && airGenerator.consumeEnergy(WarpDriveConfig.AIRGEN_ENERGY_PER_CANISTER, true)) {
|
||||
entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, 1);
|
||||
ItemStack toAdd = airCanister.fullDrop(heldItemStack);
|
||||
if (toAdd != null) {
|
||||
if (!player.inventory.addItemStackToInventory(toAdd)) {
|
||||
EntityItem ie = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, toAdd);
|
||||
player.worldObj.spawnEntityInWorld(ie);
|
||||
if (!entityPlayer.inventory.addItemStackToInventory(toAdd)) {
|
||||
EntityItem ie = new EntityItem(entityPlayer.worldObj, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, toAdd);
|
||||
entityPlayer.worldObj.spawnEntityInWorld(ie);
|
||||
}
|
||||
tileEntity.consumeEnergy(WarpDriveConfig.AIRGEN_ENERGY_PER_CANISTER, false);
|
||||
airGenerator.consumeEnergy(WarpDriveConfig.AIRGEN_ENERGY_PER_CANISTER, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package cr0s.warpdrive.block;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -65,15 +64,16 @@ public class BlockLaser extends BlockContainer {
|
|||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Report status
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityLaser && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaser)tileEntity).getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityLaser) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaser)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public class BlockLaserMedium extends BlockContainer {
|
||||
|
@ -54,15 +53,15 @@ public class BlockLaserMedium extends BlockContainer {
|
|||
* Called upon block activation (right click on the block.)
|
||||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityAbstractEnergy) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityAbstractEnergy) tileEntity).getStatus());
|
||||
if (tileEntity instanceof TileEntityLaserMedium) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaserMedium) tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
|
||||
public class BlockShipScanner extends BlockContainer {
|
||||
private IIcon[] iconBuffer;
|
||||
|
@ -68,15 +66,17 @@ public class BlockShipScanner extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityAbstractEnergy abstractEnergy = (TileEntityAbstractEnergy)world.getTileEntity(x, y, z);
|
||||
if (abstractEnergy != null && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, abstractEnergy.getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityShipScanner) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipScanner)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -2,7 +2,6 @@ package cr0s.warpdrive.block.collection;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -81,16 +80,17 @@ public class BlockLaserTreeFarm extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityLaserTreeFarm treeFarm = (TileEntityLaserTreeFarm)world.getTileEntity(x, y, z);
|
||||
|
||||
if (treeFarm != null && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, treeFarm.getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityLaserTreeFarm) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaserTreeFarm)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public class BlockMiningLaser extends BlockContainer {
|
||||
|
@ -77,16 +76,17 @@ public class BlockMiningLaser extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)world.getTileEntity(x, y, z);
|
||||
|
||||
if (miningLaser != null && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, miningLaser.getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityMiningLaser) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityMiningLaser)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public class BlockCamera extends BlockContainer {
|
||||
|
@ -55,16 +54,17 @@ public class BlockCamera extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get camera frequency
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityCamera && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityCamera)tileEntity).getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityCamera) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityCamera)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public class BlockCloakingCore extends BlockContainer {
|
||||
|
@ -64,13 +63,14 @@ public class BlockCloakingCore extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityCloakingCore cloakingCore = (TileEntityCloakingCore)world.getTileEntity(x, y, z);
|
||||
if (cloakingCore != null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityCloakingCore) {
|
||||
TileEntityCloakingCore cloakingCore = (TileEntityCloakingCore)tileEntity;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
WarpDrive.addChatMessage(entityPlayer, cloakingCore.getStatus());
|
||||
// + " isInvalid? " + te.isInvalid() + " Valid? " + te.isValid + " Cloaking? " + te.isCloaking + " Enabled? " + te.isEnabled
|
||||
|
@ -79,9 +79,9 @@ public class BlockCloakingCore extends BlockContainer {
|
|||
cloakingCore.isEnabled = !cloakingCore.isEnabled;
|
||||
WarpDrive.addChatMessage(entityPlayer, cloakingCore.getStatus());
|
||||
return true;
|
||||
} else if (false) {// TODO if player has advanced tool
|
||||
WarpDrive.addChatMessage(entityPlayer, cloakingCore.getStatus() + "\n" + cloakingCore.getEnergyStatus());
|
||||
return true;
|
||||
// } else if (xxx) {// TODO if player has advanced tool
|
||||
// WarpDrive.addChatMessage(entityPlayer, cloakingCore.getStatus() + "\n" + cloakingCore.getEnergyStatus());
|
||||
// return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.data.CameraRegistryItem;
|
||||
import cr0s.warpdrive.render.ClientCameraHandler;
|
||||
|
@ -53,29 +52,30 @@ public class BlockMonitor extends BlockContainer {
|
|||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
// Monitor is only reacting client side
|
||||
if (!FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (!world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get camera frequency
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityMonitor && (entityPlayer.getHeldItem() == null)) {
|
||||
int videoChannel = ((TileEntityMonitor)tileEntity).getVideoChannel();
|
||||
CameraRegistryItem camera = WarpDrive.instance.cameras.getCameraByFrequency(world, videoChannel);
|
||||
if (camera == null || entityPlayer.isSneaking()) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityMonitor)tileEntity).getStatus());
|
||||
return true;
|
||||
} else {
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.monitor.viewingCamera",
|
||||
videoChannel,
|
||||
camera.position.chunkPosX,
|
||||
camera.position.chunkPosY,
|
||||
camera.position.chunkPosZ ));
|
||||
ClientCameraHandler.setupViewpoint(
|
||||
camera.type, entityPlayer, entityPlayer.rotationYaw, entityPlayer.rotationPitch,
|
||||
x, y, z, this,
|
||||
camera.position.chunkPosX, camera.position.chunkPosY, camera.position.chunkPosZ, world.getBlock(camera.position.chunkPosX, camera.position.chunkPosY, camera.position.chunkPosZ));
|
||||
if (tileEntity instanceof TileEntityMonitor) {
|
||||
int videoChannel = ((TileEntityMonitor)tileEntity).getVideoChannel();
|
||||
CameraRegistryItem camera = WarpDrive.instance.cameras.getCameraByFrequency(world, videoChannel);
|
||||
if (camera == null || entityPlayer.isSneaking()) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityMonitor)tileEntity).getStatus());
|
||||
return true;
|
||||
} else {
|
||||
WarpDrive.addChatMessage(entityPlayer, StatCollector.translateToLocalFormatted("warpdrive.monitor.viewingCamera",
|
||||
videoChannel,
|
||||
camera.position.chunkPosX,
|
||||
camera.position.chunkPosY,
|
||||
camera.position.chunkPosZ ));
|
||||
ClientCameraHandler.setupViewpoint(
|
||||
camera.type, entityPlayer, entityPlayer.rotationYaw, entityPlayer.rotationPitch,
|
||||
x, y, z, this,
|
||||
camera.position.chunkPosX, camera.position.chunkPosY, camera.position.chunkPosZ, world.getBlock(camera.position.chunkPosX, camera.position.chunkPosY, camera.position.chunkPosZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
|
||||
public class BlockRadar extends BlockContainer {
|
||||
private IIcon[] iconBuffer;
|
||||
|
@ -84,14 +82,16 @@ public class BlockRadar extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityAbstractEnergy abstractEnergy = (TileEntityAbstractEnergy) world.getTileEntity(x, y, z);
|
||||
if (abstractEnergy != null && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, abstractEnergy.getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityRadar) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityRadar)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -6,10 +6,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.BlockAbstractContainer;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
|
||||
public class BlockEnergyBank extends BlockAbstractContainer {
|
||||
private IIcon iconBuffer;
|
||||
|
@ -36,14 +34,16 @@ public class BlockEnergyBank extends BlockAbstractContainer {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityAbstractEnergy abstractEnergy = (TileEntityAbstractEnergy) world.getTileEntity(x, y, z);
|
||||
if (abstractEnergy != null && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, abstractEnergy.getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityEnergyBank) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityEnergyBank) tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cr0s.warpdrive.block.energy;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -59,14 +58,14 @@ public class BlockIC2reactorLaserMonitor extends BlockAbstractContainer {// TODO
|
|||
* Called upon block activation (right click on the block.)
|
||||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = par1World.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityIC2reactorLaserMonitor) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityIC2reactorLaserMonitor) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityIC2reactorLaserMonitor) tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
|
||||
public class BlockLift extends BlockContainer
|
||||
{
|
||||
|
@ -82,14 +80,16 @@ public class BlockLift extends BlockContainer
|
|||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityAbstractEnergy abstractEnergy = (TileEntityAbstractEnergy)world.getTileEntity(x, y, z);
|
||||
if (abstractEnergy != null && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, abstractEnergy.getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityLift) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityLift)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
@ -89,19 +88,20 @@ public class BlockShipController extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Report status
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityShipController && (entityPlayer.getHeldItem() == null)) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipController)tileEntity).getStatus());
|
||||
} else {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipController)tileEntity).attachPlayer(entityPlayer));
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityShipController) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipController)tileEntity).getStatus());
|
||||
} else {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipController)tileEntity).attachPlayer(entityPlayer));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public class BlockShipCore extends BlockContainer {
|
||||
|
@ -81,14 +80,14 @@ public class BlockShipCore extends BlockContainer {
|
|||
* Called upon block activation (right click on the block.)
|
||||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityShipCore) {
|
||||
if (tileEntity instanceof TileEntityShipCore) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipCore)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cr0s.warpdrive.block.movement;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.BlockAbstractContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -48,13 +47,13 @@ public class BlockTransporter extends BlockAbstractContainer {
|
|||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityTransporter) {
|
||||
if (tileEntity instanceof TileEntityTransporter) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityTransporter)tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.BlockAbstractContainer;
|
||||
import cr0s.warpdrive.block.TileEntityLaser;
|
||||
|
@ -63,15 +62,16 @@ public class BlockLaserCamera extends BlockAbstractContainer {
|
|||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Report status
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (!ClientCameraHandler.isOverlayEnabled && tileEntity != null && tileEntity instanceof TileEntityLaser && (entityPlayer.getHeldItem() == null)) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaser)tileEntity).getStatus());
|
||||
return true;
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityLaser && !ClientCameraHandler.isOverlayEnabled) {
|
||||
WarpDrive.addChatMessage(entityPlayer, ((TileEntityLaser) tileEntity).getStatus());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue