Jump to content

Item textures won't show up when other mods are installed?


ocomobock

Recommended Posts

I've been making a mod, and every time I add a new item to it, recompile and reobfuscate, and install it on my minecraft.jar, the textures are completely transparent. Does anyone have any idea why? This doesn't seem to happen with ModLoaderMP. The only other item that isn't from my mod that is transparent is the Creeper Shard from the Mutant Creeper mod.

 

I'm trying to make it so you can download the same .zip file and be able to install the mod on a ModLoaderMP minecraft.jar and a Forge minecraft.jar. That might be the problem.

 

kUqT5.png

 

1E01n.png

 

Could someone please help? I've been trying to fix this for a while now.

Link to comment
Share on other sites

I'll just give you some of my code, I'm not really sure what you're asking.

 

public static Item scoaletonKatana = (new ItemScoaletonKatana(657, null).setItemName("katanaScoaleton"));
public static Item darkBones = (new ItemDarkBones(656).setItemName("bonesDark"));
public static Item darkBoneMeal = (new ItemDarkBoneMeal(655).setItemName("bonemealDark"));
public static final Block darkSoil = (new BlockDarkSoil(146)).setHardness(0.7F).setStepSound(Block.soundGravelFootstep).setResistance(2000F).setBlockName("soilDark").setLightOpacity(1).setRequiresSelfNotify();
public static final Block darkSoil2 = (new BlockDarkSoil(145)).setHardness(0.7F).setStepSound(Block.soundGravelFootstep).setResistance(2000F).setBlockName("soilDark").setLightOpacity(1).setRequiresSelfNotify();
public static Item scoaletonSpawner = (new ItemScoaletonEgg(658)).setItemName("testSpawner");

