Jump to content

Recommended Posts

Posted

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.

Posted

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...

Posted

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.

Posted

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.

xD.

There will be Deployer Hoppers xD 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.