Fix GT shears so they behave like vanilla ones and fix #4534#4626
Fix GT shears so they behave like vanilla ones and fix #4534#4626GreenSkiy wants to merge 22 commits intoGregTechCEu:1.20.1from
Conversation
…ity is right click
… check is one successed
…s called when a block is right click not destroyed so does not destroy the block after shearing it anymore.
Creation of a shearing behavior so any tool can act as shears if wanted. Addition of onInteractLivingEntity in IToolBehavior to be able to shear entities. Creation of the shear model and textures. Has been tested on all the vanilla blocks and entities with which vanilla shears can interact. Shearing of blocks has also been tested with an AOE shear.
…o consuming one durability too many when using scythe.
Fix scythe using n+1 durability when hoeing ground.
That never actually did anything, because blocks can't actually implement |
| } | ||
|
|
||
| @Override | ||
| public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget, |
There was a problem hiding this comment.
also implement this on the other IGTTool implementations.
| // beehive/nest | ||
| // or pumpkin because the use method of the block will succeed and prevent the onItemUse method of Item to be | ||
| // called | ||
| // (see PlayerInteractEvent$RightClickBlock) |
There was a problem hiding this comment.
what about the early use method (whatever that's called? forgot)
There was a problem hiding this comment.
Moved block shearing to this onItemUseFirst method and added SHEARS_HARVEST + SHEARS_CARVE as action performable by shear behavior
There was a problem hiding this comment.
please undo the indent change
There was a problem hiding this comment.
Done, my editor was misconfigured and used indent of 2 instead of 4 for json files
…SHEARS_HARVEST and ToolActions.SHEARS_CARVE can be performed by ShearBehavior
…n which apply the behavior for AOE tools. This definitively stops the consumption of n+1 durability when using the behavior of an AOE tool.
screret
left a comment
There was a problem hiding this comment.
LGTM, excellent solutions IMO, sadly my approval doesn't mean much
What
Fix GT shears so they can be use as the vanilla ones : shear entities, blocks and plants.
Fix at the same time #4534 which in fact affects all AOE tools.
Implementation Details
Added a shear behavior to handle shearing of entities, blocks and plants. It handles shearing of blocks/entities which implement IForgeShearable, beehive/nest, pumpkin and vines/kelp (shearing them stop additionnal growing).
To do that added possibility for a ToolBehavior to perform special action when a living entity is clicked.
Remove shearBlockRoutine in ToolHelper as in my thought shearing a block is performed when right clicking it not breaking it. Replace it by shearBlock which call onSheared from IForgeShearable on the block, drop the shearing results if any but don't destroy the block.
Change condition to consume one tool durability to handle breaking instabreak blocks with shears like grass not consuming shear durability.
Added correct blocks to "mineable_with_shears" block tag as well as textures, recipe and model for shears.
While testing AOE for shear beahavior, fixed #4534 by skipping targeted position in areaOfEffectBlockBreakRoutine as it is already handled by mineBlock of the tool.
Outcome
Fixes GT shears behavior which now act as Vanilla shears and correctly consume durability when shearing or breaking entities/blocks.
Fixes : #4534.
How Was This Tested
Tested by shearing each entities or blocks affected by right click with shears as well as breaking each blocks which have special drops and consume durability when broken with shears.
For #4534 tested each tool with an AOE to see if when their special behaviors are used or when blocks are broken, only the correct amount of durability is consumed.