Search in sources :

Example 21 with ChunkPosition

use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.

the class ItemGPSTool method onUpdate.

@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean heldItem) {
    String var = getVariable(stack);
    if (!var.equals("") && !world.isRemote) {
        ChunkPosition pos = GlobalVariableManager.getInstance().getPos(var);
        setGPSLocation(stack, pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
    }
}
Also used : ChunkPosition(net.minecraft.world.ChunkPosition)

Example 22 with ChunkPosition

use of net.minecraft.world.ChunkPosition 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;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ChunkPosition(net.minecraft.world.ChunkPosition) IFluidHandler(net.minecraftforge.fluids.IFluidHandler)

Example 23 with ChunkPosition

use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.

the class ItemAmadronTablet method getItemProvidingLocation.

public static ChunkPosition getItemProvidingLocation(ItemStack tablet) {
    NBTTagCompound compound = tablet.getTagCompound();
    if (compound != null) {
        int x = compound.getInteger("itemX");
        int y = compound.getInteger("itemY");
        int z = compound.getInteger("itemZ");
        if (x != 0 || y != 0 || z != 0) {
            return new ChunkPosition(x, y, z);
        } else {
            return null;
        }
    } else {
        return null;
    }
}
Also used : ChunkPosition(net.minecraft.world.ChunkPosition) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 24 with ChunkPosition

use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.

the class PacketSetGlobalVariable method fromBytes.

@Override
public void fromBytes(ByteBuf buf) {
    varName = ByteBufUtils.readUTF8String(buf);
    value = new ChunkPosition(buf.readInt(), buf.readInt(), buf.readInt());
}
Also used : ChunkPosition(net.minecraft.world.ChunkPosition)

Example 25 with ChunkPosition

use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.

the class ContainerLogistics method getLogistics.

public static SemiBlockLogistics getLogistics(EntityPlayer player, ItemStack itemRequester) {
    if (itemRequester != null && itemRequester.getItem() instanceof ItemLogisticsFrame) {
        SemiBlockLogistics logistics = (SemiBlockLogistics) SemiBlockManager.getSemiBlockForKey(((ItemLogisticsFrame) itemRequester.getItem()).semiBlockId);
        logistics.initialize(player.worldObj, new ChunkPosition(0, 0, 0));
        logistics.onPlaced(player, itemRequester);
        return logistics;
    } else {
        return null;
    }
}
Also used : SemiBlockLogistics(pneumaticCraft.common.semiblock.SemiBlockLogistics) ItemLogisticsFrame(pneumaticCraft.common.item.ItemLogisticsFrame) ChunkPosition(net.minecraft.world.ChunkPosition)

Aggregations

ChunkPosition (net.minecraft.world.ChunkPosition)94 ItemStack (net.minecraft.item.ItemStack)16 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)12 NBTTagList (net.minecraft.nbt.NBTTagList)10 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)9 TileEntity (net.minecraft.tileentity.TileEntity)9 ArrayList (java.util.ArrayList)8 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)8 HashMap (java.util.HashMap)7 HashSet (java.util.HashSet)7 Map (java.util.Map)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 Chunk (net.minecraft.world.chunk.Chunk)4 FluidStack (net.minecraftforge.fluids.FluidStack)4 Stack (java.util.Stack)3 Block (net.minecraft.block.Block)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 IInventory (net.minecraft.inventory.IInventory)3 PathPoint (net.minecraft.pathfinding.PathPoint)3 Vec3 (net.minecraft.util.Vec3)3