Skip to content

Commit

Permalink
fix pipe tool click with offhand shield (#2065)
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 authored and ghzdude committed Oct 25, 2023
1 parent fefdbd5 commit 98e0d1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit 98e0d1c

Please sign in to comment.