Jump to content

vroominator

Forge Modder
  • Posts

    171
  • Joined

  • Last visited

Everything posted by vroominator

  1. He's using 1.2.5, which, I'm pretty sure, is before the event system existed. It'll be a lot easier to accomplish what you want to do if you just update to 1.4.7. It won't take long, and everything is a lot easier to do with the new system.
  2. I guess there's only one way to go find out. I'll go do a bit of editing and see how well it works.
  3. There's an onUpdate() method in Item.java. public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) Called every tick as long as the item is in a player's inventory. You could check to see if the item is being held, and if it is, change anim. And then inside getIconIndex, look at what anim is, and set your item's texture dependant on that.
  4. Yeah. It's around line 330 of EntityPlayer. Usage Scenario: Item that saves a Block's location in it's NBT data and then, upon being activated, calls the OnActivated() method inside the block at that location. Used to remotely access chests, machines, levers, and such. I've got such an item working ingame. All I need is a way to get past that one check, and this item is ready for use, (Yes, I know how incredibly overpowered this is. It's going to be expensive)
  5. Instead of ItemDIDDrill.shiftedIndex, you need to use ~PlaceYouRegisteredYourItem~.~ItemName~.shiftedIndex. And this won't animate the item in the item bar, just in your hand, and as for having it render all the time, I'm entirely sure about how you'd do that. You could set an integer somewhere in your Item class, have the icon index change depending on the integer, and change the integer each time this method is run.
  6. Hm. I didn't really think about that. Do you know any other way this could be done?
  7. You know how Guis close automatically if the user is too far away from their corresponding Block? I need a way to prevent this from happening if certain conditions are met. I'm proposing a way to prevent this from happening if a boolean value in the player is set to true, which could be done via tick handler.
  8. I'm pretty sure this could be done by adding a simple boolean to the player, named canPlayerAccessAllGuis or something like that, which would, by default, be set to false. It could be set to true in a tick handler, if certain conditions are met. Every tick, a check is run to see if the player has a Gui open and if the player can interact with the Gui's container. A check to see if canPlayerAccessAllGuis is true could be added in here. If it's true, then it should skip closing the currently open Gui, but otherwise, the Gui will be closed as normal. I require this to get a feature I have had planned for a while now working, and It could be useful for other modders wanting to access Guis from a distance as well. Thoughts?
  9. Okay, I'm pretty sure that your crashing is caused by usingItem being null. Check to make sure usingItem != null before running the rest of your code.
  10. Was the error caused by the line "Here is an example usage for Vanilla bows." by any chance. Accidentally forgot to remove that, and I wouldn't be surprised if you accidentally copied that along with you. If not, crash report and Item file? I'll see if I can find out what's wrong.
  11. Alright. You just need to put this method into your <YourItem>.java. It'll override getIconIndex() in Item. You need to return the index that the new texture is at. From Item.java, here's an example on how this would be used for the Vanilla Bow. public int getIconIndex(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { Here is an example usage for Vanilla bows. if (usingItem != null && usingItem.getItem().shiftedIndex == Item.bow.shiftedIndex) { int k = usingItem.getMaxItemUseDuration() - useRemaining; if (k >= 18) return 133; if (k > 13) return 117; if (k > 0) return 101; } return getIconIndex(stack); }
  12. According to the Javadoc, these are the parameters. stack - The item stack to get the icon for. (Usually this, and usingItem will be the same if usingItem is not null) renderPass - The pass to get the icon for, 0 is default. player - The player holding the item usingItem - The item the player is actively using. Can be null if not using anything. useRemaining - The ticks remaining for the active item. You'll probably want to have the icon change depending on how long the item has been in use for. You can get that number like this int usageTicks = usingItem.getMaxItemUseDuration() - useRemaining;
  13. you can use public int getIconIndex(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) in your item to change it's icon.
  14. Zombie.setRevengeTarget(otherZombie) should make Zombie want to kill otherZombie.
  15. No, actually. world.isRemote returns false on the server.
  16. if(!world.isRemote) { do stuff }
  17. If the changing base classes is for the Overlay, you could probably add that in using a Tick Handler, although I'm not sure how.
  18. Okay, so I did a little digging around in the code, and the responsible line of code is line 330 of EntityPlayer. if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) This statement causes the current GuiScreen to close if canInteractWith in the open container returns false, so I'm guessing this means there's no workaround at all. I suppose I could do a Pull Request and add a hook in there to cancel the Gui being closed.
  19. Well yes, I'm quite aware of that, but I'm not just talking about my own Tile Entities and Containers here. I want this item to be able to access any Block, regardless of whether it's a Vanilla Block, my own Block, or a Block added by another mod.
  20. I'm making an Item that allows the user to interract with any block remotely. It does this by calling onBlockActivated on the block whose data is stored in the NBT Tag Compound of the Item. This works fine for blocks like the lever and the door, who have no Container or Tile Entity, but for blocks like the Furnace or the Crafting Table, it only works when the user is within 5 or so blocks of the linked block. The GUI of the associated block shows for a split second, and then closes again, and I'm pretty sure this is because of isUsableByPlayer and/or canInterractWith returning false because the player is not close enough. Is there any way to bypass this, or am I going to have to scrap this Item?
  21. player.capabilities.isCreativeMode
  22. I really like the graffiti feature. Leaving little messages on my friends' machines is gonna be fun. Your textures are done very well, too. I do have one suggestion, Custom Paintings. It'd be a fair bit of a challenge, but I reckon it's possible. Maybe a little easel for painting on. It could really liven up homes and buildings
  23. In the Forge 6.4.1 Changelog, it says "New segment of data on the player entity that is persisted across deaths for modder use.". You could probably save your new XP in there.
  24. Very cool. I'm gonna need to try this
  25. Not worth making anything new for 1.4.5. Just wait a few days and everything you use will be up to date. If it's not, go nag the mod author.
×
×
  • Create New...

Important Information

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