I decompiled minecraft a while ago and modified a bunch of vanilla block properties among other things. For these changes, I have no problem adding them to my .jar file and running the same. Works great.
One small problem though, I have heard through the grapevine that there are better ways to create mods than just dumping class files into the .jar. However, when I look at tutorials, the only thing anyone discusses is how to create custom items and blocks. I need to override vanilla items with these modified classes. I personally don't have qualms adding .class files to my jar but if there's a way that's easier, i'd like to do it. I'm just not sure how. I think I have an older version of MCP - it's not an API or anything fancy and I'm not working with .json files at this time.
The way you are currently doing this is extremely outdated, and generally looked down upon by the community. At least, if you're sharing them with the community. There are several APIs out there such as MinecrafForge, LiteLoader, BlazeLoader, and even meedle which allow you to create mods which are not part of the main minecraft.jar.
I don't know if I'm being clear enough: I'm aware there is a better way to do it (the API), but the community only speaks at length about creating *new* items and blocks. I do not want to do this.
For example, check out these tutorials from MrCrayFish:
Starts out easy enough on episodes 1 and 2, setting up the environment and setting what appears to be some sort of handler to separate the mod from the rest of minecraft, okay whatever I can copy that. But right after that, he starts just creating brand new items and blocks. I'm not interested in that. There are specific values in vanilla blocks and in the World Renderer that I have changed to produce a given effect. I have not created anything new. That is what I'm missing information on. I already have .java files for the blocks that I have changed and could probably export that. Is there an easy way to copy/paste these java files into a package for installation?
Fair enough, I will try to be as specific as possible. I've been doing reading since posting this and yes, I believe there is probably a way to do this with either the Forge or a Coremod. I'll admit up front that I understand programming logic but I'm not a java guru. I am actively learning more about how Forge puts together simple mods, however and it's looking clearer as I go. I have essentially two things going on.
So take a look at this piece of code right here:
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.SOLID;
}
Almost every block calls this method. This method controls how Minecraft renders the texture of a block. What I've done is chosen a set of vanilla blocks to go from SOLID to TRANSLUCENT. I've done this with doors, lilypads, ores, you name it. What I now have is a collection of class files that I add to the jar and it basically adds support to do transparencies on anything. For reasons, of course.
I'm not sure how to attack this problem going from modding the class files to the API. I imagine it would be more efficient to change EnumWorldBlockLayer to ignore whatever the blocks return and simply set TRANSPARENT for each block, but the strings do not make sense to me, so I don't know what they're doing.
private final String field_180338_e;
private static final String __OBFID = "CL_00002152";
public String toString()
{
return this.field_180338_e;
}
MCPatcher has support for renderpasses, but it is broken. In texting it does not understand the full range of transparencies the way the game does. Too thin and it's clear, too thick and it's opaque again. It also doesn't understand when I try to define transparencies for rail and rail corners because corners do not have their own blockID. This was my solution to that problem.
I was reading This: http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html today on how rendering is handled with something called IBakedModel, but I did not see that in the class files and what I have is working so I'm attacking it from that angle. I could be wrong. I have another class, calcSunriseSunsetColors, under WorldProvider that I've also edited to get some cool custom sunset colors. I feel like if I can understand how to override input coming from this, I should be able to do the same thing for this class as well. BTW, thank you so much for putting eyes on this. I've just finished my texture pack and making the mod portion of it easy to distribute (I hope) will let users enjoy it that much more.
As is usual, I've found something that looks like it'll probably work. I got wise and googled some javaesque statements close to what I would expect to see and found someones BUKKIT repository.
import net.minecraft.util.EnumWorldBlockLayer;
@Override
public EnumWorldBlockLayer getBlockLayer() {
//if(this == EssenceBlocks.permaFlower || this == EssenceBlocks.shiverFlower || this == EssenceBlocks.iceBush)
// return EnumWorldBlockLayer.TRANSLUCENT;
return EnumWorldBlockLayer.CUTOUT;
If you use Forge then there are lots of ways to do what you're saying (modify vanilla).
It depends on the type of changes you really want to make. If you want to change behavior then there are events that trigger when the item is used, when it is tossed, when a block is harvested, etc. You can then cancel the vanilla behavior and replace it with your own.
If you want a more drastic change you can make a "new" one that is really a copy of the vanilla but with the changes you want. Then in the crafting recipes you can replace the output to your items. I think you might also need to remove the vanilla item from the creative tab.
In general if you use Forge you can modify vanilla behavior in a number of ways. I suggest the following order of consideration:
1) There are lots of public fields and methods in vanilla classes that you can access. For example, the AI of the mobs is in a public list that you can simply clear and build again to your liking.
2) Registries and ore dictionary. These are specifically for enabling entities, recipes, etc.
3) Events. There are lots of events you can intercept and change almost anything that is commonly modded.
4) Java reflection. Java allows you to make the private fields and methods of classes publicly accessible.
5) Other methods such as ASM, byte code modification, core mods.
Just a word of warning: changing all blocks to use CUTOUT or TRANSLUCENT will very likely have a drastic impact on performance - the rendering of SOLID blocks is heavily optimized, mainly by not rendering most of the blocks; if you change them all to CUTOUT, that might force every single block in the visible world to have to render... that's a lot of blocks.
Only way to know if it will be a major issue, however, is to try it and see
That's exactly the kind of thing I'm trying to avoid. Basically, I want to create a case statement that will test for a few different kinds of blocks, and if true, will return TRANSLUCENT, otherwise, it'll do nothing and the base class should define it as normal, at least it should, right?
Unfortunately, I've only gotten a little further. I at least have a working forge environment up and running with a very very rudimentary mod skeleton in place. I'm just trying to figure out how to override things without having to do anything insane. I realize the modding community "frowns" on this kind of thing, but they also apparently frown on keeping tutorial information centralized and up to date. I've just spent the last 4 hours google-foo'ing myself into a migraine.
Upon deep inspection of what I'm doing and what is necessary, yes. It appears that a Coremod and byte-level coding would be required to modify the specific methods I'm working with. Blech. One step at a time, I guess.
Hey guys,
I decompiled minecraft a while ago and modified a bunch of vanilla block properties among other things. For these changes, I have no problem adding them to my .jar file and running the same. Works great.
One small problem though, I have heard through the grapevine that there are better ways to create mods than just dumping class files into the .jar. However, when I look at tutorials, the only thing anyone discusses is how to create custom items and blocks. I need to override vanilla items with these modified classes. I personally don't have qualms adding .class files to my jar but if there's a way that's easier, i'd like to do it. I'm just not sure how. I think I have an older version of MCP - it's not an API or anything fancy and I'm not working with .json files at this time.
The way you are currently doing this is extremely outdated, and generally looked down upon by the community. At least, if you're sharing them with the community. There are several APIs out there such as MinecrafForge, LiteLoader, BlazeLoader, and even meedle which allow you to create mods which are not part of the main minecraft.jar.
Farewell everyone o/
I don't know if I'm being clear enough: I'm aware there is a better way to do it (the API), but the community only speaks at length about creating *new* items and blocks. I do not want to do this.
For example, check out these tutorials from MrCrayFish:
Starts out easy enough on episodes 1 and 2, setting up the environment and setting what appears to be some sort of handler to separate the mod from the rest of minecraft, okay whatever I can copy that. But right after that, he starts just creating brand new items and blocks. I'm not interested in that. There are specific values in vanilla blocks and in the World Renderer that I have changed to produce a given effect. I have not created anything new. That is what I'm missing information on. I already have .java files for the blocks that I have changed and could probably export that. Is there an easy way to copy/paste these java files into a package for installation?
At the very least, is there anyone who can point out a mod which does something similar so that I can try and duplicate that process?
We can't help you that much because we don't know what you're trying to accomplish.
This is definitely possible with Forge, either using events or ASM and a core mod.
Matter Overdrive co-developer. Maker of a number of other mods. Temporal Reality lead developer. Open source connoisseur.
Fair enough, I will try to be as specific as possible. I've been doing reading since posting this and yes, I believe there is probably a way to do this with either the Forge or a Coremod. I'll admit up front that I understand programming logic but I'm not a java guru. I am actively learning more about how Forge puts together simple mods, however and it's looking clearer as I go. I have essentially two things going on.
So take a look at this piece of code right here:
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.SOLID;
}
Almost every block calls this method. This method controls how Minecraft renders the texture of a block. What I've done is chosen a set of vanilla blocks to go from SOLID to TRANSLUCENT. I've done this with doors, lilypads, ores, you name it. What I now have is a collection of class files that I add to the jar and it basically adds support to do transparencies on anything. For reasons, of course.
I'm not sure how to attack this problem going from modding the class files to the API. I imagine it would be more efficient to change EnumWorldBlockLayer to ignore whatever the blocks return and simply set TRANSPARENT for each block, but the strings do not make sense to me, so I don't know what they're doing.
private final String field_180338_e;
private static final String __OBFID = "CL_00002152";
private EnumWorldBlockLayer(String p_i45755_3_)
{
//if you're bushes, ores, or lilly pads, this.field_180388_e = TRANSLUCENT (??)
//otherwise
this.field_180338_e = p_i45755_3_;
}
public String toString()
{
return this.field_180338_e;
}
MCPatcher has support for renderpasses, but it is broken. In texting it does not understand the full range of transparencies the way the game does. Too thin and it's clear, too thick and it's opaque again. It also doesn't understand when I try to define transparencies for rail and rail corners because corners do not have their own blockID. This was my solution to that problem.
I was reading This: http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html today on how rendering is handled with something called IBakedModel, but I did not see that in the class files and what I have is working so I'm attacking it from that angle. I could be wrong. I have another class, calcSunriseSunsetColors, under WorldProvider that I've also edited to get some cool custom sunset colors. I feel like if I can understand how to override input coming from this, I should be able to do the same thing for this class as well. BTW, thank you so much for putting eyes on this. I've just finished my texture pack and making the mod portion of it easy to distribute (I hope) will let users enjoy it that much more.
As is usual, I've found something that looks like it'll probably work. I got wise and googled some javaesque statements close to what I would expect to see and found someones BUKKIT repository.
import net.minecraft.util.EnumWorldBlockLayer;
@Override
public EnumWorldBlockLayer getBlockLayer() {
//if(this == EssenceBlocks.permaFlower || this == EssenceBlocks.shiverFlower || this == EssenceBlocks.iceBush)
// return EnumWorldBlockLayer.TRANSLUCENT;
return EnumWorldBlockLayer.CUTOUT;
Should be able to tinker with this.
If you use Forge then there are lots of ways to do what you're saying (modify vanilla).
It depends on the type of changes you really want to make. If you want to change behavior then there are events that trigger when the item is used, when it is tossed, when a block is harvested, etc. You can then cancel the vanilla behavior and replace it with your own.
If you want a more drastic change you can make a "new" one that is really a copy of the vanilla but with the changes you want. Then in the crafting recipes you can replace the output to your items. I think you might also need to remove the vanilla item from the creative tab.
In general if you use Forge you can modify vanilla behavior in a number of ways. I suggest the following order of consideration:
1) There are lots of public fields and methods in vanilla classes that you can access. For example, the AI of the mobs is in a public list that you can simply clear and build again to your liking.
2) Registries and ore dictionary. These are specifically for enabling entities, recipes, etc.
3) Events. There are lots of events you can intercept and change almost anything that is commonly modded.
4) Java reflection. Java allows you to make the private fields and methods of classes publicly accessible.
5) Other methods such as ASM, byte code modification, core mods.
Just a word of warning: changing all blocks to use CUTOUT or TRANSLUCENT will very likely have a drastic impact on performance - the rendering of SOLID blocks is heavily optimized, mainly by not rendering most of the blocks; if you change them all to CUTOUT, that might force every single block in the visible world to have to render... that's a lot of blocks.
Only way to know if it will be a major issue, however, is to try it and see
That's exactly the kind of thing I'm trying to avoid. Basically, I want to create a case statement that will test for a few different kinds of blocks, and if true, will return TRANSLUCENT, otherwise, it'll do nothing and the base class should define it as normal, at least it should, right?
Unfortunately, I've only gotten a little further. I at least have a working forge environment up and running with a very very rudimentary mod skeleton in place. I'm just trying to figure out how to override things without having to do anything insane. I realize the modding community "frowns" on this kind of thing, but they also apparently frown on keeping tutorial information centralized and up to date. I've just spent the last 4 hours google-foo'ing myself into a migraine.
I believe you will have to use a coremod to do this kind of thing. It is, out of the few ways of doing this, the most supported by forge.
Upon deep inspection of what I'm doing and what is necessary, yes. It appears that a Coremod and byte-level coding would be required to modify the specific methods I'm working with. Blech. One step at a time, I guess.
I found this tutorial: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing
just in case anyone was interested. It was a little hard to find.