Jump to content

TPD

Members
  • Posts

    77
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Germany

TPD's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  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
×
×
  • Create New...

Important Information

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