Extract common code from bow and crossbow#5351
Extract common code from bow and crossbow#5351lcy0x1 wants to merge 7 commits intoSlimeKnights:1.20.1from
Conversation
|
This PR is the first step toward allowing mob to use TConstruct bows and arrows. They can call |
src/main/java/slimeknights/tconstruct/library/tools/item/ranged/LauncherUserInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/slimeknights/tconstruct/library/tools/item/ranged/ModifiableLauncherItem.java
Show resolved
Hide resolved
| if (user instanceof Player player) { | ||
| player.getInventory().removeItem(standardAmmo); | ||
| } |
There was a problem hiding this comment.
I want to discuss this more; how is a non-player expected to remove the ammo from their inventory? Or are we just assuming they don't care about cleaning up empty stacks?
I know most mobs do infinite ammo, but imagine a dispenser like shooter.
There was a problem hiding this comment.
I would say the mob needs to be able to clean up empty stacks themselves. What harm will it do to not remove empty stacks? They are empty and isEmpty() returns true
There was a problem hiding this comment.
Mostly just memory waste, which is why vanilla typically does it.
There was a problem hiding this comment.
I don't think there is a realistic method to clear mob inventory, as each mob would have different implementations. Sounds like it doesn't matter that much.
Though if you think this part should be part of the API, then maybe LauncherUserInfo would be a place to add it.
src/main/java/slimeknights/tconstruct/library/modifiers/hook/ranged/BowAmmoModifierHook.java
Outdated
Show resolved
Hide resolved
# Conflicts: # src/main/java/slimeknights/tconstruct/library/tools/item/ranged/ModifiableLauncherItem.java
src/main/java/slimeknights/tconstruct/library/tools/item/ranged/ModifiableLauncherItem.java
Outdated
Show resolved
Hide resolved
|
Any remaining items to discuss? |
|
I need to do a more in depth code review when I get a chance. I might have something after that. |
|
Thanks |
Simplifies an upcoming change. Related issue: #5351
|
Apologizes, between the changes I pushed and the more recent update I spent most of the year on, this PR has gotten buried. Is there anything notable missing from the living entity support for bows and crossbows? I'm still not sure that firing the two should be sharing that much code since they work so differently. |
BowAmmoModifierHook: Change input parameter type fromPlayertoLivingEntityRestructure arrow shoot logic: