public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); if (tileentitypiston == null) { return null; } else { float f = tileentitypiston.getProgress(0.0F); if (tileentitypiston.isExtending()) { f = 1.0F - f; } return this.getBoundingBox(worldIn, pos, tileentitypiston.getPistonState(), f, tileentitypiston.getFacing()); } }
private TileEntityRendererDispatcher() { this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer()); this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values()) { tileentityspecialrenderer.setRendererDispatcher(this); } }
private TileEntityRendererDispatcher() { this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer()); this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer()); this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer()); this.mapSpecialRenderers.put(TileEntityShulkerBox.class, new TileEntityShulkerBoxRenderer(new ModelShulker())); for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values()) { tileentityspecialrenderer.setRendererDispatcher(this); } }
private TileEntityRendererDispatcher() { this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer()); this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer()); this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer()); for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values()) { tileentityspecialrenderer.setRendererDispatcher(this); } }
/** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { TileEntityPiston var5 = this.func_149963_e(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_); if (var5 == null) { return null; } else { float var6 = var5.func_145860_a(0.0F); if (var5.func_145868_b()) { var6 = 1.0F - var6; } return this.func_149964_a(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_, var5.func_145861_a(), var6, var5.func_145864_c()); } }
private TileEntityRendererDispatcher() { this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new RenderEndPortal()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator var1 = this.mapSpecialRenderers.values().iterator(); while (var1.hasNext()) { TileEntitySpecialRenderer var2 = (TileEntitySpecialRenderer)var1.next(); var2.func_147497_a(this); } }
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { TileEntityPiston tileentitypiston = this.func_149963_e(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_); if (tileentitypiston == null) { return null; } else { float f = tileentitypiston.func_145860_a(0.0F); if (tileentitypiston.isExtending()) { f = 1.0F - f; } return this.func_149964_a(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_, tileentitypiston.getStoredBlockID(), f, tileentitypiston.getPistonOrientation()); } }
private TileEntityRendererDispatcher() { this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new RenderEndPortal()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator iterator = this.mapSpecialRenderers.values().iterator(); while (iterator.hasNext()) { TileEntitySpecialRenderer tileentityspecialrenderer = (TileEntitySpecialRenderer)iterator.next(); tileentityspecialrenderer.func_147497_a(this); } }
public void func_71902_a(IBlockAccess p_71902_1_, int p_71902_2_, int p_71902_3_, int p_71902_4_) { TileEntityPiston var5 = this.func_72295_d(p_71902_1_, p_71902_2_, p_71902_3_, p_71902_4_); if(var5 != null) { Block var6 = Block.field_71973_m[var5.func_70340_a()]; if(var6 == null || var6 == this) { return; } var6.func_71902_a(p_71902_1_, p_71902_2_, p_71902_3_, p_71902_4_); float var7 = var5.func_70333_a(0.0F); if(var5.func_70341_b()) { var7 = 1.0F - var7; } int var8 = var5.func_70336_c(); this.field_72026_ch = var6.func_83009_v() - (double)((float)Facing.field_71586_b[var8] * var7); this.field_72023_ci = var6.func_83008_x() - (double)((float)Facing.field_71587_c[var8] * var7); this.field_72024_cj = var6.func_83005_z() - (double)((float)Facing.field_71585_d[var8] * var7); this.field_72021_ck = var6.func_83007_w() - (double)((float)Facing.field_71586_b[var8] * var7); this.field_72022_cl = var6.func_83010_y() - (double)((float)Facing.field_71587_c[var8] * var7); this.field_72019_cm = var6.func_83006_A() - (double)((float)Facing.field_71585_d[var8] * var7); } }
private TileEntityRenderer() { this.field_76966_m.put(TileEntitySign.class, new TileEntitySignRenderer()); this.field_76966_m.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.field_76966_m.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.field_76966_m.put(TileEntityChest.class, new TileEntityChestRenderer()); this.field_76966_m.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.field_76966_m.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.field_76966_m.put(TileEntityEndPortal.class, new RenderEndPortal()); this.field_76966_m.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.field_76966_m.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator var1 = this.field_76966_m.values().iterator(); while(var1.hasNext()) { TileEntitySpecialRenderer var2 = (TileEntitySpecialRenderer)var1.next(); var2.func_76893_a(this); } }
/** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { TileEntityPiston tileentitypiston = this.getTileEntityAtLocation(par1World, par2, par3, par4); if (tileentitypiston == null) { return null; } else { float f = tileentitypiston.getProgress(0.0F); if (tileentitypiston.isExtending()) { f = 1.0F - f; } return this.getAxisAlignedBB(par1World, par2, par3, par4, tileentitypiston.getStoredBlockID(), f, tileentitypiston.getPistonOrientation()); } }
private TileEntityRenderer() { this.specialRendererMap.put(TileEntitySign.class, new TileEntitySignRenderer()); this.specialRendererMap.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.specialRendererMap.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.specialRendererMap.put(TileEntityChest.class, new TileEntityChestRenderer()); this.specialRendererMap.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.specialRendererMap.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.specialRendererMap.put(TileEntityEndPortal.class, new RenderEndPortal()); this.specialRendererMap.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.specialRendererMap.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator iterator = this.specialRendererMap.values().iterator(); while (iterator.hasNext()) { TileEntitySpecialRenderer tileentityspecialrenderer = (TileEntitySpecialRenderer)iterator.next(); tileentityspecialrenderer.setTileEntityRenderer(this); } }
public static void storeTileEntity(TileEntityPiston tePiston, NBTTagCompound teData) { if (teData != null) { Class c = tePiston.getClass(); try { Field storedTileEntityData = c.getDeclaredField("storedTileEntityData"); storedTileEntityData.set(tePiston, teData); // construct and cache a "dummy" te for rendering Field cachedTileEntity = c.getDeclaredField("cachedTileEntity"); TileEntity cachedTE = TileEntity.createAndLoadEntity(teData); cachedTE.setWorldObj(tePiston.getWorldObj()); cachedTE.blockMetadata = tePiston.getBlockMetadata(); cachedTE.blockType = tePiston.getStoredBlockID(); cachedTileEntity.set(tePiston, cachedTE); } catch (Exception e) { e.printStackTrace(); } } }
public static void restoreStoredPistonBlock (World worldObj, int xCoord, int yCoord, int zCoord, Block block, int meta, TileEntityPiston tePiston) { NBTTagCompound tileEntityData = null; Class c = tePiston.getClass(); try { Field storedTileEntityData = c.getDeclaredField("storedTileEntityData"); tileEntityData = (NBTTagCompound) storedTileEntityData.get(tePiston); Field cachedTileEntity = c.getDeclaredField("cachedTileEntity"); cachedTileEntity.set(tePiston, null); } catch (Exception e) { e.printStackTrace(); } worldObj.setBlock(xCoord, yCoord, zCoord, block); worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta, 3); TileEntity te = TileEntity.createAndLoadEntity(tileEntityData); te.xCoord = xCoord; te.yCoord = yCoord; te.zCoord = zCoord; worldObj.setTileEntity(xCoord, yCoord, zCoord, te); worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, block); }
public boolean isRetractingStickyPistonFacing(int x, int y, int z, int facing) { BlockPos pos = new BlockPos(x,y,z); IBlockState state = world.getBlockState(pos); if(state.getBlock() != Blocks.PISTON_EXTENSION) return false; TileEntity t = world.getTileEntity(pos); if(!(t instanceof TileEntityPiston)) return false; TileEntityPiston tep = (TileEntityPiston)t; return tep.getFacing().ordinal() == facing && !tep.isExtending() && tep.getPistonState().getBlock() == Blocks.STICKY_PISTON; }
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityPiston) { ((TileEntityPiston)tileentity).clearPistonTileEntity(); } else { super.breakBlock(worldIn, pos, state); } }
/** * Spawns this Block's drops into the World as EntityItems. */ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { if (!worldIn.isRemote) { TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); if (tileentitypiston != null) { IBlockState iblockstate = tileentitypiston.getPistonState(); iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); } } }
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); if (tileentitypiston != null) { IBlockState iblockstate = tileentitypiston.getPistonState(); Block block = iblockstate.getBlock(); if (block == this || block.getMaterial() == Material.air) { return; } float f = tileentitypiston.getProgress(0.0F); if (tileentitypiston.isExtending()) { f = 1.0F - f; } block.setBlockBoundsBasedOnState(worldIn, pos); if (block == Blocks.piston || block == Blocks.sticky_piston) { f = 0.0F; } EnumFacing enumfacing = tileentitypiston.getFacing(); this.minX = block.getBlockBoundsMinX() - (double)((float)enumfacing.getFrontOffsetX() * f); this.minY = block.getBlockBoundsMinY() - (double)((float)enumfacing.getFrontOffsetY() * f); this.minZ = block.getBlockBoundsMinZ() - (double)((float)enumfacing.getFrontOffsetZ() * f); this.maxX = block.getBlockBoundsMaxX() - (double)((float)enumfacing.getFrontOffsetX() * f); this.maxY = block.getBlockBoundsMaxY() - (double)((float)enumfacing.getFrontOffsetY() * f); this.maxZ = block.getBlockBoundsMaxZ() - (double)((float)enumfacing.getFrontOffsetZ() * f); } }
/** * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated */ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityPiston) { ((TileEntityPiston)tileentity).clearPistonTileEntity(); } else { super.breakBlock(worldIn, pos, state); } }
/** * Spawns this Block's drops into the World as EntityItems. */ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { if (!worldIn.isRemote) { TileEntityPiston tileentitypiston = this.getTilePistonAt(worldIn, pos); if (tileentitypiston != null) { IBlockState iblockstate = tileentitypiston.getPistonState(); iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); } } }
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) { TileEntityPiston tileentitypiston = this.getTilePistonAt(worldIn, pos); if (tileentitypiston != null) { tileentitypiston.func_190609_a(worldIn, pos, entityBox, collidingBoxes, entityIn); } }