The Meaning of Life, the Universe, and Everything.
Join Date:
1/23/2013
Posts:
55
Minecraft:
NaaameMC
Member Details
Hi, I just had a quick question about editing Vanilla tool values. I already understand that editing the base classes is a bad idea, but I'm having trouble finding out any safe workarounds to this method. I'd really appreciate if someone could help me. Thanks in advance.
Changing Minecraft's code through a core mod is a last-resort kind of thing, and Forge provides a variety of ways to avoid doing so. For example, you can add ToolMaterials using the EnumHelper, and you can handle events for many many things.
Core mods (the group of mods that do this byte-code manipulation to Minecraft code) are discouraged because they may cause incompatibility.
What exactly are you trying to do?
Rollback Post to RevisionRollBack
Click this banner for a list of illegal mod distributors -- only download from legal sites!
The Meaning of Life, the Universe, and Everything.
Join Date:
1/23/2013
Posts:
55
Minecraft:
NaaameMC
Member Details
I've already added ToolMaterials for seperate tools, but what I'm trying to do is edit the Vanilla values of tools to be more in line with the value chart I made beforehand, such as the Durability and Enchantability. (i.e. using a Wood Stick with Diamond makes the tool less valuable than using a Diamond Stick with Diamonds for a pickaxe, as a reference to how my mod will work.) Is there any way to apply my custom ToolMaterials to Vanilla tools or would I have to use a different method altogether?
Maybe you could make the vanilla Tools useless but provide almost equal Tools from your mod, like TConstruct does. Then the players would have to create your tools and there would be no need for editing the base classes.
Maybe you could make the vanilla Tools useless but provide almost equal Tools from your mod, like TConstruct does. Then the players would have to create your tools and there would be no need for editing the base classes.
One way to make vanilla tools useless is to subscribe to the PlayerTickEvent, search their inventory for any of the tools you don't want them to use, and damage them until they have 1 durability left.
This is more reliable than damaging them when they are crafted (that event doesn't fire if the user shift-clicks the crafting result).
Speaking of crafting, you can also remove the recipes for vanilla tools like I do here. Just be warned that doing so can mess with other mods big-time -- for one, I can think of several mods that use diamond tools in the recipes.
Rollback Post to RevisionRollBack
Click this banner for a list of illegal mod distributors -- only download from legal sites!
Item#setHarvestLevel() and Item#setMaxDamage() will allow you to change the harvest level and durability of tools. You may or may not be able to change other values depending on what they are, can you provide a list of all the values you are interested in changing.?
Rollback Post to RevisionRollBack
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
Item#setHarvestLevel() and Item#setMaxDamage() will allow you to change the harvest level and durability of tools. You may or may not be able to change other values depending on what they are, can you provide a list of all the values you are interested in changing.?
So far this is exactly what I need. Thought not quite as a necessity, is it possibly to adjust variables such as Enchatability or Efficiency?
Not in the same way. How competent are you in Java?
Competent enough, but there are some things I don't quite understand yet.
Sorry for changing the topic but instead of going through the trouble of changing base values do you mind helping me with a way to add custom Harvest levels for blocks beyond the base ones in vanilla (i.e. levels 4 and 5)? I've decided that going through this process would be far more effective than risking compatibility by messing with base classes.
Hi, I just had a quick question about editing Vanilla tool values. I already understand that editing the base classes is a bad idea, but I'm having trouble finding out any safe workarounds to this method. I'd really appreciate if someone could help me. Thanks in advance.
Changing Minecraft's code through a core mod is a last-resort kind of thing, and Forge provides a variety of ways to avoid doing so. For example, you can add ToolMaterials using the EnumHelper, and you can handle events for many many things.
Core mods (the group of mods that do this byte-code manipulation to Minecraft code) are discouraged because they may cause incompatibility.
What exactly are you trying to do?
I've already added ToolMaterials for seperate tools, but what I'm trying to do is edit the Vanilla values of tools to be more in line with the value chart I made beforehand, such as the Durability and Enchantability. (i.e. using a Wood Stick with Diamond makes the tool less valuable than using a Diamond Stick with Diamonds for a pickaxe, as a reference to how my mod will work.) Is there any way to apply my custom ToolMaterials to Vanilla tools or would I have to use a different method altogether?
Maybe you could make the vanilla Tools useless but provide almost equal Tools from your mod, like TConstruct does. Then the players would have to create your tools and there would be no need for editing the base classes.
One way to make vanilla tools useless is to subscribe to the PlayerTickEvent, search their inventory for any of the tools you don't want them to use, and damage them until they have 1 durability left.
This is more reliable than damaging them when they are crafted (that event doesn't fire if the user shift-clicks the crafting result).
Speaking of crafting, you can also remove the recipes for vanilla tools like I do here. Just be warned that doing so can mess with other mods big-time -- for one, I can think of several mods that use diamond tools in the recipes.
I think that's the reason for TConstruct doing it that way and not just removing the crafting recipes.
Item#setHarvestLevel() and Item#setMaxDamage() will allow you to change the harvest level and durability of tools. You may or may not be able to change other values depending on what they are, can you provide a list of all the values you are interested in changing.?
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
So far this is exactly what I need. Thought not quite as a necessity, is it possibly to adjust variables such as Enchatability or Efficiency?
Not in the same way. How competent are you in Java?
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
Competent enough, but there are some things I don't quite understand yet.
Sorry for changing the topic but instead of going through the trouble of changing base values do you mind helping me with a way to add custom Harvest levels for blocks beyond the base ones in vanilla (i.e. levels 4 and 5)? I've decided that going through this process would be far more effective than risking compatibility by messing with base classes.
That's very easy: Just add Blocks that require this HarvestLevel from a Tool and add Tools with higher HarvestLevels than 3.
But: changing the HarvestLevel of vanilla Blocks is almost impossible without editing the base classes.