public boolean renderBlockHopper(BlockHopper p_147803_1_, int p_147803_2_, int p_147803_3_, int p_147803_4_) { Tessellator var5 = Tessellator.instance; var5.setBrightness(p_147803_1_.getBlockBrightness(this.blockAccess, p_147803_2_, p_147803_3_, p_147803_4_)); int var6 = p_147803_1_.colorMultiplier(this.blockAccess, p_147803_2_, p_147803_3_, p_147803_4_); float var7 = (float)(var6 >> 16 & 255) / 255.0F; float var8 = (float)(var6 >> 8 & 255) / 255.0F; float var9 = (float)(var6 & 255) / 255.0F; if (EntityRenderer.anaglyphEnable) { float var10 = (var7 * 30.0F + var8 * 59.0F + var9 * 11.0F) / 100.0F; float var11 = (var7 * 30.0F + var8 * 70.0F) / 100.0F; float var12 = (var7 * 30.0F + var9 * 70.0F) / 100.0F; var7 = var10; var8 = var11; var9 = var12; } var5.setColorOpaque_F(var7, var8, var9); return this.renderBlockHopperMetadata(p_147803_1_, p_147803_2_, p_147803_3_, p_147803_4_, this.blockAccess.getBlockMetadata(p_147803_2_, p_147803_3_, p_147803_4_), false); }
public boolean func_145887_i() { if (this.worldObj != null && !this.worldObj.isClient) { if (!this.func_145888_j() && BlockHopper.func_149917_c(this.getBlockMetadata())) { boolean var1 = this.func_145883_k(); var1 = func_145891_a(this) || var1; if (var1) { this.func_145896_c(8); this.onInventoryChanged(); return true; } } return false; } else { return false; } }
public boolean renderBlockHopper(BlockHopper p_147803_1_, int p_147803_2_, int p_147803_3_, int p_147803_4_) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(p_147803_1_.getMixedBrightnessForBlock(this.blockAccess, p_147803_2_, p_147803_3_, p_147803_4_)); int l = p_147803_1_.colorMultiplier(this.blockAccess, p_147803_2_, p_147803_3_, p_147803_4_); float f = (float)(l >> 16 & 255) / 255.0F; float f1 = (float)(l >> 8 & 255) / 255.0F; float f2 = (float)(l & 255) / 255.0F; if (EntityRenderer.anaglyphEnable) { float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; f = f3; f1 = f4; f2 = f5; } tessellator.setColorOpaque_F(f, f1, f2); return this.renderBlockHopperMetadata(p_147803_1_, p_147803_2_, p_147803_3_, p_147803_4_, this.blockAccess.getBlockMetadata(p_147803_2_, p_147803_3_, p_147803_4_), false); }
public boolean func_94172_a(BlockHopper p_94172_1_, int p_94172_2_, int p_94172_3_, int p_94172_4_) { Tessellator var5 = Tessellator.field_78398_a; var5.func_78380_c(p_94172_1_.func_71874_e(this.field_78669_a, p_94172_2_, p_94172_3_, p_94172_4_)); float var6 = 1.0F; int var7 = p_94172_1_.func_71920_b(this.field_78669_a, p_94172_2_, p_94172_3_, p_94172_4_); float var8 = (float)(var7 >> 16 & 255) / 255.0F; float var9 = (float)(var7 >> 8 & 255) / 255.0F; float var10 = (float)(var7 & 255) / 255.0F; if(EntityRenderer.field_78517_a) { float var11 = (var8 * 30.0F + var9 * 59.0F + var10 * 11.0F) / 100.0F; float var12 = (var8 * 30.0F + var9 * 70.0F) / 100.0F; float var13 = (var8 * 30.0F + var10 * 70.0F) / 100.0F; var8 = var11; var9 = var12; var10 = var13; } var5.func_78386_a(var6 * var8, var6 * var9, var6 * var10); return this.func_96447_a(p_94172_1_, p_94172_2_, p_94172_3_, p_94172_4_, this.field_78669_a.func_72805_g(p_94172_2_, p_94172_3_, p_94172_4_), false); }
public boolean func_98045_j() { if(this.field_70331_k != null && !this.field_70331_k.field_72995_K) { if(!this.func_98047_l() && BlockHopper.func_94452_d(this.func_70322_n())) { boolean var1 = this.func_94116_j(); var1 = func_96116_a(this) || var1; if(var1) { this.func_98046_c(8); this.func_70296_d(); return true; } } return false; } else { return false; } }
private boolean func_94116_j() { IInventory var1 = this.func_94119_v(); if(var1 == null) { return false; } else { for(int var2 = 0; var2 < this.func_70302_i_(); ++var2) { if(this.func_70301_a(var2) != null) { ItemStack var3 = this.func_70301_a(var2).func_77946_l(); ItemStack var4 = func_94117_a(var1, this.func_70298_a(var2, 1), Facing.field_71588_a[BlockHopper.func_94451_c(this.func_70322_n())]); if(var4 == null || var4.field_77994_a == 0) { var1.func_70296_d(); return true; } this.func_70299_a(var2, var3); } } return false; } }
public boolean renderBlockHopper(BlockHopper par1BlockHopper, int par2, int par3, int par4) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(par1BlockHopper.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); float f = 1.0F; int l = par1BlockHopper.colorMultiplier(this.blockAccess, par2, par3, par4); float f1 = (float)(l >> 16 & 255) / 255.0F; float f2 = (float)(l >> 8 & 255) / 255.0F; float f3 = (float)(l & 255) / 255.0F; if (EntityRenderer.anaglyphEnable) { float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; f1 = f4; f2 = f5; f3 = f6; } tessellator.setColorOpaque_F(f * f1, f * f2, f * f3); return this.renderBlockHopperMetadata(par1BlockHopper, par2, par3, par4, this.blockAccess.getBlockMetadata(par2, par3, par4), false); }
public boolean updateHopper() { if (this.worldObj != null && !this.worldObj.isRemote) { if (!this.isCoolingDown() && BlockHopper.getIsBlockNotPoweredFromMetadata(this.getBlockMetadata())) { boolean flag = this.insertItemToInventory(); flag = suckItemsIntoHopper(this) || flag; if (flag) { this.setTransferCooldown(8); this.onInventoryChanged(); return true; } } return false; } else { return false; } }
public boolean updateHopper() { if (this.worldObj != null && !this.worldObj.isRemote) { if (!this.isOnTransferCooldown() && BlockHopper.isEnabled(this.getBlockMetadata())) { boolean flag = false; if (!this.isEmpty()) { flag = this.transferItemsOut(); } if (!this.isFull()) { flag = captureDroppedItems(this) || flag; } if (flag) { this.setTransferCooldown(8); this.markDirty(); return true; } } return false; } else { return false; } }
private boolean transferItemsOut() { IInventory iinventory = this.getInventoryForHopperTransfer(); if (iinventory == null) { return false; } else { EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()).getOpposite(); if (this.isInventoryFull(iinventory, enumfacing)) { return false; } else { for (int i = 0; i < this.getSizeInventory(); ++i) { if (this.getStackInSlot(i) != null) { ItemStack itemstack = this.getStackInSlot(i).copy(); ItemStack itemstack1 = putStackInInventoryAllSlots(iinventory, this.decrStackSize(i, 1), enumfacing); if (itemstack1 == null || itemstack1.stackSize == 0) { iinventory.markDirty(); return true; } this.setInventorySlotContents(i, itemstack); } } return false; } } }
private boolean updateHopper() { if (this.world != null && !this.world.isRemote) { if (!this.isOnTransferCooldown() && BlockHopper.isEnabled(this.getBlockMetadata())) { boolean flag = false; if (!this.isEmpty()) { flag = this.transferItemsOut(); } if (!this.isFull()) { flag = captureDroppedItems(this) || flag; } if (flag) { this.setTransferCooldown(8); this.markDirty(); return true; } } return false; } else { return false; } }
private boolean transferItemsOut() { IInventory iinventory = this.getInventoryForHopperTransfer(); if (iinventory == null) { return false; } else { EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()).getOpposite(); if (this.isInventoryFull(iinventory, enumfacing)) { return false; } else { for (int i = 0; i < this.getSizeInventory(); ++i) { if (!this.getStackInSlot(i).func_190926_b()) { ItemStack itemstack = this.getStackInSlot(i).copy(); ItemStack itemstack1 = putStackInInventoryAllSlots(this, iinventory, this.decrStackSize(i, 1), enumfacing); if (itemstack1.func_190926_b()) { iinventory.markDirty(); return true; } this.setInventorySlotContents(i, itemstack); } } return false; } } }
private boolean transferItemsOut() { if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; } IInventory iinventory = this.getInventoryForHopperTransfer(); if (iinventory == null) { return false; } else { EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()).getOpposite(); if (this.isInventoryFull(iinventory, enumfacing)) { return false; } else { for (int i = 0; i < this.getSizeInventory(); ++i) { if (this.getStackInSlot(i) != null) { ItemStack itemstack = this.getStackInSlot(i).copy(); ItemStack itemstack1 = putStackInInventoryAllSlots(iinventory, this.decrStackSize(i, 1), enumfacing); if (itemstack1 == null || itemstack1.stackSize == 0) { iinventory.markDirty(); return true; } this.setInventorySlotContents(i, itemstack); } } return false; } } }
/** * Returns the IInventory that this hopper is pointing into */ private IInventory getInventoryForHopperTransfer() { EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()); /** * Returns the IInventory (if applicable) of the TileEntity at the specified position */ return getInventoryAtPosition(this.getWorld(), this.getXPos() + (double)enumfacing.getFrontOffsetX(), this.getYPos() + (double)enumfacing.getFrontOffsetY(), this.getZPos() + (double)enumfacing.getFrontOffsetZ()); }
public boolean func_145887_i() { if (this.worldObj != null && !this.worldObj.isRemote) { if (!this.func_145888_j() && BlockHopper.func_149917_c(this.getBlockMetadata())) { boolean flag = false; if (!this.func_152104_k()) { flag = this.func_145883_k(); } if (!this.func_152105_l()) { flag = func_145891_a(this) || flag; } if (flag) { this.func_145896_c(8); this.markDirty(); return true; } } return false; } else { return false; } }
private boolean func_145883_k() { TileEntityBlockChristmasPresents_Red iinventory = (TileEntityBlockChristmasPresents_Red) this.func_145895_l(); if (iinventory == null) { return false; } else { int i = Facing.oppositeSide[BlockHopper.getDirectionFromMetadata(this.getBlockMetadata())]; if (this.func_152102_a((IInventory) iinventory, i)) { return false; } else { for (int j = 0; j < this.getSizeInventory(); ++j) { if (this.getStackInSlot(j) != null) { ItemStack itemstack = this.getStackInSlot(j).copy(); ItemStack itemstack1 = func_145889_a(iinventory, this.decrStackSize(j, 1), i); if (itemstack1 == null || itemstack1.stackSize == 0) { iinventory.markDirty(); return true; } this.setInventorySlotContents(j, itemstack); } } return false; } } }
/** * * @param cart * @return true if there was a valid hopper (not necessarily if extracted an item) */ private boolean extractFuelFromHopper(EntityMinecart cart, BlockPos pos){ boolean foundHopper = false; for(EnumFacing dir : EnumFacing.VALUES) { BlockPos neighbor = pos; for(int offsetTimes = 0; offsetTimes < (dir == EnumFacing.UP ? 2 : 1); offsetTimes++) { neighbor = neighbor.offset(dir); TileEntity te = cart.world.getTileEntity(neighbor); if(te instanceof TileEntityHopper) { EnumFacing hopperDir = cart.world.getBlockState(neighbor).getValue(BlockHopper.FACING); if(hopperDir.getOpposite() == dir) { TileEntityHopper hopper = (TileEntityHopper)te; for(int i = 0; i < hopper.getSizeInventory(); i++) { ItemStack stack = hopper.getStackInSlot(i); if(!stack.isEmpty() && getFuelInv().isItemValidForSlot(0, stack)) { ItemStack inserted = stack.copy(); inserted.setCount(1); ItemStack left = ItemHandlerHelper.insertItemStacked(getEngineItemHandler(), inserted, false); if(left.isEmpty()) { stack.shrink(1); hopper.markDirty(); return true; } } } foundHopper = true; } } } } return foundHopper; }
/** * Returns true if the block at the given coordinate has a solid (buildable) top surface. */ public static boolean doesBlockHaveSolidTopSurface(IBlockAccess p_147466_0_, int p_147466_1_, int p_147466_2_, int p_147466_3_) { Block var4 = p_147466_0_.getBlock(p_147466_1_, p_147466_2_, p_147466_3_); int var5 = p_147466_0_.getBlockMetadata(p_147466_1_, p_147466_2_, p_147466_3_); return var4.getMaterial().isOpaque() && var4.renderAsNormalBlock() ? true : (var4 instanceof BlockStairs ? (var5 & 4) == 4 : (var4 instanceof BlockSlab ? (var5 & 8) == 8 : (var4 instanceof BlockHopper ? true : (var4 instanceof BlockSnow ? (var5 & 7) == 7 : false)))); }
private boolean func_145883_k() { IInventory var1 = this.func_145895_l(); if (var1 == null) { return false; } else { for (int var2 = 0; var2 < this.getSizeInventory(); ++var2) { if (this.getStackInSlot(var2) != null) { ItemStack var3 = this.getStackInSlot(var2).copy(); ItemStack var4 = func_145889_a(var1, this.decrStackSize(var2, 1), Facing.oppositeSide[BlockHopper.func_149918_b(this.getBlockMetadata())]); if (var4 == null || var4.stackSize == 0) { var1.onInventoryChanged(); return true; } this.setInventorySlotContents(var2, var3); } } return false; } }
public boolean func_145887_i() { if (this.worldObj != null && !this.worldObj.isRemote) { if (!this.func_145888_j() && BlockHopper.func_149917_c(this.getBlockMetadata())) { boolean flag = false; if (!this.func_152104_k()) { flag = this.func_145883_k(); } if (!this.func_152105_l()) { flag = func_145891_a(this) || flag; } if (flag) { this.func_145896_c(this.worldObj.getSpigotConfig().hopperTransfer); // Spigot // Cauldron this.markDirty(); return true; } } // Spigot start if (!this.func_145888_j()) { this.func_145896_c(this.worldObj.getSpigotConfig().hopperCheck); // Cauldron } // Spigot end return false; } else { return false; } }
private boolean func_145883_k() { IInventory iinventory = this.func_145895_l(); if (iinventory == null) { return false; } else { int i = Facing.oppositeSide[BlockHopper.getDirectionFromMetadata(this.getBlockMetadata())]; if (this.func_152102_a(iinventory, i)) { return false; } else { for (int j = 0; j < this.getSizeInventory(); ++j) { if (this.getStackInSlot(j) != null) { ItemStack itemstack = this.getStackInSlot(j).copy(); ItemStack itemstack1 = func_145889_a(iinventory, this.decrStackSize(j, 1), i); if (itemstack1 == null || itemstack1.stackSize == 0) { iinventory.markDirty(); return true; } this.setInventorySlotContents(j, itemstack); } } return false; } } }
public boolean func_78612_b(Block p_78612_1_, int p_78612_2_, int p_78612_3_, int p_78612_4_) { int var5 = p_78612_1_.func_71857_b(); if(var5 == -1) { return false; } else { p_78612_1_.func_71902_a(this.field_78669_a, p_78612_2_, p_78612_3_, p_78612_4_); this.func_83018_a(p_78612_1_); return var5 == 0?this.func_78570_q(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 4?this.func_78621_p(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 31?this.func_78581_r(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 1?this.func_78620_l(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 2?this.func_78572_c(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 20?this.func_78598_k(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 11?this.func_78582_a((BlockFence)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 39?this.func_96445_r(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 5?this.func_78589_i(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 13?this.func_78584_s(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 9?this.func_78586_a((BlockRailBase)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 19?this.func_78603_m(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 23?this.func_78566_o(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 6?this.func_78614_n(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 3?this.func_78590_h((BlockFire)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 8?this.func_78576_j(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 7?this.func_78601_u(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 10?this.func_78565_t((BlockStairs)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 27?this.func_78618_a((BlockDragonEgg)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 32?this.func_82779_a((BlockWall)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 12?this.func_78594_e(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 29?this.func_78577_f(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 30?this.func_78619_g(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 14?this.func_78574_w(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 15?this.func_78610_x((BlockRedstoneRepeater)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 36?this.func_94176_a((BlockRedstoneLogic)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 37?this.func_94171_a((BlockComparator)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 16?this.func_78593_b(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_, false):(var5 == 17?this.func_78608_c(p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_, true):(var5 == 18?this.func_78592_a((BlockPane)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 21?this.func_78580_a((BlockFenceGate)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 24?this.func_78615_a((BlockCauldron)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 33?this.func_82780_a((BlockFlowerPot)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 35?this.func_82775_a((BlockAnvil)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 25?this.func_78585_a((BlockBrewingStand)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 26?this.func_78567_v((BlockEndPortalFrame)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 28?this.func_78616_a((BlockCocoa)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 34?this.func_82778_a((BlockBeacon)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):(var5 == 38?this.func_94172_a((BlockHopper)p_78612_1_, p_78612_2_, p_78612_3_, p_78612_4_):false)))))))))))))))))))))))))))))))))))))); } }
/** * Performs check to see if the block is a normal, solid block, or if the metadata of the block indicates that its * facing puts its solid side upwards. (inverted stairs, for example) */ @Deprecated //DO NOT USE THIS!!! USE doesBlockHaveSolidTopSurface public boolean isBlockTopFacingSurfaceSolid(Block par1Block, int par2) { // -.- Mojang PLEASE make this location sensitive, you have no reason not to. return par1Block == null ? false : (par1Block.blockMaterial.isOpaque() && par1Block.renderAsNormalBlock() ? true : (par1Block instanceof BlockStairs ? (par2 & 4) == 4 : (par1Block instanceof BlockHalfSlab ? (par2 & 8) == 8 : (par1Block instanceof BlockHopper ? true : (par1Block instanceof BlockSnow ? (par2 & 7) == 7 : false))))); }
/** * Inserts one item from the hopper into the inventory the hopper is pointing at. */ private boolean insertItemToInventory() { IInventory iinventory = this.getOutputInventory(); if (iinventory == null) { return false; } else { for (int i = 0; i < this.getSizeInventory(); ++i) { if (this.getStackInSlot(i) != null) { ItemStack itemstack = this.getStackInSlot(i).copy(); ItemStack itemstack1 = insertStack(iinventory, this.decrStackSize(i, 1), Facing.oppositeSide[BlockHopper.getDirectionFromMetadata(this.getBlockMetadata())]); if (itemstack1 == null || itemstack1.stackSize == 0) { iinventory.onInventoryChanged(); return true; } this.setInventorySlotContents(i, itemstack); } } return false; } }
/** * Checks if a block has a solid bottom surface. * * @param pos The location * @return true if the bottom side of the block is solid. */ protected static boolean doesBlockHaveSolidBottomSurface(World w, BlockPos pos) { IBlockState state = w.getBlockState(pos); Block block = state.getBlock(); if (block.getMaterial().isOpaque() && block.isFullCube()) { return true; } return block instanceof BlockStairs ? state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.BOTTOM : (block instanceof BlockSlab ? state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM : (block instanceof BlockHopper ? true : false)); }
public static void generate(IWorldEditor editor, Cardinal dir, Coord pos){ MetaBlock hopper = new MetaBlock(Blocks.HOPPER); if(Arrays.asList(Cardinal.directions).contains(dir)){ hopper.withProperty(BlockHopper.FACING, Cardinal.facing(Cardinal.reverse(dir))); } hopper.set(editor, pos); }
public static boolean doesBlockHaveSolidTopSurface(IBlockAccess blockAccess, BlockPos pos) { IBlockState iblockstate = blockAccess.getBlockState(pos); Block block = iblockstate.getBlock(); return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); }