Package net.minecraft.tileentity

Examples of net.minecraft.tileentity.TileEntity


  @Override
  public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
    super.writeToWorld(context, x, y, z, stacks);

    if (block.hasTileEntity(meta)) {
      TileEntity tile = context.world().getTileEntity(x, y, z);

      cpt.setInteger("x", x);
      cpt.setInteger("y", y);
      cpt.setInteger("z", z);

      if (tile != null) {
        tile.readFromNBT(cpt);
      }
    }
  }
View Full Code Here


  @Override
  public void readFromWorld(IBuilderContext context, int x, int y, int z) {
    super.readFromWorld(context, x, y, z);

    if (block.hasTileEntity(meta)) {
      TileEntity tile = context.world().getTileEntity(x, y, z);

      if (tile != null) {
        tile.writeToNBT(cpt);
      }
    }
  }
View Full Code Here

  @Override
  public void readRequirementsFromWorld(IBuilderContext context, int x, int y, int z) {
    super.readRequirementsFromWorld(context, x, y, z);

    if (block.hasTileEntity(meta)) {
      TileEntity tile = context.world().getTileEntity(x, y, z);

      if (tile instanceof IInventory) {
        IInventory inv = (IInventory) tile;

        ArrayList<ItemStack> rqs = new ArrayList<ItemStack>();
View Full Code Here

    if (mop == null)
      return itemstack;

    Block block = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
    int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
        TileEntity tile = world.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
    ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();

    if (player.canPlayerEdit(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit, itemstack)) {
      ItemStack stack = getPickedBlock(itemstack);
      if (stack != null) {
        if (mop.sideHit == 0)
          --mop.blockY;
        if (mop.sideHit == 1)
          ++mop.blockY;
        if (mop.sideHit == 2)
          --mop.blockZ;
        if (mop.sideHit == 3)
          ++mop.blockZ;
        if (mop.sideHit == 4)
          --mop.blockX;
        if (mop.sideHit == 5)
          ++mop.blockX;

        if (block.canPlaceBlockOnSide(world, mop.blockX, mop.blockY, mop.blockZ, mop.sideHit)) {
          if (!world.isRemote) {
            world.setBlock(mop.blockX, mop.blockY, mop.blockZ, ((ItemBlock) stack.getItem()).field_150939_a, stack.getItemDamage(), 1 | 2);
            block.onBlockPlacedBy(world, mop.blockX, mop.blockY, mop.blockZ, player, itemstack);
            NBTTagCompound tileCmp = getStackTileEntity(itemstack);
            if (tileCmp != null && !tileCmp.hasNoTags()) {
              TileEntity tile1 = TileEntity.createAndLoadEntity(tileCmp);
              tile1.xCoord = mop.blockX;
              tile1.yCoord = mop.blockY;
              tile1.zCoord = mop.blockZ;
              world.setTileEntity(mop.blockX, mop.blockY, mop.blockZ, tile1);
            }
View Full Code Here

    return null;
  }

  @Override
  public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null)
      return getPeripheral(te);
    return null;
  }
View Full Code Here

  @Override
  public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
    if (par3World.isRemote)
      return false;

    TileEntity tile = par3World.getTileEntity(par4, par5, par6);

    if (getY(par1ItemStack) == -1) {
      if (tile != null && (tile instanceof TileTransvector || tile instanceof TileGolemConnector)) {
        setX(par1ItemStack, par4);
        setY(par1ItemStack, par5);
        setZ(par1ItemStack, par6);

        if (par3World.isRemote)
          par2EntityPlayer.swingItem();

        playSound(par3World, par4, par5, par6);
        if (tile instanceof TileTransvector)
          par2EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.connector.set"));
        else
          par2EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.golemconnector.set"));
      } else
        par2EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.connector.notinterf"));
    } else {
      int x = getX(par1ItemStack);
      int y = getY(par1ItemStack);
      int z = getZ(par1ItemStack);

      TileEntity tile1 = par3World.getTileEntity(x, y, z);
      if (tile1 == null || !(tile1 instanceof TileTransvector)) {
        setY(par1ItemStack, -1);

        par2EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.connector.notpresent"));
      } else {
View Full Code Here

          return true;
        }
        int x = getX(par1ItemStack);
        int y = getY(par1ItemStack);
        int z = getZ(par1ItemStack);
        TileEntity tile1 = par2EntityPlayer.worldObj.getTileEntity(x, y, z);
        if (tile1 == null || !(tile1 instanceof TileGolemConnector)) {
          setY(par1ItemStack, -1);
          if (par3EntityLivingBase.worldObj.isRemote) {
            return false;
          }
View Full Code Here

public class GuiHandler implements IGuiHandler {

  @Override
  public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    TileEntity tile = world.getTileEntity(x, y, z);
    switch (ID) {
      case LibGuiIDs.GUI_ID_TABLET:
        return new ContainerAnimationTablet((TileAnimationTablet) tile, player.inventory);

      case LibGuiIDs.GUI_ID_MOB_MAGNET:
View Full Code Here

    return null;
  }

  @Override
  public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    TileEntity tile = world.getTileEntity(x, y, z);
    switch (ID) {
      case LibGuiIDs.GUI_ID_TABLET:
        return new GuiAnimationTablet((TileAnimationTablet) tile, player.inventory);

      case LibGuiIDs.GUI_ID_MOB_MAGNET:
View Full Code Here

      if (world == null) {
        MiscHelper.printCurrentStackTrace("No world found for dimension " + message.dim + "!");
        return null;
      }

      TileEntity tile = world.getTileEntity(message.x, message.y, message.z);
      if (tile != null) {
        message.tile = (T) tile;
      }
    }
    return null;
View Full Code Here

TOP

Related Classes of net.minecraft.tileentity.TileEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.