use of net.minecraft.tileentity.TileEntity in project PneumaticCraft by MineMaarten.
the class BlockPressureTube method onBlockAdded.
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityPressureTube) {
TileEntityPressureTube tePt = (TileEntityPressureTube) te;
tePt.updateConnections(world, x, y, z);
}
}
use of net.minecraft.tileentity.TileEntity in project PneumaticCraft by MineMaarten.
the class ItemRemote method onUpdate.
@Override
public void onUpdate(ItemStack remote, World worl, Entity entity, int slot, boolean holdingItem) {
if (!worl.isRemote) {
NBTTagCompound tag = remote.getTagCompound();
if (tag != null) {
if (tag.hasKey("securityX")) {
int x = tag.getInteger("securityX");
int y = tag.getInteger("securityY");
int z = tag.getInteger("securityZ");
int dimensionId = tag.getInteger("securityDimension");
WorldServer world = null;
for (WorldServer w : MinecraftServer.getServer().worldServers) {
if (w.provider.dimensionId == dimensionId) {
world = w;
break;
}
}
if (world != null) {
TileEntity te = world.getTileEntity(x, y, z);
if (!(te instanceof TileEntitySecurityStation)) {
tag.removeTag("securityX");
tag.removeTag("securityY");
tag.removeTag("securityZ");
tag.removeTag("securityDimension");
}
}
}
}
}
}
use of net.minecraft.tileentity.TileEntity in project PneumaticCraft by MineMaarten.
the class ItemRemote method isAllowedToEdit.
private boolean isAllowedToEdit(EntityPlayer player, ItemStack remote) {
NBTTagCompound tag = remote.getTagCompound();
if (tag != null) {
if (tag.hasKey("securityX")) {
int x = tag.getInteger("securityX");
int y = tag.getInteger("securityY");
int z = tag.getInteger("securityZ");
int dimensionId = tag.getInteger("securityDimension");
WorldServer world = null;
for (WorldServer w : MinecraftServer.getServer().worldServers) {
if (w.provider.dimensionId == dimensionId) {
world = w;
break;
}
}
if (world != null) {
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof TileEntitySecurityStation) {
boolean canAccess = ((TileEntitySecurityStation) te).doesAllowPlayer(player);
if (!canAccess) {
player.addChatComponentMessage(new ChatComponentTranslation("gui.remote.noEditRights", x, y, z));
}
return canAccess;
}
}
}
}
return true;
}
use of net.minecraft.tileentity.TileEntity in project PneumaticCraft by MineMaarten.
the class ItemAmadronTablet method getLiquidProvider.
public static IFluidHandler getLiquidProvider(ItemStack tablet) {
ChunkPosition pos = getLiquidProvidingLocation(tablet);
if (pos != null) {
int dimension = getLiquidProvidingDimension(tablet);
TileEntity te = PneumaticCraftUtils.getTileEntity(pos, dimension);
if (te instanceof IFluidHandler)
return (IFluidHandler) te;
}
return null;
}
use of net.minecraft.tileentity.TileEntity in project PneumaticCraft by MineMaarten.
the class PacketSecurityStation method handleServerSide.
@Override
public void handleServerSide(REQ message, EntityPlayer player) {
TileEntity te = player.worldObj.getTileEntity(message.x, message.y, message.z);
handleServerSide(te, message.username);
}
Aggregations