Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[resolved] Can you change base code without editing base classes?


  • Please log in to reply
6 replies to this topic

#1

SymonFox
  • Location: I've gone to find myself. If I return before I'm back keep me here

Posted 21 December 2011 - 11:56 AM

I've been unable to find out anything about how to replace existing minecraft items and block or what-have-you without editing existing class files.

For example say i didn't like glow stone because there's no real life equivalent. So i want to 'replace' it with something in RL like phosphorous. So really i just need to change the name and the texture for glowstone. All other properties should stay the same.

What's a good modloader way to do this? Can it be done without editing existing classes? i notice java has an alias method... i believe that might be used for this somehow?

Thanks in advance: S, Fox.
If I've done something to help you recently plz thank me by pressing the green + on the right :)
Posted Image

Register or log in to remove.

#2

Miki0110
  • Location: In ya butt hole ;]
  • Minecraft: miki0110

Posted 21 December 2011 - 06:53 PM

give them the same item id that should work ;)
EDIT: not gonna work with blocks but works fine with items.
Posted Image

#3

evoandroidevo
  • Location: Where Everything Is Possible
  • Minecraft: evoandroidevo

Posted 21 December 2011 - 09:45 PM

View PostMiki0110, on 21 December 2011 - 06:53 PM, said:

give them the same item id that should work ;)
i dont think that will work but couldnt hurt to try

Posted Image

Feel Free To Gain My Space http://db.tt/4PhfLiNS


#4

jamolnng
    jamolnng

    Lapis Lazuli Collector

  • Members
  • 1095 posts
  • Location: Kidnapping Steelfeathers
  • Minecraft: jamolnng
  • Xbox:jamolnng

Posted 22 December 2011 - 04:01 AM

View PostSymonFox, on 21 December 2011 - 11:56 AM, said:

I've been unable to find out anything about how to replace existing minecraft items and block or what-have-you without editing existing class files.

For example say i didn't like glow stone because there's no real life equivalent. So i want to 'replace' it with something in RL like phosphorous. So really i just need to change the name and the texture for glowstone. All other properties should stay the same.

What's a good modloader way to do this? Can it be done without editing existing classes? i notice java has an alias method... i believe that might be used for this somehow?

Thanks in advance: S, Fox.

A way to do this would be, you know the setBlockName or setItemName at the end of each public static int? Well just make a block with all of the same features as glowstone with the same block id and texture and everything and then do the ModLoader.AddName stuff and it should override the name if the setBlockName(name) is the same (Should... key word, im not quite sure)

The best way to contact me is via PM

#5

SymonFox
  • Location: I've gone to find myself. If I return before I'm back keep me here

Posted 22 December 2011 - 06:08 AM

I tried something similar before making this thread. Made a simple recipe mod where 4 string should give 1 dirt block instead of 1 wool block. However when playing the game it gives a wool block still not a dirt block. Here's my source code:

Spoiler:

The mod originally just converted wool into 4 string, I left that in just so i could test the mod without testing the replaced recipe to make sure it compiled.

I'll try a block overwrite like you guys said but I don't *think* that will work... even if it does that leaves recipe overwrites to figure out.
If I've done something to help you recently plz thank me by pressing the green + on the right :)
Posted Image

#6

jamolnng
    jamolnng

    Lapis Lazuli Collector

  • Members
  • 1095 posts
  • Location: Kidnapping Steelfeathers
  • Minecraft: jamolnng
  • Xbox:jamolnng

Posted 22 December 2011 - 06:57 AM

View PostSymonFox, on 22 December 2011 - 06:08 AM, said:

I tried something similar before making this thread. Made a simple recipe mod where 4 string should give 1 dirt block instead of 1 wool block. However when playing the game it gives a wool block still not a dirt block. Here's my source code:

Spoiler:

The mod originally just converted wool into 4 string, I left that in just so i could test the mod without testing the replaced recipe to make sure it compiled.

I'll try a block overwrite like you guys said but I don't *think* that will work... even if it does that leaves recipe overwrites to figure out.

I think you would have to end up editing base classes unless you wanted to write a lot of code to override classes ans use yours in replacement

The best way to contact me is via PM

#7

SymonFox
  • Location: I've gone to find myself. If I return before I'm back keep me here

Posted 22 December 2011 - 07:24 AM

View Postjamolnng, on 22 December 2011 - 06:57 AM, said:

I think you would have to end up editing base classes unless you wanted to write a lot of code to override classes ans use yours in replacement

Yeah, after some more playing around I think your right. Seems like class alias isn't a part of minecrafts java... it keeps telling me to define alias. :)  And that would explain all the base class edits you see people doing...
If I've done something to help you recently plz thank me by pressing the green + on the right :)
Posted Image