Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pipe tool click with offhand shield #2065

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/gregtech/api/pipenet/block/BlockPipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ public EnumActionResult onPipeToolUsed(World world, BlockPos pos, ItemStack stac
return EnumActionResult.SUCCESS;
}
entityPlayer.swingArm(hand);
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/gregtech/common/EventHandlers.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import gregtech.api.items.toolitem.ToolClasses;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.pipenet.longdist.LongDistanceNetwork;
import gregtech.api.pipenet.tile.IPipeTile;
import gregtech.api.unification.material.Materials;
import gregtech.api.util.CapesRegistry;
import gregtech.api.util.GTUtility;
Expand Down Expand Up @@ -79,9 +80,14 @@ public static void onEntitySpawn(LivingSpawnEvent.SpecialSpawn event) {

@SubscribeEvent
public static void onPlayerInteractionRightClickBlock(PlayerInteractEvent.RightClickBlock event) {
if (event.getWorld().getTileEntity(event.getPos()) instanceof IGregTechTileEntity) {
// fix sneaking with shields not allowing tool interactions with GT machines
TileEntity tileEntity = event.getWorld().getTileEntity(event.getPos());
if (tileEntity instanceof IGregTechTileEntity) {
event.setUseBlock(Event.Result.ALLOW);
} else if (tileEntity instanceof IPipeTile<?,?>) {
event.setUseBlock(Event.Result.ALLOW);
}

ItemStack stack = event.getItemStack();
if (!stack.isEmpty() && stack.getItem() == Items.FLINT_AND_STEEL) {
if (!event.getWorld().isRemote
Expand Down