Examples of readFromNBT()


Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

    if(stack.getTagCompound() != null)
    {
      stack.getTagCompound().setInteger("x", x);
      stack.getTagCompound().setInteger("y", y);
      stack.getTagCompound().setInteger("z", z);
      te.readFromNBT(stack.getTagCompound());
    }
   
    if(te instanceof TileEntityFactory && ((TileEntityFactory)te).canRotate())
    {
      int facing = MathHelper.floor_double((entity.rotationYaw * 4F) / 360F + 0.5D) & 3;
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

      if (tag.hasKey(TAG_SPAWNER))
        tag = tag.getCompoundTag(TAG_SPAWNER);
      tag.setInteger("x", x);
      tag.setInteger("y", y);
      tag.setInteger("z", z);
      te.readFromNBT(tag);
      world.markBlockForUpdate(x, y, z);
    }

    return true;
  }
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

    {
      if (hasTag(stack) && _block.hasTileEntity(meta))
      {
        TileEntity tile = world.getTileEntity(x, y, z);
        if (tile != null)
          tile.readFromNBT(getTag(world, x, y, z, stack));
      }
      return true;
    }
    return false;
  }
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

        nmsTag.setInteger("z", z);
        // Add that data to the current tile entity in the world
        TileEntity tileEntity = world.getTileEntity(x, y, z);
        if (tileEntity != null)
        {
            tileEntity.readFromNBT(nmsTag);
        } else
        {
            TerrainControl.log(LogMarker.DEBUG, "Skipping tile entity with id {}, cannot be placed at {},{},{} on id {}", new Object[] {
                    nmsTag.getString("id"), x, y, z, getMaterial(x, y, z)});
        }
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

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

      if (tile != null) {
        tile.readFromNBT(tileNBT);
      }
    }
  }

  @Override
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

        world.setBlock(x, y, z, blockID, metadata, 3);
        TileEntity entity = world.getTileEntity(x, y, z);
        if (entity != null && tile != null)
        {
            entity.readFromNBT(tile);
        }

        return true;
    }
}
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

      throw new RuntimeException("Failed to set new block tile entity!");
    else if (tile.getClass() != definition.teClass)
      throw new RuntimeException(String.format("Converted tile entity was '%s' instead of expected '%s'", tile.getClass(), definition.teClass));
    Proxies.log.info("Refreshing converted tile entity %s with nbt data...", tile.getClass());
    if (nbttagcompound.hasKey("Machine"))
      tile.readFromNBT(complementNBT(nbttagcompound, nbttagcompound.getCompoundTag("Machine"), definition));
    else
      tile.readFromNBT(nbttagcompound);
  }

  private NBTTagCompound complementNBT(NBTTagCompound parent, NBTTagCompound inner, MachineDefinition definition) {
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

      throw new RuntimeException(String.format("Converted tile entity was '%s' instead of expected '%s'", tile.getClass(), definition.teClass));
    Proxies.log.info("Refreshing converted tile entity %s with nbt data...", tile.getClass());
    if (nbttagcompound.hasKey("Machine"))
      tile.readFromNBT(complementNBT(nbttagcompound, nbttagcompound.getCompoundTag("Machine"), definition));
    else
      tile.readFromNBT(nbttagcompound);
  }

  private NBTTagCompound complementNBT(NBTTagCompound parent, NBTTagCompound inner, MachineDefinition definition) {

    inner.setString("id", definition.teIdent);
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

        System.out.println(new String(bdata));

        // reconstruct TE
        NBTTagCompound compound = (NBTTagCompound) JsonToNBT.func_150315_a(new String(bdata, Charsets.UTF_8));
        TileEntity te = (TileEntity) Class.forName(compound.getString("TE_CLASS")).newInstance();
        te.readFromNBT(compound);

        world.setTileEntity(bc.getX(), bc.getY(), bc.getZ(), te);
      }
      catch (Exception e)
      {
View Full Code Here

Examples of net.minecraft.tileentity.TileEntity.readFromNBT()

        if (nbt != null)
        {
            te = world.getTileEntity(x, y, z);
            if (te != null)
            {
                te.readFromNBT(nbt);
            }
        }

        if (DEBUG)
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.