Java Code Examples for net.minecraft.tileentity.TileEntity#setWorldObj()
The following examples show how to use
net.minecraft.tileentity.TileEntity#setWorldObj() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MovingBlock.java From Framez with GNU General Public License v3.0 | 6 votes |
@Override public void startMoving(boolean invalidate, boolean validate) { TileEntity te = getTileEntity(); if (te != null) { if (invalidate) te.invalidate(); } if (!getWorld().isRemote) { BlockUtils.setBlockSneaky(getWorld(), getX(), getY(), getZ(), Blocks.air); getWorld().setBlockMetadataWithNotify(getX(), getY(), getZ(), 0, 2); } if (te != null) BlockUtils.removeTileEntity(getWorld(), getX(), getY(), getZ()); if (te != null && validate) { te.setWorldObj(FakeWorld.getFakeWorld(this)); te.validate(); } }
Example 2
Source File: MobileChunk.java From archimedes-ships with MIT License | 6 votes |
/** * Sets the TileEntity for a given block in this chunk */ private void setChunkBlockTileEntity(int x, int y, int z, TileEntity tileentity) { ChunkPosition chunkposition = new ChunkPosition(x, y, z); tileentity.setWorldObj(worldObj); int ox = tileentity.xCoord; int oy = tileentity.yCoord; int oz = tileentity.zCoord; tileentity.xCoord = x; tileentity.yCoord = y; tileentity.zCoord = z; Block block = getBlock(x, y, z); if (block != null && block.hasTileEntity(getBlockMetadata(x, y, z))) { tileentity.blockMetadata = getBlockMetadata(x, y, z); tileentity.invalidate(); chunkTileEntityMap.put(chunkposition, tileentity); if (tileentity instanceof IShipTileEntity) { ((IShipTileEntity) tileentity).setParentShip(entityShip, ox, oy, oz); } } }
Example 3
Source File: ItemRenderStoneMachine.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
public void registerRenderer(int metadata, TileEntity tile, TileEntitySpecialRenderer renderer) { RenderInfo info = new RenderInfo(); info.renderer = renderer; info.tile = tile; renderers.put(metadata, info); if(tile.getWorldObj() == null) { tile.setWorldObj(FAKE_WORLD); } }
Example 4
Source File: FakeWorldTCGeneration.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public TileEntity getTileEntity(int x, int y, int z) { TileEntity te = getBlock(x, y, z).createTileEntity(null, getBlockMetadata(x, y, z)); if(te == null) return null; ChunkCoordinates cc = new ChunkCoordinates(x, y, z); if(!gettedTE.containsKey(cc)) gettedTE.put(cc, te); te.setWorldObj(this); te.xCoord = x; te.yCoord = y; te.zCoord = z; return te; }
Example 5
Source File: MovingBlock.java From Framez with GNU General Public License v3.0 | 5 votes |
@Override public void finishMoving(boolean invalidate, boolean validate) { Vec3i newLocation = getStructure().getMovement().transform(new Vec3i(this)); TileEntity te = getTileEntity(); if (te != null && invalidate) te.invalidate(); // if (!newLocation.getWorld().isRemote) { if (getWorld().isRemote) { newLocation.getWorld().setBlock(newLocation.getX(), newLocation.getY(), newLocation.getZ(), getBlock(), 0, 0); } else { BlockUtils.setBlockSneaky(newLocation.getWorld(), newLocation.getX(), newLocation.getY(), newLocation.getZ(), getBlock()); } newLocation.getWorld().setBlockMetadataWithNotify(newLocation.getX(), newLocation.getY(), newLocation.getZ(), getMetadata(), 2); // } if (te != null) { te.setWorldObj(newLocation.getWorld()); te.xCoord = newLocation.getX(); te.yCoord = newLocation.getY(); te.zCoord = newLocation.getZ(); if (validate) te.validate(); BlockUtils.setTileEntity(newLocation.getWorld(), newLocation.getX(), newLocation.getY(), newLocation.getZ(), te); } }