Jorcer Posted July 14, 2012 Posted July 14, 2012 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?
gotyaoi Posted July 15, 2012 Posted July 15, 2012 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.
Jorcer Posted July 15, 2012 Author Posted July 15, 2012 It would need to be compatible with the current dev build of the Technic pack so I assume that it would conflict with forge.
gotyaoi Posted July 15, 2012 Posted July 15, 2012 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.
Jorcer Posted July 15, 2012 Author Posted July 15, 2012 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?
gotyaoi Posted July 15, 2012 Posted July 15, 2012 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.
Jorcer Posted July 15, 2012 Author Posted July 15, 2012 Great thanks for the help I think I can get this working
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now