Jump to content

Recommended Posts

Posted

I am trying to make a block change texture when I wear a certain helmet, it worked in 1.6.4, but it broke in 1.7.2.

BlockNullOre:

 

  Reveal hidden contents

 

RenderNullOre:

 

  Reveal hidden contents

 

Also, I know the RenderNullOre is being called on render because of the System.out.println()'s. Currently it does not even render a texture at all, it is just a transparent cube. Sorry if I need to put up any more code.

EDIT: After placing liquid around it it stopped being transparent, but still did not change texture.

EDIT 2: After editing the RenderNullOre a bit, the transparency stopped, but it still will not change texture. Also, I want the change to be client-side only for only the person who is wearing goggles. I also do not want it to be a tile entity, because it is an ore and will spawn a lot in certain places. I put the new code in the spoiler.

Posted

public void onArmorTick(World world, EntityPlayer player, ItemStack armor) {

}

Maybe that will help you in someway. I'm unsure about this kind of situation.

It goes in your ItemArmor class.

Legend of Zelda Mod[updated September 20th to 3.1.1]

Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0]

Fancy Cheeses[updated May 8th to 0.5.0]

Posted

Hi

 

You could either use a TESR as DieSieben suggested, alternatively you could use an animated texture and change the texture based on whether the player is wearing a helmet or not.  This can be tricky to get right but I think it should work.

 

Check out TextureClock.

 

This link may also help - see the clock and compass sections

 

http://www.minecraftforum.net/topic/1881638-animation-in-resource-packs-a-minecraft-16-tutorial/

 

-TGG

 

 

 

Posted

I don't want to use tile entity special renderers because tile entity. It is an ore and already lags a bit as it is. I chose the animation route, but how would I bind my TextureNullOre to my BlockNullOre?

Posted

Ok, now it is cycling through red, orange, and yellow.

BlockNullOre:

 

  Reveal hidden contents

 

TextureNullOre:

 

  Reveal hidden contents

 

Posted

My MCMeta file looks like this:

 

  Reveal hidden contents

 

I don;t want it to be animated, though, because of the wear helmet, different texture thing.

Posted

Hi

 

If you put a breakpoint in   

public void updateAnimation() {

does it actually get called?

 

When you say-

"Ok, now it is cycling through red, orange, and yellow."

1) are the textures correct?  i.e. it cycles through the correct textures, or

2) are the "red, orange, yellow" just random textures that are totally wrong, or

3) are the "red, orange, yellow" a single correct texture that is changing colour by itself?

 

-TGG

Posted

Ok, for some reason updateAnimation is never called. I don't use breakpoints so... also the red, orange, yellow is a solid color that is switching to those colors. Earlier I posted an imgur link to the texture file.

Posted

Hmmm

 

I'm rather rusty on animations unfortunately but from memory you need to register it in a special way;

 

TextureMap.setTextureEntry instead of registerIcon

 

   /**
     * Adds a texture registry entry to this map for the specified name if one does not already exist.
     * Returns false if the map already contains a entry for the specified name.
     *
     * @param name Entry name
     * @param entry Entry instance
     * @return True if the entry was added to the map, false otherwise.
     */
    public boolean setTextureEntry(String name, TextureAtlasSprite entry)
    {
        if (!mapRegisteredSprites.containsKey(name))
        {
            mapRegisteredSprites.put(name, entry);
            return true;
        }
        return false;
    }

 

You could try hooking into the TextureStitchEvent.Pre, and in the handler create your TextureNullOre and then call setTextureEntry(name, textureNullOre) .

 

Unfortunately I've lost my old test code for this so I don't remember details

 

-TGG

 

Posted

Do you know what I would put as name? Also, do you mean do an @SubscribeEvent with a TextureStitchEvent.Pre as the arguments? Sorry, first time trying modding animations.

Posted

Still does the red, orange, yellow thing. I think it is the animation missing texture icon or something.

My subscribevent is this:

@SubscribeEvent

public void texturePreStitch(TextureStitchEvent.Pre event){

event.map.setTextureEntry("nullOre", new TextureNullOre("nullvoid:nullOre"));

}

I know the class it is in is registered correctly because I am also using it for another thing.

I use setBlockTextureName("nullOre"); in the BlockNullOre's constructor.

Posted

How to get your TextureAtlas to work:

First make a new instance of it and save it in a static class field, so that you can reference it anywhere.

Use the TextureStitchPre event, instantiate the static field, and there, use the event to register your instance texture atlas. Example code here:

https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/client/event/IconRegistry.java

Note: event.map.getTextureType() MUST be equal to 0 here instead of 1, since it's the texture sprite for blocks!

 

If you've done that, go to your block and use the texture atlas instance in your blocks getIcon() methods, Example code can be found here, it's an item, but it should also be similar to the block:

https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/item/ItemAvisCompass.java#L62-L64

assign your blockIcon field inside your block with the texture atlas instance, preferably within the registerIcons() method (also DO NOT call the super method in this case! It will either complain about a missing/duplicate texture, or assign the same texture again!)

 

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

I tried SanAndreasP's method, now it gives the missing icon checkerboard texture.

Code:

TextureNullOre:

 

  Reveal hidden contents

 

BlockNullOre:

 

  Reveal hidden contents

 

VoidMod:

 

  Reveal hidden contents

 

TickListner:

 

  Reveal hidden contents

 

Posted

If you get the missing icon, there must be something mentioned in the log. Can you give it to us?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted
  On 5/11/2014 at 7:25 PM, Nimbleguy said:

No, it does not say anything about the nullOre texture. Only some other untextured blocks and items.

 

can you still post it?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

 

  Reveal hidden contents

 

Posted

hm... Can you do a println() in your registerBlockIcons method and see if the VoidMod.texNullOre is null?

 

EDIT: I just noticed that the registerBlockIcons method is called before the event and thus you assign null to your blockIcon (why it works for me, I have no clue).

So instanciate your texture atlas whilst defining the field. Then use the reference in the event and the registerBlockIcons method (you just move the

new TextureNullOre()

from the event into the main mod, where you declare your field for it)

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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.

Announcements



×
×
  • Create New...

Important Information

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