Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.2] [Re-Solved] How can i change the texture of a vanilla item?


SackCastellon
 Share

Recommended Posts

I want to know how can i change the texture of a vanilla item without editing vanilla classes (or using texture packs), something like the Metallurgy Mod did with the vanilla tools' textures.

 

Thanks for helping  :)

 

SOLUTION 1:

 

Just create your new texture, rename it as it is at minecraft vanilla textures folder (eg: to change texture of a Iron Ingot rename the texture as iron_ingot.png) and then place your new texture at [yourForgeFolder]\src\main\resources\assets\minecraft\textures\[items or blocks]\iron_ingot.png

 

SOLUTION 2:

 

You just will need to type

@EventHandler
public void preInit(FMLPreInitializationEvent event) 
{
Items.[vanillaItem].setTextureName("[yourModID]:[newTexture]");
}

Link to comment
Share on other sites

Hi

 

I've got a sneaking suspicion that this will stop working when you try to package your mod as a zip for releasing it.  If you plan to release your mod eventually, you might want to check that this method still works when you package it up, before you spend too much time on it.

 

I've never tried doing this myself so I can't suggest any other way, sorry.

 

-TGG

Link to comment
Share on other sites

Hi

 

I've got a sneaking suspicion that this will stop working when you try to package your mod as a zip for releasing it.  If you plan to release your mod eventually, you might want to check that this method still works when you package it up, before you spend too much time on it.

 

I've never tried doing this myself so I can't suggest any other way, sorry.

 

-TGG

 

Yes, you're right.  I'll do a quick reobfuscation to see if it still works.

 

Thanks

Link to comment
Share on other sites

  • 3 years later...
16 minutes ago, RoyalKingZB said:

I can't do this cause I'm in 1.10.2 Dx Help There are json files now that handle the textures and there is no .setTextureName now Dx

This thread is over 3 years old, and you're trying to do something in a completely different version. Start a new thread, explain the problem, show your code, and post fml-client-latest log :) you'll get more help that way

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • i found it guys
    • So i just bought a RLcraft server for me and my friends to play on. I launched it and it is working fine but it tells me that i need to download all the mods i go to mods and press "minecraft forge" and nothing shows up that i can open files. If anyone have a suggestion i would need the help. This is the server hosting i  used 
    • i did it in 1.12.2 not walking for me can anyone help me get it pls???  
    • Got the rotation working. I had to look at LivingEntityRenderer#render and setupRotations a little more closely, and I realized that I needed to change the custom entity's yBodyRot and yBodyRotO.  private static boolean renderingCustomEntity = false; private static CustomEntity customEntity; private static void refreshCustomEntity(LocalPlayer localPlayer, LivingEntity livingEntity) { if (customEntity == null || customEntity.isRemoved()) { customEntity = ModEntities.CUSTOM_ENTITY.get().create(localPlayer.clientLevel); } if (!customEntity.level.dimension().equals(livingEntity.level.dimension())) { customEntity.discard(); } } @SubscribeEvent public static void replaceMobModel(RenderLivingEvent.Pre<LivingEntity, EntityModel<LivingEntity>> event) { LocalPlayer localPlayer = Minecraft.getInstance().player; if (localPlayer != null && event.getEntity() instanceof Mob mob) { if (/* put your own condition here */) { if (!renderingCustomEntity) { try { renderingCustomEntity = true; event.setCanceled(true); refreshCustomEntity(localPlayer, mob); // (truth be told, my custom entity does not have a "head", so these lines aren't needed) // customEntity.setYHeadRot(mob.getYHeadRot()); // customEntity.yHeadRotO = mob.yHeadRotO; customEntity.setYBodyRot(mob.yBodyRot); customEntity.yBodyRotO = mob.yBodyRotO; customEntity.setPose(mob.getPose()); Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(customEntity).render( customEntity, customEntity.yBodyRot, event.getPartialTick(), event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight() ); } finally { renderingCustomEntity = false; } } } } }   As shown in my code, if the mob whose model is replaced moves to a different dimension, I unload the custom entity with Entity#discard and then reinitialize it on the next tick. I wonder if I also have to unload the custom entity when the mob it is "replacing" dies.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.