Skip to content

Commit

Permalink
give most tool interactions animation
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungOnionMC committed Jul 29, 2024
1 parent b9acd4e commit 4ff6012
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,20 +391,23 @@ public Pair<GTToolType, InteractionResult> onToolClick(Set<GTToolType> toolTypes
boolean isOpen = this.isConnected(gridSide);
this.setConnection(gridSide, !isOpen, false);
}
playerIn.swing(hand);
return Pair.of(getPipeTuneTool(), InteractionResult.CONSUME);
} else if (toolTypes.contains(GTToolType.CROWBAR)) {
if (coverBehavior != null) {
if (!isRemote()) {
getCoverContainer().removeCover(gridSide, playerIn);
playerIn.swing(hand);
return Pair.of(GTToolType.CROWBAR, InteractionResult.CONSUME);
}
return Pair.of(GTToolType.CROWBAR, InteractionResult.CONSUME);
} else {
if (frameMaterial != null) {
Block.popResource(getLevel(), getPipePos(),
GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, frameMaterial).asStack());
frameMaterial = null;
playerIn.swing(hand);
return Pair.of(GTToolType.CROWBAR, InteractionResult.CONSUME);
}
return Pair.of(GTToolType.CROWBAR, InteractionResult.CONSUME);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand han
if (playerIn instanceof ServerPlayer serverPlayer) {
CoverUIFactory.INSTANCE.openUI(this, serverPlayer);
}
return InteractionResult.SUCCESS;
playerIn.swing(hand);
return InteractionResult.CONSUME;
}
return InteractionResult.PASS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,10 @@ protected InteractionResult onHardHammerClick(Player playerIn, InteractionHand h
if (this instanceof IMufflableMachine mufflableMachine) {
if (!isRemote()) {
mufflableMachine.setMuffled(!mufflableMachine.isMuffled());
playerIn.sendSystemMessage(Component.translatable(mufflableMachine.isMuffled() ?
"gtceu.machine.muffle.on" : "gtceu.machine.muffle.off"));
}

playerIn.swing(hand);
return InteractionResult.CONSUME;
}
return InteractionResult.PASS;
Expand All @@ -366,6 +368,7 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand,
if (!isRemote()) {
setFrontFacing(gridSide);
}
playerIn.swing(hand);
return InteractionResult.CONSUME;
} else {
if (isRemote())
Expand All @@ -387,6 +390,7 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand,
autoOutputFluid.setOutputFacingFluids(gridSide);
}
}
playerIn.swing(hand);
return InteractionResult.CONSUME;
}
}
Expand All @@ -400,6 +404,7 @@ protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand h
playerIn.sendSystemMessage(Component.translatable(controllable.isWorkingEnabled() ?
"behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled"));
}
playerIn.swing(hand);
return InteractionResult.CONSUME;
}
return InteractionResult.PASS;
Expand Down Expand Up @@ -435,6 +440,7 @@ protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand
}
}
if (flag) {
playerIn.swing(hand);
return InteractionResult.SUCCESS;
}
} else {
Expand All @@ -453,6 +459,7 @@ protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand
}
}
if (flag) {
playerIn.swing(hand);
return InteractionResult.SUCCESS;
}
}
Expand Down

0 comments on commit 4ff6012

Please sign in to comment.