Modding Questions Thread

This forum is for anything that doesn't specifically have to do with Better Than Wolves
Post Reply
User avatar
RaustBlackDragon
Posts: 1748
Joined: Fri Oct 14, 2011 6:25 pm

Modding Questions Thread

Post by RaustBlackDragon »

So, I noticed I have a tendency to make threads asking for modding help. I've decided that, instead, I'm just going to start a thread where people (including myself) can ask questions or ask for advice about modding minecraft.

I guess I'll start off: Does anybody know what the variable is that controls the walking animation? If I wanted to make an animal appear to walk in place, what variable would I need to have change for this to happen?
What's the price of freedom now?
Can you cut me a deal?
A crate of wholesale liberty,
or a justice combo meal?
User avatar
darahalian
Posts: 578
Joined: Mon Jul 04, 2011 9:57 pm

Re: Modding Questions Thread

Post by darahalian »

I know this is a pretty old thread, but I have a modding question. After seeing what Graphite said about maps in the news thread:
Graphite wrote:You could have a blank map item that can be aligned to an already existing map. Put the existing map in the middle of the crafting grid, then place the blank map on whichever side it's supposed to line up.
I got inspired to try and mod this myself (although slightly differently: no blank map items, just existing maps). The only problem I have is this: I need to access the crafting grid and the items in it from the onCreated function in ItemMap.java so that the center of the new map can be based on the coordinates of the old one, but I don't know how to access this information. Can I find objects like the crafting table being used in the World or EntityPlayer objects passed to this function already, or if not, what would I need to pass into the function to accomplish this?

(Thankfully, I was able to figure out leaving the old map in the crafting grid using FC's moulds as an example)

EDIT: Okay, I may have actually figured this out. I am instead moving most of the needed code to ShapedRecipes.java where there is still access to the crafting inventory. I may actually be bypassing the onCreated method completely in this case.

EDIT2: But now I won't have access to the World object, so I can't load the existing mapdata that I need... uhhg... Why can't I get all the stuff I need in one place? Anyway, time for bed. I may be able to think more clearly about this in the morning.
FlowerChild wrote:Remain ever vigilant against the groth menace my friends. Early detection is crucial in avoiding a full-blown groth epidemic.
Rianaru
Posts: 760
Joined: Wed Jul 11, 2012 1:01 pm

Re: Modding Questions Thread

Post by Rianaru »

I happened across a map mod while browsing MCF a loooong time ago. No idea if it's still there or if it's updated still, but you could try and look in the internals of that to make your own solution. Of course, that depends on if the license and so forth allows it. I am by no means an expert on licensing or programming(I only know how to work with game programming in GML -.-), but I think that mod included the specific feature you're talking about. Never used it myself, mind you, but the thread had some positive reviews, so it probably worked at the time.
FlowerChild wrote: -----

A short while later:

FlowerChild: What is this pussy shit?
User avatar
darahalian
Posts: 578
Joined: Mon Jul 04, 2011 9:57 pm

Re: Modding Questions Thread

Post by darahalian »

Well, I was able to finally get access to the crafting inventory from the onCreated method in ItemMap (I think, but I don't have an IDE or a debugger or anything at the moment (I'm just using a text editor) so I can't tell for sure) by modifying core base classes like Item and ItemStack and SlotCrafting, but now the mapdata I'm trying to assign doesn't seem to get saved to the map. Since every map I craft has it's center at spawn, which only happens when the mapdata is null. I personally can't see what's wrong with the code, and I don't know enough about Java to understand everything going on. Does anyone know a good IDE or something I could use to help me figure out what's going wrong? I know FC has talked about putting breakpoints in the code, and I think being able to do that would be a big help to me right now, so I can figure out whether things are actually getting called.
FlowerChild wrote:Remain ever vigilant against the groth menace my friends. Early detection is crucial in avoiding a full-blown groth epidemic.
User avatar
Ethazeriel
Posts: 197
Joined: Tue Jul 05, 2011 12:51 am

Re: Modding Questions Thread

Post by Ethazeriel »

If you're using MCP, take a look at eclipse. If I recall correctly, there's a readme file that comes with the MCP download that has instructions for setting it up correctly to work with MC.
User avatar
darahalian
Posts: 578
Joined: Mon Jul 04, 2011 9:57 pm

Re: Modding Questions Thread

Post by darahalian »

Briali wrote:If you're using MCP, take a look at eclipse. If I recall correctly, there's a readme file that comes with the MCP download that has instructions for setting it up correctly to work with MC.
Yeah, I'm using MCP. I'll take a look at that.

EDIT: Well, Eclipse is working nicely, and at least now I know the game is actually getting to my code... and then giving me null pointer exceptions... Though I have to say it's nice to have errors and warnings showing up while I'm still editing, it makes it a lot easier to track down those little problems that mess everything up, but which don't cause compile errors.

EDIT2: YAY! I got it to work! Thanks to breakpoints and debugging letting me see the variables at different points, I was able to see that everything I needed was there, narrowing down the causes of the crash, and I was also able to learn a bit more about the internals of the code. It turns out the method I was using to reference the different slots in the crafting grid was off, and so the information I was trying to pull from the items was being pulled from an empty slot, I guess causing the null pointer exception. Once I figured out the actual slot index numbers, and put them in directly instead of calculating them from row and column, everything worked fine! The only problem remaining is a minor one. Since recipes flipped horizontally are the same, I will have to rethink the recipes a little since the recipe for attaching a map to the left of the base one is replaced with the flipped recipe for attaching a map to the right.

Anyway, I'm just glad I could get this working.
FlowerChild wrote:Remain ever vigilant against the groth menace my friends. Early detection is crucial in avoiding a full-blown groth epidemic.
User avatar
darahalian
Posts: 578
Joined: Mon Jul 04, 2011 9:57 pm

Re: Modding Questions Thread

Post by darahalian »

I now have a fully working version of this mod (I'm calling it BetterMaps), compiled and put in a zip. (actually, two different versions, one that is simply modloader compatible/dependent and one that is BTW compatible, both still only for 1.2.5, at least for now) I was even able to get past the recipe problem noted above with some internal code to distinguish things.

I do have one final question, though it isn't technically a modding question. As this mod modifies some of the same base classes as BTW, to get it compatible I had to add my modifications on top of FC's in those classes. What I'm wondering is whether copyright stuff prevents me from distributing these merged base classes with my mod. If so, I can just keep my BTW compatible version to myself, but I would like to be able to distribute it to you guys as well.
I'm assuming that there is no problem with doing this, as I'm not distributing BTW classes, but I still wanted to get an okay beforehand, just to be safe.
FlowerChild wrote:Remain ever vigilant against the groth menace my friends. Early detection is crucial in avoiding a full-blown groth epidemic.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: Modding Questions Thread

Post by FlowerChild »

You'd still be distributing BTW code man. Copyright doesn't begin and end with file boundaries.
User avatar
darahalian
Posts: 578
Joined: Mon Jul 04, 2011 9:57 pm

Re: Modding Questions Thread

Post by darahalian »

Okay, fair enough. I guess I'll just have to keep the BTW compatible version to myself.
FlowerChild wrote:Remain ever vigilant against the groth menace my friends. Early detection is crucial in avoiding a full-blown groth epidemic.
Post Reply