Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/27/21 in all areas

  1. To loop over the armor inventory use LivingEntity#getArmorInventoryList() and then iterate through it. Then use EnchantmentHelper#getEnchantments(stack) to get the enchantment data from an itemstack in form of Map<Enchantment, Integer>.
    1 point
  2. What you did in the first place is correct, as you looked at the vanilla code that obtains this effect for player hearts as an inspiration...of course that code is not very explanatory as you already pointed out so, you could take some time reading it very carefully in order to assess what every line of code exactly does, or you could copy that portion of code in your code and try to play a bit with it to see how things change, and so you can adjust it to your needs
    1 point
  3. My mod implements a custom arrow entity that does not appear client-side. It does exist server-side, I can confirm it hits entities and causes damage and can also confirm the entities' existence using commands. This issue seems to be identical to an older 1.15.2 issue presented here: The solution given in this topic is to give the entity the following method override: @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } This works fine for rendering the entity, the texture appears, hitbox appears, everything except the entity's NBT is working. The main problem I can identify is that the arrow entity's Owner UUID (ProjectileEntity's field_234609_b_) is not transfered over (idk if that's correct terminology) by the createSpawnPacket override. This leads to the arrow not moving in the right direction, as the client-side thinks that this unowned arrow should've collided with the player, whereas the server-side knows that the arrow belongs to the player and therefore should not have collided with the player on the first tick of its existence. I am unaware of how to proceed as my knowledge of how packets work is pretty limited. Entities - Forge Documentation is the closest documentation I can find but I don't see any relevance. What's most annoying is that other mods I have checked just work. No packets or anything, the renderer just renders it. I used IntelliJ to look at the classes for CoFH's Archer's Paradox and the implementation of their arrow item, arrow entity and arrow renderer is very simplistic and is identical to mine but without any packet nonsense (and some stuff I added after I got the rendering-with-packets 'working'). It's a 1.16.3 mod but load that mod up in 1.16.4 and everything just renders, it's ridiculous. I'm thinking this indicates something is wrong with my gradle setup? Any help would be very much appreciated
    1 point
  4. Leashes are rendered by RenderLiving#renderLeash
    1 point
×
×
  • Create New...

Important Information

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