Posted November 12, 201311 yr What code should I take a look at to see how vanilla furnaces works with the hopper like if the hopper is underneath the custom furnace it will only take out the output, if above it will only put into the input and so on. And also if you could tell me if there is a way to first check if there is a chest next to the furnace and then send the output to the chest.
November 13, 201311 yr For the furnace, and im not totally sure because i started modding a week age, but i think it's in net.minecraft.block.BlockFurnace.
November 13, 201311 yr Author Pretty sure that's not where you check for any of it but thanks either way.
November 14, 201311 yr Open the TileEntity for both of the blocks. The TileEntity is where all the logic is done. I'd check out the Hooper's one as that's the place where it goes down If you guys dont get it.. then well ya.. try harder...
November 14, 201311 yr As the Hopper's TileEntity class is rather large, I'll point you even more in the right direction. The reason why insertion and extraction of Furnaces is side dependant is because the Furnace's TileEntity is implementing ISidedInventory and the Hopper respects this. In TileEntityFurnace.java there is a method that specifies which slots refer to which side: /** * Returns an array containing the indices of the slots that can be accessed by automation on the given side of this * block. */ public int[] getAccessibleSlotsFromSide(int par1) { return par1 == 0 ? slots_bottom : (par1 == 1 ? slots_top : slots_sides); } par1 is the side, so if the side == 0, the bottom slot(s) are returned, when side == 1 the top slots are returned and for the sides the side slots are returned. As I said, the Hopper respects this and does that in the following way (TileEntityHopper.java, line 278 in the suckItemsIntoHopper method) : byte b0 = 0;//b0 is the side, which is always the bottom (where it extracts from). if(iinventory instanceof ISidedInventory && b0 > -1) { ISidedInventory isidedinventory = (ISidedInventory)iinventory; int[] aint = isidedinventory.getAccessibleSlotsFromSide(b0); for(int element : aint) { if(insertStackFromInventory(par0Hopper, iinventory, element, b0)) { return true; } } } (...) Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.
November 14, 201311 yr Ahh the Vanilla Hopper code. I made a lot of new Hoppers with alot of functions i mean i made really a lot and there are about 200-300 differend hoppers in my mod. And for the extracting code i can tell you do not copy it from Vannilla Minecraft. it is useless. For that you have to copy the whole Hopper Class. I had to write my own Hopper Extracting code. Thats only a hint. . There will be Deployer Hoppers and there are still a lot planed. Speiger
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.