public void load()
{

	ModLoader.addSpawn(EntityScoaleton.class, ScoaletonMaximumGroupSize, ScoaletonMinimumGroupSize, ScoaletonSpawnRate, EnumCreatureType.monster);
	ModLoader.registerEntityID(EntityScoaleton.class, "Scoaleton", 85);

	ModLoader.addName(scoaletonSpawner, "Spawn Scoaleton");
	scoaletonSpawner.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/scoaletonegg.png");
	ModLoader.addName(darkBones, "Dark Bones");
	darkBones.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/darkbones.png");
	ModLoader.addName(darkBoneMeal, "Dark Bone Meal");
	darkBoneMeal.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/darkbonemeal.png");
	ModLoader.addName(scoaletonKatana, "Katana");
	scoaletonKatana.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/katana.png");

Link to comment
Share on other sites

I tried putting that in the Item file itself, and the mod_XXXXX file.

 

public ItemScoaletonKatana(int par1, EnumToolMaterial par2EnumToolMaterial)
    {
        super(par1);
        this.maxStackSize = 1;
        this.setMaxDamage(mod_Scoaleton.KatanaDurability);
        this.weaponDamage = 10;
        setTextureFile("/ocomo/katana.png");
    }

 

It doesn't show the item name either.

 

public static Item scoaletonKatana = (new ItemScoaletonKatana(657, null).setItemName("katanaScoaleton"));
public static Item darkBones = (new ItemDarkBones(656).setItemName("bonesDark"));
public static Item darkBoneMeal = (new ItemDarkBoneMeal(655).setItemName("bonemealDark"));
public static final Block darkSoil = (new BlockDarkSoil(146)).setHardness(0.7F).setStepSound(Block.soundGravelFootstep).setResistance(2000F).setBlockName("soilDark").setLightOpacity(1).setRequiresSelfNotify();
public static final Block darkSoil2 = (new BlockDarkSoil(145)).setHardness(0.7F).setStepSound(Block.soundGravelFootstep).setResistance(2000F).setBlockName("soilDark").setLightOpacity(1).setRequiresSelfNotify();
public static Item scoaletonSpawner = (new ItemScoaletonEgg(658)).setItemName("testSpawner");

public void load()
{

	ModLoader.addSpawn(EntityScoaleton.class, ScoaletonMaximumGroupSize, ScoaletonMinimumGroupSize, ScoaletonSpawnRate, EnumCreatureType.monster);
	ModLoader.registerEntityID(EntityScoaleton.class, "Scoaleton", 85);

	ModLoader.addName(scoaletonSpawner, "Spawn Scoaleton");
	scoaletonSpawner.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/scoaletonegg.png");
	ModLoader.addName(darkBones, "Dark Bones");
	darkBones.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/darkbones.png");
	ModLoader.addName(darkBoneMeal, "Dark Bone Meal");
	darkBoneMeal.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/darkbonemeal.png");
	scoaletonKatana.setTextureFile("/ocomo/katana.png");

 

I tried putting it in the item file itself:

 

public String getTextureFile()
    {
            return "/ocomo/katana.png";
    }

 

But that didn't work either.

Link to comment
Share on other sites

When you're using the new spritesheets, you have to have all of you textures in the right folders in the <mcp folder>/jars/bin/minecraft.jar.

Then it'll work! :D

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

Link to comment
Share on other sites

So like this?

 

public static Item scoaletonKatana = (new ItemScoaletonKatana(657, null));
public static Item darkBones = (new ItemDarkBones(656).setItemName("bonesDark"));
public static Item darkBoneMeal = (new ItemDarkBoneMeal(655).setItemName("bonemealDark"));
public static final Block darkSoil = (new BlockDarkSoil(146)).setHardness(0.7F).setStepSound(Block.soundGravelFootstep).setResistance(2000F).setBlockName("soilDark").setLightOpacity(1).setRequiresSelfNotify();
public static final Block darkSoil2 = (new BlockDarkSoil(145)).setHardness(0.7F).setStepSound(Block.soundGravelFootstep).setResistance(2000F).setBlockName("soilDark").setLightOpacity(1).setRequiresSelfNotify();
public static Item scoaletonSpawner = (new ItemScoaletonEgg(658)).setItemName("testSpawner");

public void load()
{

	ModLoader.addSpawn(EntityScoaleton.class, ScoaletonMaximumGroupSize, ScoaletonMinimumGroupSize, ScoaletonSpawnRate, EnumCreatureType.monster);
	ModLoader.registerEntityID(EntityScoaleton.class, "Scoaleton", 85);

	MinecraftForgeClient.preloadTexture("ocomo/katana.png");

	ModLoader.addName(scoaletonSpawner, "Spawn Scoaleton");
	scoaletonSpawner.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/scoaletonegg.png");
	ModLoader.addName(darkBones, "Dark Bones");
	darkBones.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/darkbones.png");
	ModLoader.addName(darkBoneMeal, "Dark Bone Meal");
	darkBoneMeal.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/darkbonemeal.png");
	ModLoader.addName(scoaletonKatana, "Katana");
	scoaletonKatana.setTextureFile("/ocomo/katana.png");

 

Cause that isn't working. Sorry I keep asking questions >_<

Link to comment
Share on other sites

I used the quick fix to set it to null because an error kept appearing on that line. I wasn't really sure why it wanted to do that. I just figured out why that was happening now though and changed it. I'm pretty sure it's because I copied the code from the sword class, and since the sword class is looking for the tool material, it wanted me to add a value.

 

I also noticed that there wasn't a / at the beginning of the path in MinecraftForgeClient.preloadTexture, but I fixed that. The texture still isn't loading.

Link to comment
Share on other sites

package net.minecraft.src;

public class ItemScoaletonKatana extends Item
{
    private int weaponDamage;

    public ItemScoaletonKatana(int par1)
    {
        super(par1);
        this.maxStackSize = 1;
        this.setMaxDamage(mod_Scoaleton.KatanaDurability);
        this.weaponDamage = 10;
    }

    /**
     * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
     * sword
     */
    public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
    {
        return par2Block.blockID == Block.web.blockID ? 15.0F : 1.5F;
    }

    /**
     * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
     * the damage on the stack.
     */
    public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
    {
        par1ItemStack.damageItem(1, par3EntityLiving);
        par2EntityLiving.setFire(mod_Scoaleton.KatanaFireTime);
        return true;
    }

    public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
    {
        par1ItemStack.damageItem(2, par6EntityLiving);
        return true;
    }

    /**
     * Returns the damage against a given entity.
     */
    public int getDamageVsEntity(Entity par1Entity)
    {
        return this.weaponDamage;
    }

    /**
     * Returns True is the item is renderer in full 3D when hold.
     */
    public boolean isFull3D()
    {
        return true;
    }

    /**
     * returns the action that specifies what animation to play when the items is being used
     */
    public EnumAction getItemUseAction(ItemStack par1ItemStack)
    {
        return EnumAction.block;
    }

    /**
     * How long it takes to use or consume an item
     */
    public int getMaxItemUseDuration(ItemStack par1ItemStack)
    {
        return 72000;
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
        return par1ItemStack;
    }

    /**
     * Returns if the item (tool) can harvest results from the block type.
     */
    public boolean canHarvestBlock(Block par1Block)
    {
        return par1Block.blockID == Block.web.blockID;
    }
    
    public String getTextureFile()
    {
            return "/ocomo/katana.png";
    }
}

Link to comment
Share on other sites

The texture is still invisible.

 

package net.minecraft.src;

import net.minecraft.src.forge.ITextureProvider;

public class ItemScoaletonKatana extends Item implements ITextureProvider
{
    private int weaponDamage;

    public ItemScoaletonKatana(int par1)
    {
        super(par1);
        this.maxStackSize = 1;
        this.setMaxDamage(mod_Scoaleton.KatanaDurability);
        this.weaponDamage = 10;
    }

Link to comment
Share on other sites

https://github.com/cpw/ironchest/ works, copy how it does it, and make sure not to use addOverride.  :)

I looked through the mod_ file and the Item files and I can't really find anything similar to what hotrods is talking about.

 

Anyways, I figured out a lot of mods have this problem, and is caused by Optifine. I uninstalled Optifine (replacing and deleting files in my minecraft.jar took forever <_<) which seemed to fix it. So I'll probably just end up letting everyone know that if they wanna use this mod, they either can't have Optifine installed, or have to deal with the missing textures.

 

Without Optifine:

 

VVTRc.png

 

With Optifine:

 

1E01n.png

Link to comment
Share on other sites

https://github.com/cpw/ironchest/ works, copy how it does it, and make sure not to use addOverride.  :)

I looked through the mod_ file and the Item files and I can't really find anything similar to what hotrods is talking about.

 

Anyways, I figured out a lot of mods have this problem, and is caused by Optifine. I uninstalled Optifine (replacing and deleting files in my minecraft.jar took forever <_<) which seemed to fix it. So I'll probably just end up letting everyone know that if they wanna use this mod, they either can't have Optifine installed, or have to deal with the missing textures.

 

Without Optifine:

 

VVTRc.png

 

With Optifine:

 

VjjRa.png

 

maybe im blind, but i cannot spot the difference between those two images =S

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Wait guys, I still don't don't understand... I shall send my code -- Define the function to decrease hunger local function decreaseHunger(player)     local currentHunger = player.getHunger()          -- Check if hunger is not already zero     if currentHunger > 0 then         player.setHunger(currentHunger - 1)     end end -- Register event to decrease hunger over time script.registerEvent(EntityPlayer, function(player)     while true do         -- Decrease hunger every few seconds         decreaseHunger(player)         script.sleep(1000) -- Sleep for 1 second     end end)     Any help appriecated. It's been a while since I learnt Javascript or whatever Minecraft is made with... ... ... ... Nicknotname Hungerinpeaceful xx
    • good days  i get this error: java.lang.ClassCastException: class net.minecraft.client.player.LocalPlayer cannot be cast to class net.minecraftforge.common.extensions.IForgeServerPlayer (net.minecraft.client.player.LocalPlayer is in module minecraft@1.20.4 of loader 'TRANSFORMER' @3e8b3b79; net.minecraftforge.common.extensions.IForgeServerPlayer is in module forge@49.0.26 of loader 'TRANSFORMER' @3e8b3b79)     at mercmod.blocks.classes.panel_whit_entity_inside.use(panel_whit_entity_inside.java:576) ~[main/:?] {re:classloading}     at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.use(BlockBehaviour.java:826) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading}     at net.minecraft.client.multiplayer.MultiPlayerGameMode.performUseItemOn(MultiPlayerGameMode.java:324) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.multiplayer.MultiPlayerGameMode.lambda$useItemOn$4(MultiPlayerGameMode.java:292) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.multiplayer.MultiPlayerGameMode.startPrediction(MultiPlayerGameMode.java:251) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.multiplayer.MultiPlayerGameMode.useItemOn(MultiPlayerGameMode.java:291) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.startUseItem(Minecraft.java:1799) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.handleKeybinds(Minecraft.java:2083) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.tick(Minecraft.java:1902) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.runTick(Minecraft.java:1216) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.run(Minecraft.java:801) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:234) ~[forge-1.20.4-49.0.26_mapped_official_1.20.4-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} ------------------------------------------------------------------------------------------------------------------   context:  im updating the briefcase from mi mod an i need to make a gui whit this image that gonna be launched from a block and from a item soo im using kapenjoe tutorials  ---------------------------------------------------------------------------------------- The problem is that tutorial is for 1.20.1 and im using 1.20.4 and i really dont get how to call and open the gui from the block nor from the item i made this based on post i made short ago everything seems find but when right click the block to open the gui it crash the game  @Override public InteractionResult use(BlockState blkstate, Level warudo, BlockPos pos, Player pe, InteractionHand hand, BlockHitResult hitresult) {     if(warudo.isClientSide()){         BlockEntity blkentity = warudo.getBlockEntity(pos);         if(blkentity instanceof Panel_BlockEntity){             //   ↓↓↓  open the menu from the block              IForgeServerPlayer ifpe = (IForgeServerPlayer)pe; //<--- this is wrong  "class net.minecraft.client.player.LocalPlayer cannot be cast to class net.minecraftforge.common.extensions.IForgeServerPlayer"             ifpe.openMenu( (Panel_BlockEntity) blkentity, pos ); //<-- i need an example of how open a gui in 1.20.4         }     } return InteractionResult.sidedSuccess(warudo.isClientSide()); } Theres nothing highlighted in red in the code like everything where right an possible but dont works  ####################################################################################################### i need to see an example, just the piece of code for the use() method of the block whit the block entity for 1.20.4  and the same  but for the item     @Override     public @NotNull InteractionResultHolder<ItemStack> use(@NotNull Level warudo, @NotNull Player pe, @NotNull InteractionHand interactionHand)     {         if (!warudo.isClientSide())         {             ItemStack heldItem = pe.getItemInHand(interactionHand);                          if (heldItem.getCapability(ForgeCapabilities.ITEM_HANDLER).isPresent())             {                 //   ↓↓↓  open the menu from the item                 NetworkHooks.openScreen((ServerPlayer) pe, this);             }         }         return super.use(warudo, pe, interactionHand);     }   thanks for your attention           
    • It depends on the data you want to save, but generally speaking you should use some custom Player Capabilities, attach to the Player and use them to store/retrieve any kind of data you want. You can find how to make them work for 1.20.x in the documentation here: https://docs.minecraftforge.net/en/latest/datastorage/capabilities/
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.