I am trying to make a mod and am wondering where the textures are located for Java edition. Also, the code for renaming a bunny to "toast" changes the skin. Where is that code?
The textures the game uses can be found inside the jar in the assets folder, which has the same structure whether inside the jar or in a resource pack (in fact, I use a resource pack to add my own textures in MCP (Mod Coder Pack, a mod development tool, which is irrelevant as I'm just using vanilla functionality). Of course, a published mod should contain its own assets, not rely on a resource pack, which in my case simply means adding them as part of a jar mod; if you are simply reusing existing vanilla textures you don't need to include them, for example, I add a "ruby" item which uses a texture that is still in the vanilla jar, and my "metadata ore" renderer overlays a custom texture over textures from vanilla blocks like stone by calling their "getIcon" method).
As far as changing how the "toast" texture is applied goes, there should be a class with a name like "RenderRabbit" which contains code that checks the name and applies the appropriate texture (I don't have an example of this specific code in vanilla but I modded rabbits into 1.6.4 and simply made the "toast" skin a normal variant, and added a Pocket Edition exclusive skin):
package net.minecraft.src;
public class RenderRabbit extends RenderLiving
{
private static final ResourceLocation BROWN = new ResourceLocation("textures/entity/rabbit/brown.png");
private static final ResourceLocation WHITE = new ResourceLocation("textures/entity/rabbit/white.png");
private static final ResourceLocation BLACK = new ResourceLocation("textures/entity/rabbit/black.png");
private static final ResourceLocation WHITE_SPLOTCHED = new ResourceLocation("textures/entity/rabbit/white_splotched.png");
private static final ResourceLocation GOLD = new ResourceLocation("textures/entity/rabbit/gold.png");
private static final ResourceLocation SALT = new ResourceLocation("textures/entity/rabbit/salt.png");
private static final ResourceLocation TOAST = new ResourceLocation("textures/entity/rabbit/toast.png");
private static final ResourceLocation WHITE_PE = new ResourceLocation("textures/entity/rabbit/white_pe.png");
private static final ResourceLocation KILLER = new ResourceLocation("textures/entity/rabbit/caerbannog.png");
public RenderRabbit()
{
super(new ModelRabbit(), 0.3F);
}
private ResourceLocation getRabbitTexture(EntityRabbit rabbit)
{
switch (rabbit.getRabbitType())
{
default:
case EntityRabbit.BROWN: return BROWN;
case EntityRabbit.WHITE: return WHITE;
case EntityRabbit.BLACK: return BLACK;
case EntityRabbit.SPLOTCHED: return WHITE_SPLOTCHED;
case EntityRabbit.GOLD: return GOLD;
case EntityRabbit.SALT: return SALT;
case EntityRabbit.TOAST: return TOAST;
case EntityRabbit.WHITE_PE: return WHITE_PE;
case EntityRabbit.KILLER: return KILLER;
}
}
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getRabbitTexture((EntityRabbit)par1Entity);
}
}
Note that as mentioned above this is not vanilla code but vanilla will do something similar to choose a texture based on a "getRabbitType" or similarly named method that returns the type. Also, you'd need to modify the rabbit entity itself (probably named "EntityRabbit") to add more types, for example:
private int getRandomRabbitType(boolean allowKillerRabbit)
{
// 1/500 chance of a killer rabbit, but not within 256 blocks of world spawn or from breeding
if (allowKillerRabbit && this.rand.nextInt(500) == 0)
{
ChunkCoordinates spawnPoint = this.worldObj.getSpawnPoint();
int x = spawnPoint.posX - MathHelper.floor_double(this.posX);
int z = spawnPoint.posZ - MathHelper.floor_double(this.posZ);
if (Math.abs(x) > 256 || Math.abs(z) > 256 || x * x + z * z > 65536)
{
//System.out.println("Spawned killer rabbit at " + MathHelper.floor_double(this.posX) + " " + MathHelper.floor_double(this.posY) + " " + MathHelper.floor_double(this.posZ));
return KILLER;
}
}
// Various biomes have different types of rabbits; all types can spawn in most biomes but special variants like gold (deserts) are rare
BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posZ));
int i = this.rand.nextInt(100);
// Snowy biomes only have white and splotched rabbits
if (biome.isBiomeFrozen()) return (i < 60 ? WHITE : (i < 80 ? WHITE_PE : SPLOTCHED));
// Deserts only have gold rabbits
if (biome instanceof BiomeGenDesertTMCW || biome == BiomeGenBase.desertBeach) return GOLD;
// Quartz desert only has white rabbits
if (biome instanceof BiomeGenQuartzDesert || biome == BiomeGenBase.quartzDesertBeach) return (i < 80 ? WHITE : WHITE_PE);
// 40% chance of brown rabbits
if (i < 40) return BROWN;
// 30% chance of salt rabbits
if (i < 70) return SALT;
// 1.25% each of special biome-specific variations
if (i < 75)
{
switch (this.rand.nextInt(4))
{
default: return WHITE;
case 1: return WHITE_PE;
case 2: return SPLOTCHED;
case 3: return GOLD;
}
}
// 12.5% chance each of black and "Toast" rabbits
return (this.rand.nextBoolean() ? BLACK : TOAST);
}
(this might all be irrelevant due to version differences, you don't specify what version you are using but I presume a newer version rather than 1.8 or such (when rabbits where added to vanilla); still this is pretty much how the code should work to decide what textures to use)
You'd need to download some sort of MDK (mod development kit), such as MCP, although it hasn't been officially updated since 1.12 (apparently there are ways to get it for newer versions but it is much more difficult to set up). Most modders use Forge or Fabric these days, which I have no experience with, and both of these are entirely different with respect to how you mod the game (they are mainly for adding new features, not modifying existing ones, which is highly discouraged because it breaks mod compatibility; e.g. Optifine often has compatibility issues because it directly changes the rendering code).
The "Eclipse" that somebody mentioned is an IDE (integrated development environment) which makes it easier to mod (I just use Notepad as an editor, along with a GUI-based "grep" tool to easily search through multiple sources, and directly execute the batch files MCP provides (decompile.bat, recompile.bat, startclient.bat, reobfuscate.bat), this is probably not how you'd want to develop Forge/Fabric mods though and modern MDKs are probably designed to be used with an IDE).
What did you use to decompile it? Only MCP allows you to directly modify the original code, otherwise you'll need to indirectly alter it with bytecode manipulation / "coremods", which is exceedingly complex and difficult (bytecode is basically like assembly language), or add your own entity that extends the vanilla rabbit entity and have it spawn instead of vanilla rabbits (which has the issue that you can't use it on vanilla worlds, or rather, such worlds will lose their rabbits if loaded in vanilla or updated without also updating the mod). The complexity of trying to modify vanilla with Forge/etc is why I never used them (it is also inefficient if you e.g. want to add the 1.8 stone types to an older version - I just replaced the vanilla block with one that uses metadata to determine the textures and drops and crafting recipes).
That said, you can search for "rabbit" to find everything that references it; you'd want classes with names like "RenderRabbit" and "EntityRabbit":
Beyond this, it sounds like you've only started to try modding and I am not in a position to try to provide tutorials, especially for newer versions and mod APIs.
I am trying to make a mod and am wondering where the textures are located for Java edition. Also, the code for renaming a bunny to "toast" changes the skin. Where is that code?
In your development environment, textures are located in Referenced Libraries/client-extra/assets/minecraft/textures/. At least for Eclipse IDE.
Eclipse? I'm sorry, but this is my first time modding. Is there a tutorial or something I should watch?
The textures the game uses can be found inside the jar in the assets folder, which has the same structure whether inside the jar or in a resource pack (in fact, I use a resource pack to add my own textures in MCP (Mod Coder Pack, a mod development tool, which is irrelevant as I'm just using vanilla functionality). Of course, a published mod should contain its own assets, not rely on a resource pack, which in my case simply means adding them as part of a jar mod; if you are simply reusing existing vanilla textures you don't need to include them, for example, I add a "ruby" item which uses a texture that is still in the vanilla jar, and my "metadata ore" renderer overlays a custom texture over textures from vanilla blocks like stone by calling their "getIcon" method).
As far as changing how the "toast" texture is applied goes, there should be a class with a name like "RenderRabbit" which contains code that checks the name and applies the appropriate texture (I don't have an example of this specific code in vanilla but I modded rabbits into 1.6.4 and simply made the "toast" skin a normal variant, and added a Pocket Edition exclusive skin):
Note that as mentioned above this is not vanilla code but vanilla will do something similar to choose a texture based on a "getRabbitType" or similarly named method that returns the type. Also, you'd need to modify the rabbit entity itself (probably named "EntityRabbit") to add more types, for example:
(this might all be irrelevant due to version differences, you don't specify what version you are using but I presume a newer version rather than 1.8 or such (when rabbits where added to vanilla); still this is pretty much how the code should work to decide what textures to use)
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
This helped a lot, thanks! Also, yes, I use 1.15.2 version. Where can I find the classes?
You'd need to download some sort of MDK (mod development kit), such as MCP, although it hasn't been officially updated since 1.12 (apparently there are ways to get it for newer versions but it is much more difficult to set up). Most modders use Forge or Fabric these days, which I have no experience with, and both of these are entirely different with respect to how you mod the game (they are mainly for adding new features, not modifying existing ones, which is highly discouraged because it breaks mod compatibility; e.g. Optifine often has compatibility issues because it directly changes the rendering code).
The "Eclipse" that somebody mentioned is an IDE (integrated development environment) which makes it easier to mod (I just use Notepad as an editor, along with a GUI-based "grep" tool to easily search through multiple sources, and directly execute the batch files MCP provides (decompile.bat, recompile.bat, startclient.bat, reobfuscate.bat), this is probably not how you'd want to develop Forge/Fabric mods though and modern MDKs are probably designed to be used with an IDE).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
So, I decompiled it. Which folder and file are the Toast Code?
What did you use to decompile it? Only MCP allows you to directly modify the original code, otherwise you'll need to indirectly alter it with bytecode manipulation / "coremods", which is exceedingly complex and difficult (bytecode is basically like assembly language), or add your own entity that extends the vanilla rabbit entity and have it spawn instead of vanilla rabbits (which has the issue that you can't use it on vanilla worlds, or rather, such worlds will lose their rabbits if loaded in vanilla or updated without also updating the mod). The complexity of trying to modify vanilla with Forge/etc is why I never used them (it is also inefficient if you e.g. want to add the 1.8 stone types to an older version - I just replaced the vanilla block with one that uses metadata to determine the textures and drops and crafting recipes).
That said, you can search for "rabbit" to find everything that references it; you'd want classes with names like "RenderRabbit" and "EntityRabbit":
Beyond this, it sounds like you've only started to try modding and I am not in a position to try to provide tutorials, especially for newer versions and mod APIs.
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?