Posted February 21, 201411 yr I was wondering how to make a block/tileentity behave like a hopper in the sense that it can test for entities directly above it and then modify said entities. I looked through the TileEntityHopper class but didn't find anything understandable, most of the stuff in there is completely unlabeled.
February 21, 201411 yr Author hmmm… could this be relevant? I'll look to where this is called... public static EntityItem func_145897_a(World p_145897_0_, double p_145897_1_, double p_145897_3_, double p_145897_5_) { List list = p_145897_0_.selectEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getAABBPool().getAABB(p_145897_1_, p_145897_3_, p_145897_5_, p_145897_1_ + 1.0D, p_145897_3_ + 1.0D, p_145897_5_ + 1.0D), IEntitySelector.selectAnything); return list.size() > 0 ? (EntityItem)list.get(0) : null; }
February 21, 201411 yr Author here's some insight: func_145891_a is called. Somewhere in there, func_145897 is called. If there is an EntityItem returned, func_145898 is called, which adds the item to the hopper's inventory and destroys the item. Can someone explain to me what the rest of func_145891 is for, and when it would be called? Here's the source of func_145891: public static boolean func_145891_a(IHopper p_145891_0_) { IInventory iinventory = func_145884_b(p_145891_0_); if (iinventory != null) { byte b0 = 0; if (iinventory instanceof ISidedInventory && b0 > -1) { ISidedInventory isidedinventory = (ISidedInventory)iinventory; int[] aint = isidedinventory.getAccessibleSlotsFromSide(b0); for (int k = 0; k < aint.length; ++k) { if (func_145892_a(p_145891_0_, iinventory, aint[k], b0)) { return true; } } } else { int i = iinventory.getSizeInventory(); for (int j = 0; j < i; ++j) { if (func_145892_a(p_145891_0_, iinventory, j, b0)) { return true; } } } } else { EntityItem entityitem = func_145897_a(p_145891_0_.getWorldObj(), p_145891_0_.getXPos(), p_145891_0_.getYPos() + 1.0D, p_145891_0_.getZPos()); if (entityitem != null) { return func_145898_a(p_145891_0_, entityitem); } } return false; } nvm, the rest is for if there's a chest or other thing with an inventory above it. also, I just discovered how to modify posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.