Jump to content

Dispenser Tweek


Jorcer

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites


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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...