Skip to content

Fix GT shears so they behave like vanilla ones and fix #4534#4626

Open
GreenSkiy wants to merge 22 commits intoGregTechCEu:1.20.1from
GreenSkiy:GTShears
Open

Fix GT shears so they behave like vanilla ones and fix #4534#4626
GreenSkiy wants to merge 22 commits intoGregTechCEu:1.20.1from
GreenSkiy:GTShears

Conversation

@GreenSkiy
Copy link

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.

…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.
@GreenSkiy GreenSkiy requested a review from a team as a code owner February 14, 2026 19:11
@screret
Copy link
Contributor

screret commented Feb 14, 2026

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.

That never actually did anything, because blocks can't actually implement IForgeShearable, IIRC that interface even has a TODO about it.

}

@Override
public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also implement this on the other IGTTool implementations.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the early use method (whatever that's called? forgot)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved block shearing to this onItemUseFirst method and added SHEARS_HARVEST + SHEARS_CARVE as action performable by shear behavior

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please undo the indent change

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor

@screret screret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, excellent solutions IMO, sadly my approval doesn't mean much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mining hammer using N+1 durability to mine N blocks

2 participants