Jump to content

Recommended Posts

Posted

Not a mod so much as a tweek to the way in which dispensers operate. In vanilla Minecraft, they dispense items randomly from each slot, this makes it difficult to use when creating adventure maps or traps with two parts. I'm not even sure if it can be done, but I figured asking wouldn't hurt. So is it possible and if so, could someone either help me or point me in the right direction?

Posted

It's possible, take a peek at the dispenseItem method in BlockDispenser.

However, to change dispenser behavior would involve a base class edit. Not too bad, ordinarily, for something like BlockDispenser, but forge does stick something in there, so if you wanted to be compatible with forge mods, a little bit trickier.

Posted

No, it's ok. You just have to make a choice whether to be compatible with forge or not. Here's the basic breakdown.

Since the forge code in there does nothing at the moment, you could leave it out(just edit the vanilla class) and be compatible with both. However, if/when a future forge build adds an actual call there, you have to choose whether to edit the vanilla class, or edit the class after forge made it's changes. Edit the vanilla class, be compatible with vanilla only, edit the forge-edited class, be compatible with forge only.

Posted

So if I wanted it to be compatible for both I would edit the vanilla class now, and when it is updated, I would edit the forge class, correct?

Posted


if (FMLClientHandler.instance().tryDispensingEntity(par1World, var13, var15, var17, var9, var10, var12)) {

        ;

}

That's the code forge is adding right now. As you can see, it does...

Actually, now that I'm looking into it harder, that tryDispensingEntity call does actually do something. Stupid tests that take actions.

I'm afraid I must retract the first part of my previous statement. The forge call already does something, so make the choice to be forge compatible or vanilla compatible.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...