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

Animations for various tool interactions #1622

Merged
merged 3 commits into from
Jul 30, 2024
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
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
Loading