Added return after schematic activation to prevent double interaction

This commit is contained in:
Cake 2024-08-12 21:29:57 +01:00 committed by GitHub
parent a92c08b1e1
commit 1d2da07756
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,6 +73,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
return;
activate(context, pos, player, mode);
checkForPlacementAdvancement();
tryDisposeOfExcess(context);
context.stall = player.blockBreakingProgress != null;
}
@ -81,8 +82,10 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
Level world = context.world;
FilterItemStack filter = context.getFilterFromBE();
if (AllItems.SCHEMATIC.isIn(filter.item()))
if (AllItems.SCHEMATIC.isIn(filter.item())) {
activateAsSchematicPrinter(context, pos, player, world, filter.item());
return;
}
Vec3 facingVec = Vec3.atLowerCornerOf(context.state.getValue(DeployerBlock.FACING)
.getNormal());
@ -104,7 +107,9 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
player.placedTracks = false;
DeployerHandler.activate(player, vec, pos, facingVec, mode);
}
protected void checkForPlacementAdvancement() {
if ((context.contraption instanceof MountedContraption || context.contraption instanceof CarriageContraption)
&& player.placedTracks && context.blockEntityData != null && context.blockEntityData.contains("Owner"))
AllAdvancements.SELF_DEPLOYING.awardTo(world.getPlayerByUUID(context.blockEntityData.getUUID("Owner")));