Jump to content

ObliviousSpartan

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by ObliviousSpartan

  1. I've managed to set the durability for the items using your suggestion and it works perfectly. And I should be able to sort out disabling the recipes using the IConditionSerializer interface. Thanks for your help.
  2. I'm currently in the process of updating one of my mods to 1.13.2 and have managed to make a config file using the new ForgeConfigSpec class. However, my config file contains values such as durability for items and boolean values for disabling those items as well. And I've noticed that the event ModConfig.ModConfigEvent is fired after all the registry events occur. Is there a way to either fire this event earlier to allow durability changes (they can only be set once, because they're final), or is there another way of achieving this?
  3. I tried to make set up the mod environment in Eclipse, and I had the same issue. So I decided to try it out in IntelliJ IDEA instead. Funnily enough, it works perfectly fine using that IDE. I don't know exactly why Eclipse is have so much trouble working with this, but IDEA seems to have no problems as far as I can tell. Now the only issue is actually learning how to *use* IDEA after such a long time using Eclipse. ? At the very least, I can start working on mods for 1.13.2 now.
  4. Thanks for the suggestions. I am using the capability for ItemStorageHandler (provided by Minecraft Forge) for this purpose, which already has NBT read/write functionality. Because of this, making a custom capability isn't necessary. I figured out how to access the capability NBT data to put in the getNBTShareTag() method for use for the client. I have placed it in the Share Tag using the key "ClientInventory", and accessed it using the same key though the addInformation() method for tooltips and my Hud overlay. Here's the getNBTShareTag() method below: @Override public NBTTagCompound getNBTShareTag(ItemStack stack) { IItemHandler handler = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); // The capability tag is simply a NBTTagList of all the items in the ItemStack NBTBase capTag = CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.getStorage().writeNBT(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, handler, null); NBTTagCompound tag = super.getNBTShareTag(stack); tag.setTag("ClientInventory", capTag); return tag; } And now the quiver seems to sync properly! Tooltips work fine! And the HUD element shows the correct amount of ammo stored in the quiver. Note in the above image I had just shot an arrow from the quiver, so forcing an update packet isn't necessary. Thank you so much for the help!
  5. I am making a quiver for my weapons mod, which stores 4 different stacks of Arrows using capabilities. In a single player world, this works as intended, without issues. However, when running on a server, none of the visual changes show up. So I need to synchronise the ItemStackHandler capability on it from the Server to the Client. The reason for this syncing is that the quiver has a tooltip which shows what the Quiver contains. In addition, there is a HUD overlay which shows how many arrows are left. On top of all that, the Quiver texture changes depending on how full it is. The above pics show what they should look like when properly synced (however the HUD element is a WIP and will change) I have seen the following topic on this: However, I am not sure how to acquire the Capability NBT Tag to add to the share tag for the ItemStack, since the capability tag is private and inaccessible. And with the second way with using packets and an IContainerListener, I am unsure how it works with storing ItemStacks and what data to send with the packet. What would be the best way to approach doing the syncing of those visual elements? Any help would be greatly appreciated.
  6. Hi there, This is my first time posting on these forums, so apologies in advance if I miss anything. I am attempting to make a dagger weapon in a new mod I am making that will have the ability to block melee attacks, but not projectiles. In my attempts to do this, I've ran into a few issues. If I make use of the EnumAction.BLOCK in the method below, it will do the blocking animation I have specified, but it will block projectiles as well rather than using the custom behaviour I have put in a LivingAttackEvent method, which ignores projectiles. @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BLOCK; } As an alternative, I made a custom EnumAction known as MELEE_BLOCK using the method EnumHelper.addAction(), and by doing that, while it makes the blocking behaviour work properly, it doesn't make the weapon appear to visually block the attack, both in first and third person. In first person, the weapon disappears entirely, while in third person, the player just wields it as normal. Here's the Item class, and the LivingAttackEvent method that is called for reference. The following code is based on my alternative custom EnumAction solution I have taken. ItemParryingDagger: Snippet of my mod's EventHandler class: Is there any way to use the EnumAction.BLOCK action to make the weapon only block specific types of damage sources? Or if there is not, how would I go about adding the player animations for blocking for both first- and third-person to account for my custom EnumAction? Any help would be greatly appreciated.
×
×
  • Create New...

Important Information

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