Jump to content

luan

Members
  • Posts

    4
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

luan's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. But I'm supposed to just iterate through the current chunck and search for a block of the correct type to update? Is that really the correct way of doing this? Like get player's x and y and just go from (x - 16, y - 16) to (x + 16, y + 16), z from 0 to 255? Wouldn't that take too long every time I changed armor? Can't I call a method on the Block class, to set a flag or something so that when the next block of that type gets rendered, it updates the texture?
  2. Thanks very much, larsgerrits! It works like a charm for the items. I think I finally understand these concepts. One more problem, though. I did the same thing with the blocks, and they work just fine while in rendering in inventory, or dropped on the floor, or, whatever, item form - but it seems that the blocks already placed (block form) won't change immediately; I did some testing, and it seems that they will all change together only when one of the blocks receives a block update, or when a previously hidden block becomes visible. The ones on the screen from the start, even if you look away and look back, won't change the texture until them, even if the ones in the inventory are already different. There seem to be some sort of buffer or cache for the block's texture, in order to make rendering faster, I guess. Is there a way to clear this buffer? I couldn't find any reference to it in the block class. I could iterate through the world until I found an instance of the block, and then sen an update to it, but that seems way too slow (and ugly) to me, and I'm not even sure it'd work, anyway.
  3. Ok, so I looked up on these TickHandlers, they sound quite promising. I added this to my server proxy register method: TickRegistry.registerTickHandler(new ITickHandler() { private void onPlayerTick(EntityPlayer player) { if (player.getCurrentItemOrArmor(4) != null && player.getCurrentItemOrArmor(4).getItem().itemID == CItems._my_goggles_) { System.out.println("is on"); CItems._my_item_.changeTextures(true); } else { CItems._my_item_.changeTextures(false); } } @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { if (type.equals(EnumSet.of(TickType.PLAYER))) { onPlayerTick((EntityPlayer) tickData[0]); } } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER, TickType.SERVER); } @Override public String getLabel() { return null; } }, Side.SERVER); The checking works, it keeps printing "is on", and only when I'm wearing the goggles. But I have no idea on how to implement the changeTexture(boolean) method I declared in the class CItem (my inheritance of Item). Or what to do inside that 'if', if it is something else, that would allow me to change the frame of the icon I want to draw. I can use two separate icons too, if that is easier, but I can't just call registerIcons again and assign a new icon, as I don't have access to the instance of IconRegister to pass as a parameter.
  4. I'd like to change the texture of an item (and of a block too, actually) if the player is wearing some special goggles. But in the registerIcons method I can't seem to access any of the player's current state. I think the easiest way would be to add two animation frames, but not actually add an animation (in the .mcmeta file), like the clock or compass. Then, change the frame according to the scenario, but I'm not sure how to do that... Is it possible somehow? I know qCraft has something in this manner but it is not open-source, I'm afraid. I tried to look at the actual clock code from vanilla, but there isn't a registerIcons method there - it must work via some sort of black magic or something. Thaumcraft (Goggles of Revealing) and TinkersMechworks (Spool of Wire) both have items that change the way you see the world, but not the actual texture of items, which should be much simpler. I tried, even though, to look at the TM's code, but still couldn't figure it out. I am pretty new, this is the first mod I am trying to make, so I might be just ignoring something very obvious... But I just can't find any way to do it...
×
×
  • Create New...

Important Information

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