Jump to content

TPD

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by TPD

  1. I want to prevent the player from equipping a certain Item to the offHand
  2. Is it possible to get the itemStack that is currently dragged arround by the cursor (for example in an inventory)?
  3. Is there something like this for Keys aswell? It's probably rare, but the player might change the binding to a key. If not, I can just find out if it's bound to a key or the mouse (mouse has negative keyCode) and use the reflection-method for keys.
  4. I tried to set the 'pressed' value of the keyBindAttack binding to false via setKeyBindState during Key/MouseInputEvent as well as in the START phase of ClientTickEvent, but it doesn't cancel the clicking for some reason. How does it work? Edit: I think the problem is that the pressed value is assigned after the START and before END phase of client-tick, so the value specified in START just gets overridden. In case of keyBindAttack, it's possible to set Minecraft#leftClickCounter to something greater than 1 via reflection (very hacky D:), as this needs to be 0 (and gets reduced by 1 every tick) for attacking/breaking to be effective.
  5. How can I prevent the player from equipping a certain Item to the off-hand?
  6. Hello, I'm using an ItemOverrideList to modify the IModelSate of my Models according to the ItemStack and the Entity that it is held by. The problem is that the parameter "originalModel" is (as the name suggests) the original model that was loaded from the file and not the model the item was previously rendered with. This means that I have to re-instantiate the IBakedModel with a new IModelState everytime handleItemSate is called, eventhough it would really only be needed if the IModelState is no longer the same. Is there a way I can get the previous model? Maybe its possible to make the rendering system call the getOverrides() method of the NEW BakedModel (the one that was returned in handleItemState) instead of the BakedModel with which the Item was registered? Edit: Am I allowed to make the changes to the original model/to its state? Or does that cause problems if there are multiple item stacks/items seen from different persepctives (gui, frame, hands etc) around?
  7. This is kind of similar to my current solution: I replace the ModelRenderer of the bipedRightarm and bipedLeftarm of the player model (as well as the armor layers) in pre with my own ModelRenderer if a specific item is held. This ModelRenderer changes the angles in the render() method. In the post rendering event the renderer is disabled again. I don't know if this is a good approach or not but at least I don't have to do the rendering myself and it could provide at least some compatibility with other mods that want to change the model. I'm not sure how I shoud secure the functionality of the original ModelRenderer in my own ModelRenderer though. I could either copy all fields from the original renderer via reflection, or store the original renderer inside my custom renderer, make my own renderer override all methods and then call the ones of the original renderer instead.
  8. And how does that work without modifying minecraft classes?
  9. I can't just modify the rotationAngles because they get overriden in ModelBiped.setRotationAngles.. Do I have to render the arm myself and then prevent that it gets rendered later?
  10. How do I do this exactly? Something like this? public void renderPlayer(RenderPlayerEvent.Pre event) { ModelPlayer model = event.getRenderer().getMainModel(); GL11.glPushMatrix(); GL11.glRotatef(2,1,0,0); model.bipedRightArm.render(0.0625F); GL11.glPopMatrix(); }
  11. I just want to know how to change the model (rotation of body parts) in general. I will try to do the more specific part of my question myself.
  12. Still no solution. Shouldn't changing the playermodel be a rather simple thing?
  13. As I said, it is very likely, that the NBT tags are also the same. Even if they are not, it won't work because ItemRenderer#itemStackMainHand and ItemRenderer#itemStackOffHand are not updated since I need to override the shouldCauseReequipAnimation to prevent the animation after an NBT-edit
  14. Tried that but it is very likely that everything besides the instance can be the same for both stacks The problem is that I change the NBTtag on the server. When the client updates, does it create a new instance of the item if it is not the same as on the server? The item that will be returned in HandleItemState is stored in ItemRenderer (itemStackMainHand and itemStackOffHand fields) These fields are updating in ItemRenderer::updateEquippedItem every tick. But since I override shouldCauseReequipAnimation, this is prevented. This might cause it to desync when renderFireInFirstPerson is called, because it's no longer the actual ItemStack held by the player. Edit: There's even a comment in renderItemInFirstPerson, that says "//Forge: Data watcher can desync"
  15. As I said, it is very likely that the player can hold the same item with the same stats in both hands
  16. it returns false because equals in ItemStack just checks the instance
  17. In my mod it is very likely that you hold items with the same stats (also same NBT data) in both hands, so there will often be no differences.
  18. Hi, When I edit the NBT-tag of my item there is a little "up-and down"-animation in first person (same animation as switching slots). I wanted to prevent this animation by overriding Item::shouldCauseReequipAnimation to compare the items and ignore the particular NBT-change that I made. The problem is that now my animated models (OBJModels that I re-bake in ItemOverrideList::handleItemState) don't update anymore... This was already reported as bug here: https://github.com/MinecraftForge/MinecraftForge/issues/2672, but was marked as fixed by LexManos so I'm looking for a different way to prevent the "NBT-animation"... It would also work if I had a better way to get the Hand in ItemOverrideList::handleItemState. Currently I'm doing this: EnumHand hand = null; if (stack.equals(entity.getHeldItemMainhand())) { hand = EnumHand.MAIN_HAND; } else if (stack.equals(entity.getHeldItemOffhand())) { hand = EnumHand.OFF_HAND; } But 'stack' equals neither of the items in the hands of the player if I override shouldCauseReequipAnimation
  19. The thing is that there are so many more factors that influence the model like paintjobs and attachments to the item.
  20. I have a float that describes the animation progress (varies between 0 and 1) and my in my animastions models have to move around according to that value. I can't save every single step of the animation because there are about a million of possible states...
  21. I tried to optimize it as much as possible and only do the re-baking when there is actually an animation going on, but during animations that go on all the time when the item is held, the memory usage increases at least 5 times faster than normal and the frame rate becomes less stable...
  22. One more question: What does .isBuiltInRenderer() in IBakedModel change?
  23. Ok. But I should still store the animation progress in the IModelState, right? When I re-bake my model with the new state, how should I apply the progress to OBJModels contained in my Model?
  24. nvm. I edited it. Changing BakedQuads is probably not possible
  25. Does that mean I should store the IModel in the BakedModel and then create a new Bakedmodel from that Model everytime?
×
×
  • Create New...

Important Information

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