From be67a5fd6b261d0c8a9fdd041792d3dcaf6f22f9 Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Mon, 6 May 2024 01:06:26 -0700 Subject: [PATCH] wip: Add other interactions as pipeline transactions --- .editorconfig | 16 + SpongeAPI | 2 +- .../bridge/world/TrackedWorldBridge.java | 5 +- .../event/SpongeCommonEventFactory.java | 4 +- .../transaction/EventByTransaction.java | 27 +- .../context/transaction/GameTransaction.java | 13 + .../context/transaction/TransactionSink.java | 24 +- .../TransactionalCaptureSupplier.java | 23 +- ...actionArgs.java => InteractionAtArgs.java} | 2 +- .../effect/InteractionItemEffect.java | 4 +- .../InteractionUseItemOnBlockEffect.java | 4 +- .../effect/InteractionUseItemOnEffect.java | 40 + .../effect/ProcessingSideEffect.java | 6 +- .../transaction/effect/UseItemArgs.java | 4 +- .../transaction/effect/UseItemAtArgs.java | 41 + ...efreshEffect.java => UseItemAtEffect.java} | 29 +- .../transaction/effect/UseItemEffect.java | 19 +- .../transaction/effect/UseItemOnArgs.java | 15 + .../inventory/CompositeTransaction.java | 46 + .../inventory/InteractItemTransaction.java | 57 +- .../InteractItemWithBlockTransaction.java | 112 ++ .../pipeline/UseBlockPipeline.java | 6 +- .../pipeline/UseItemAtPipeline.java | 100 ++ .../pipeline/UseItemOnBlockPipeline.java | 6 +- .../transaction/pipeline/UseItemPipeline.java | 18 +- .../transaction/type/TransactionTypes.java | 5 +- .../loader/SpongeCommonRegistryLoader.java | 1 + .../core/world/entity/ai/goal/GoalMixin.java | 3 + ...GamePacketListenerImplMixin_Inventory.java | 8 +- .../level/ServerLevelMixin_Tracker.java | 87 +- .../ServerPlayerGameModeMixin_Tracker.java | 13 +- src/mixins/resources/mixins.sponge.api.json | 986 +++++++++--------- .../test/projectile/ProjectileTest.java | 2 +- .../test/volumestream/VolumeStreamTest.java | 2 +- 34 files changed, 1081 insertions(+), 649 deletions(-) create mode 100644 .editorconfig rename src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/{InteractionArgs.java => InteractionAtArgs.java} (98%) create mode 100644 src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionUseItemOnEffect.java create mode 100644 src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemAtArgs.java rename src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/{PlayerContainerRefreshEffect.java => UseItemAtEffect.java} (68%) create mode 100644 src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemOnArgs.java create mode 100644 src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/CompositeTransaction.java create mode 100644 src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/InteractItemWithBlockTransaction.java create mode 100644 src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemAtPipeline.java diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..938ae881bc3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = false +max_line_length = 120 +tab_width = 4 + +[{*.json,*.jsonc,*.png.mcmeta,mcmod.info,pack.mcmeta}] +indent_size = 2 + +[*mixins.*.json] +indent_size = 4 diff --git a/SpongeAPI b/SpongeAPI index 326bc208034..2f0d7e66745 160000 --- a/SpongeAPI +++ b/SpongeAPI @@ -1 +1 @@ -Subproject commit 326bc20803412ccabf63269e7b206065d8e44e26 +Subproject commit 2f0d7e6674512d048c93ebc02cb07f11c78e7082 diff --git a/src/main/java/org/spongepowered/common/bridge/world/TrackedWorldBridge.java b/src/main/java/org/spongepowered/common/bridge/world/TrackedWorldBridge.java index 06670ba5551..49a78bd648f 100644 --- a/src/main/java/org/spongepowered/common/bridge/world/TrackedWorldBridge.java +++ b/src/main/java/org/spongepowered/common/bridge/world/TrackedWorldBridge.java @@ -48,6 +48,7 @@ import org.spongepowered.common.event.tracking.context.transaction.TransactionalCaptureSupplier; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseBlockPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemOnBlockPipeline; +import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemAtPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.WorldPipeline; @@ -123,5 +124,7 @@ public interface TrackedWorldBridge { UseBlockPipeline bridge$startInteractionChange(Level worldIn, ServerPlayer playerIn, InteractionHand handIn, BlockHitResult blockRaytraceResultIn, BlockState blockstate, ItemStack copiedStack); - UseItemPipeline bridge$startItemInteractionChange(Level worldIn, ServerPlayer playerIn, InteractionHand handIn, ItemStack copiedStack, BlockHitResult blockRaytraceResult, boolean creative); + UseItemAtPipeline bridge$startItemInteractionChange(Level worldIn, ServerPlayer playerIn, InteractionHand handIn, ItemStack copiedStack, BlockHitResult blockRaytraceResult, boolean creative); + + UseItemPipeline bridge$startItemInteractionUseChange(Level worldIn, ServerPlayer playerIn, InteractionHand handIn, ItemStack copiedStack); } diff --git a/src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java b/src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java index 8a7cafccb92..d361495e0cb 100644 --- a/src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java +++ b/src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java @@ -302,10 +302,10 @@ public static InteractItemEvent.Primary callInteractItemEventPrimary(final net.m } } - public static InteractItemEvent.Secondary callInteractItemEventSecondary(final net.minecraft.world.entity.player.Player player, final ItemStack stack, final InteractionHand hand) { + public static InteractItemEvent.Secondary.Pre callInteractItemEventSecondary(final net.minecraft.world.entity.player.Player player, final ItemStack stack, final InteractionHand hand) { try (final CauseStackManager.StackFrame frame = PhaseTracker.getCauseStackManager().pushCauseFrame()) { SpongeCommonEventFactory.applyCommonInteractContext(player, stack, hand, null, null, frame); - final InteractItemEvent.Secondary event = SpongeEventFactory.createInteractItemEventSecondary(frame.currentCause(), ItemStackUtil.snapshotOf(stack)); + final var event = SpongeEventFactory.createInteractItemEventSecondaryPre(frame.currentCause(), ItemStackUtil.snapshotOf(stack)); SpongeCommon.post(event); return event; } diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/EventByTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/EventByTransaction.java index 3112366a713..220810b7e02 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/EventByTransaction.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/EventByTransaction.java @@ -32,32 +32,19 @@ import org.spongepowered.api.event.Event; @DefaultQualifier(NonNull.class) -final class EventByTransaction { - - final T event; - final ImmutableList> transactions; - final GameTransaction decider; - final @Nullable GameTransaction<@NonNull ?> parent; - - EventByTransaction(final T event, - final ImmutableList> transactions, - final @Nullable GameTransaction<@NonNull ?> parent, - final GameTransaction decider - ) { - this.parent = parent; - this.event = event; - this.transactions = transactions; - this.decider = decider; - } +public record EventByTransaction( + T event, ImmutableList> transactions, + @Nullable GameTransaction<@NonNull ?> parent, + GameTransaction decider) { public void markCancelled() { - this.decider.markCancelled(); - for (GameTransaction transaction : this.transactions) { + this.decider().markCancelled(); + for (GameTransaction transaction : this.transactions()) { transaction.markCancelled(); } } public boolean isParentOrDeciderCancelled() { - return this.decider.cancelled || (this.parent != null && this.parent.cancelled); + return this.decider().cancelled || (this.parent() != null && this.parent().cancelled); } } diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/GameTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/GameTransaction.java index fd733d01d77..9f4eb4ddbfe 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/GameTransaction.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/GameTransaction.java @@ -46,6 +46,7 @@ import java.util.Optional; import java.util.StringJoiner; import java.util.function.BiConsumer; +import java.util.stream.Stream; @DefaultQualifier(NonNull.class) public abstract class GameTransaction implements TransactionFlow, StatefulTransaction { @@ -189,6 +190,18 @@ protected void captureState() { } + public void associateSideEffectEvents(E e, Stream elements) { + + } + + public void pushCause(CauseStackManager.StackFrame frame, E e) { + frame.pushCause(e); + } + + public void finalizeSideEffects(E e) { + + } + private static class ChildIterator implements Iterator> { private final Iterator> effectIterator; private @Nullable GameTransaction<@NonNull ?> cachedNext; diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/TransactionSink.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/TransactionSink.java index b12eba91265..3e38d0d28f4 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/TransactionSink.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/TransactionSink.java @@ -27,7 +27,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -47,6 +46,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.block.BlockSnapshot; +import org.spongepowered.api.event.block.InteractBlockEvent; import org.spongepowered.api.event.cause.entity.SpawnType; import org.spongepowered.api.item.inventory.Inventory; import org.spongepowered.api.item.inventory.ItemStackSnapshot; @@ -85,6 +85,7 @@ import org.spongepowered.common.event.tracking.context.transaction.inventory.DropFromPlayerInventoryTransaction; import org.spongepowered.common.event.tracking.context.transaction.inventory.ExplicitInventoryOmittedTransaction; import org.spongepowered.common.event.tracking.context.transaction.inventory.InteractItemTransaction; +import org.spongepowered.common.event.tracking.context.transaction.inventory.InteractItemWithBlockTransaction; import org.spongepowered.common.event.tracking.context.transaction.inventory.InventoryTransaction; import org.spongepowered.common.event.tracking.context.transaction.inventory.OpenMenuTransaction; import org.spongepowered.common.event.tracking.context.transaction.inventory.PlaceRecipeTransaction; @@ -419,9 +420,24 @@ default EffectTransactor logInventoryTransaction(final AbstractContainerMenu con } default void logSecondaryInteractionTransaction( - final ServerPlayer playerIn, final ItemStack stackIn, final Vector3d hitVec, - final BlockSnapshot snapshot, final Direction direction, final InteractionHand handIn) { - final InteractItemTransaction transaction = new InteractItemTransaction(playerIn, stackIn, hitVec, snapshot, direction, handIn); + final ServerPlayer playerIn, final Vector3d hitVec, + final BlockSnapshot snapshot, final Direction direction, InteractBlockEvent.Secondary.Pre event) { + final InteractItemWithBlockTransaction transaction = new InteractItemWithBlockTransaction(playerIn, + hitVec, + snapshot, + direction, + event.originalUseBlockResult(), + event.useBlockResult(), + event.originalUseItemResult(), + event.useItemResult() + ); + this.logTransaction(transaction); + } + + default void logSecondaryInteractItemTransaction( + final ServerPlayer playerIn, final ItemStack stackIn + ) { + final InteractItemTransaction transaction = new InteractItemTransaction(playerIn, stackIn); this.logTransaction(transaction); } diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/TransactionalCaptureSupplier.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/TransactionalCaptureSupplier.java index 9a32ad5960b..d5bb7c3cb0b 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/TransactionalCaptureSupplier.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/TransactionalCaptureSupplier.java @@ -175,7 +175,7 @@ public boolean processTransactions(final PhaseContext<@NonNull ?> context) { ); boolean cancelledAny = false; for (final EventByTransaction<@NonNull ?> eventWithTransactions : batched) { - final Event event = eventWithTransactions.event; + final Event event = eventWithTransactions.event(); if (eventWithTransactions.isParentOrDeciderCancelled()) { cancelledAny = true; eventWithTransactions.markCancelled(); @@ -186,12 +186,12 @@ public boolean processTransactions(final PhaseContext<@NonNull ?> context) { eventWithTransactions.markCancelled(); cancelledAny = true; } - if (((GameTransaction) eventWithTransactions.decider).markCancelledTransactions(event, eventWithTransactions.transactions)) { + if (((GameTransaction) eventWithTransactions.decider()).markCancelledTransactions(event, eventWithTransactions.transactions())) { cancelledAny = true; } - for (final GameTransaction<@NonNull ?> transaction : eventWithTransactions.transactions) { + for (final GameTransaction<@NonNull ?> transaction : eventWithTransactions.transactions()) { if (transaction.cancelled) { - ((GameTransaction) transaction).markEventAsCancelledIfNecessary(eventWithTransactions.event); + ((GameTransaction) transaction).markEventAsCancelledIfNecessary(eventWithTransactions.event()); } if (!transaction.cancelled) { ((GameTransaction) transaction).postProcessEvent(context, event); @@ -200,12 +200,12 @@ public boolean processTransactions(final PhaseContext<@NonNull ?> context) { } if (cancelledAny) { for (final EventByTransaction<@NonNull ?> eventByTransaction : batched.reverse()) { - if (eventByTransaction.decider.cancelled) { - ((GameTransaction) eventByTransaction.decider).markEventAsCancelledIfNecessary(eventByTransaction.event); + if (eventByTransaction.decider().cancelled) { + ((GameTransaction) eventByTransaction.decider()).markEventAsCancelledIfNecessary(eventByTransaction.event()); } - for (final GameTransaction<@NonNull ?> gameTransaction : eventByTransaction.transactions.reverse()) { + for (final GameTransaction<@NonNull ?> gameTransaction : eventByTransaction.transactions().reverse()) { if (gameTransaction.cancelled) { - ((GameTransaction) gameTransaction).restore(context, eventByTransaction.event); + ((GameTransaction) gameTransaction).restore(context, eventByTransaction.event()); } } } @@ -311,13 +311,16 @@ private static void generateEventForTransaction( if (transaction.sideEffects == null || transaction.sideEffects.isEmpty()) { continue; } - generatedEvent.ifPresent(frame::pushCause); + generatedEvent.ifPresent(e -> transaction.pushCause(frame, e)); for (final ResultingTransactionBySideEffect sideEffect : transaction.sideEffects) { if (sideEffect.head == null) { continue; } - builder.addAll(TransactionalCaptureSupplier.batchTransactions(sideEffect.head, pointer, context, transactionPostEventBuilder)); + final var elements = TransactionalCaptureSupplier.batchTransactions(sideEffect.head, pointer, context, transactionPostEventBuilder); + generatedEvent.ifPresent(e -> transaction.associateSideEffectEvents(e, elements.stream().map(EventByTransaction::event))); + builder.addAll(elements); } + generatedEvent.ifPresent(transaction::finalizeSideEffects); } } } diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionArgs.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionAtArgs.java similarity index 98% rename from src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionArgs.java rename to src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionAtArgs.java index fac849e78d2..5cd9000fdc3 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionArgs.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionAtArgs.java @@ -31,7 +31,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; -public record InteractionArgs( +public record InteractionAtArgs( Level world, ServerPlayer player, InteractionHand hand, diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionItemEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionItemEffect.java index 8ccfc3a0b4e..57af8e795a9 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionItemEffect.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionItemEffect.java @@ -29,7 +29,7 @@ import org.spongepowered.common.event.tracking.context.transaction.inventory.PlayerInventoryTransaction; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseBlockPipeline; -public final class InteractionItemEffect implements ProcessingSideEffect { +public final class InteractionItemEffect implements ProcessingSideEffect.Simple { private static final class Holder { static final InteractionItemEffect INSTANCE = new InteractionItemEffect(); @@ -41,7 +41,7 @@ public static InteractionItemEffect getInstance() { @Override public EffectResult processSideEffect( - UseBlockPipeline pipeline, InteractionResult oldState, InteractionArgs args + UseBlockPipeline pipeline, InteractionResult oldState, InteractionAtArgs args ) { final var player = args.player(); final var world = args.world(); diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionUseItemOnBlockEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionUseItemOnBlockEffect.java index 71d393a62fe..e0bcef3e8e8 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionUseItemOnBlockEffect.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionUseItemOnBlockEffect.java @@ -29,7 +29,7 @@ import org.spongepowered.common.event.tracking.context.transaction.inventory.PlayerInventoryTransaction; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemOnBlockPipeline; -public final class InteractionUseItemOnBlockEffect implements ProcessingSideEffect { +public final class InteractionUseItemOnBlockEffect implements ProcessingSideEffect { private static final class Holder { static final InteractionUseItemOnBlockEffect INSTANCE = new InteractionUseItemOnBlockEffect(); @@ -41,7 +41,7 @@ public static InteractionUseItemOnBlockEffect getInstance() { @Override public EffectResult processSideEffect( - UseItemOnBlockPipeline pipeline, ItemInteractionResult oldState, InteractionArgs args + UseItemOnBlockPipeline pipeline, ItemInteractionResult oldState, InteractionAtArgs args ) { final var player = args.player(); final var hand = args.hand(); diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionUseItemOnEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionUseItemOnEffect.java new file mode 100644 index 00000000000..388821c1b67 --- /dev/null +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/InteractionUseItemOnEffect.java @@ -0,0 +1,40 @@ +package org.spongepowered.common.event.tracking.context.transaction.effect; + +import net.minecraft.world.InteractionResult; +import org.spongepowered.common.event.tracking.context.transaction.EffectTransactor; +import org.spongepowered.common.event.tracking.context.transaction.inventory.PlayerInventoryTransaction; +import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseBlockPipeline; + +public final class InteractionUseItemOnEffect implements ProcessingSideEffect.Simple { + + private static final class Holder { + static final InteractionUseItemOnEffect INSTANCE = new InteractionUseItemOnEffect(); + } + + public static InteractionUseItemOnEffect getInstance() { + return InteractionUseItemOnEffect.Holder.INSTANCE; + } + + @Override + public EffectResult processSideEffect( + UseBlockPipeline pipeline, InteractionResult oldState, UseItemOnArgs args + ) { + // Run vanilla change + InteractionResult result; + final var stack = args.itemStack(); + if (args.isCreative()) { + var i = stack.getCount(); + result = stack.useOn(args.context()); + stack.setCount(i); + } else { + result = stack.useOn(args.context()); + } + + final var player = args.player(); + pipeline.transactor().logPlayerInventoryChange(player, PlayerInventoryTransaction.EventCreator.STANDARD); + try (EffectTransactor ignored = BroadcastInventoryChangesEffect.transact(pipeline.transactor())) { + player.containerMenu.broadcastChanges(); + } + return new EffectResult<>(result, true); + } +} diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ProcessingSideEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ProcessingSideEffect.java index 6c4a7d1ff09..be0e3f21018 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ProcessingSideEffect.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/ProcessingSideEffect.java @@ -29,8 +29,12 @@ @FunctionalInterface public interface ProcessingSideEffect { + interface Simple extends ProcessingSideEffect { + + } + EffectResult processSideEffect(T pipeline, C oldState, A args); - sealed interface Args permits BlockChangeArgs, InteractionArgs, UseItemArgs {} + sealed interface Args permits BlockChangeArgs, InteractionAtArgs, UseItemOnArgs, UseItemAtArgs, UseItemArgs {} } diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemArgs.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemArgs.java index aebd7497bb2..334c5c2d78c 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemArgs.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemArgs.java @@ -25,6 +25,7 @@ package org.spongepowered.common.event.tracking.context.transaction.effect; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.ServerPlayerGameMode; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -34,8 +35,7 @@ public record UseItemArgs( Level world, ServerPlayer player, InteractionHand hand, - BlockHitResult result, ItemStack copiedStack, - boolean creative + ServerPlayerGameMode gameMode ) implements ProcessingSideEffect.Args { } diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemAtArgs.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemAtArgs.java new file mode 100644 index 00000000000..ab8616303c3 --- /dev/null +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemAtArgs.java @@ -0,0 +1,41 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.spongepowered.common.event.tracking.context.transaction.effect; + +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.BlockHitResult; + +public record UseItemAtArgs( + Level world, + ServerPlayer player, + InteractionHand hand, + BlockHitResult result, + ItemStack copiedStack, + boolean creative +) implements ProcessingSideEffect.Args { +} diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/PlayerContainerRefreshEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemAtEffect.java similarity index 68% rename from src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/PlayerContainerRefreshEffect.java rename to src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemAtEffect.java index a0f81ef9ad0..7e9ae372298 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/PlayerContainerRefreshEffect.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemAtEffect.java @@ -25,28 +25,43 @@ package org.spongepowered.common.event.tracking.context.transaction.effect; import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.context.UseOnContext; import org.spongepowered.common.event.tracking.context.transaction.EffectTransactor; import org.spongepowered.common.event.tracking.context.transaction.inventory.PlayerInventoryTransaction; -import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemOnBlockPipeline; +import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemAtPipeline; -public final class PlayerContainerRefreshEffect implements ProcessingSideEffect { +public class UseItemAtEffect implements ProcessingSideEffect { private static final class Holder { - static final PlayerContainerRefreshEffect INSTANCE = new PlayerContainerRefreshEffect(); + static final UseItemAtEffect INSTANCE = new UseItemAtEffect(); } - public static PlayerContainerRefreshEffect getInstance() { - return Holder.INSTANCE; + private UseItemAtEffect() { + } + + public static UseItemAtEffect getInstance() { + return UseItemAtEffect.Holder.INSTANCE; } @Override public EffectResult processSideEffect( - UseItemOnBlockPipeline pipeline, InteractionResult oldState, InteractionArgs args + UseItemAtPipeline pipeline, InteractionResult oldState, UseItemAtArgs args ) { + final var stack = args.copiedStack(); + final InteractionResult result; + final var context = new UseOnContext(args.player(), args.hand(), args.result()); + if (args.creative()) { + int count = stack.getCount(); + result = stack.useOn(context); + stack.setCount(count); + } else { + result = stack.useOn(context); + } pipeline.transactor().logPlayerInventoryChange(args.player(), PlayerInventoryTransaction.EventCreator.STANDARD); try (EffectTransactor ignored = BroadcastInventoryChangesEffect.transact(pipeline.transactor())) { args.player().containerMenu.broadcastChanges(); } - return EffectResult.nullPass(); + return new EffectResult<>(result, true); } + } diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemEffect.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemEffect.java index 130e414c734..e24dcde34a6 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemEffect.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemEffect.java @@ -24,18 +24,23 @@ */ package org.spongepowered.common.event.tracking.context.transaction.effect; +import net.minecraft.server.level.ServerPlayerGameMode; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.context.UseOnContext; import org.spongepowered.common.event.tracking.context.transaction.EffectTransactor; import org.spongepowered.common.event.tracking.context.transaction.inventory.PlayerInventoryTransaction; +import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemAtPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemPipeline; -public class UseItemEffect implements ProcessingSideEffect { +public class UseItemEffect implements ProcessingSideEffect.Simple { private static final class Holder { static final UseItemEffect INSTANCE = new UseItemEffect(); } + private UseItemEffect() { + } + public static UseItemEffect getInstance() { return UseItemEffect.Holder.INSTANCE; } @@ -44,16 +49,8 @@ public static UseItemEffect getInstance() { public EffectResult processSideEffect( UseItemPipeline pipeline, InteractionResult oldState, UseItemArgs args ) { - final var stack = args.copiedStack(); - final InteractionResult result; - final var context = new UseOnContext(args.player(), args.hand(), args.result()); - if (args.creative()) { - int $$14 = stack.getCount(); - result = stack.useOn(context); - stack.setCount($$14); - } else { - result = stack.useOn(context); - } + final var gameMode = args.gameMode(); + final InteractionResult result = gameMode.useItem(args.player(), args.world(), args.copiedStack(), args.hand()); pipeline.transactor().logPlayerInventoryChange(args.player(), PlayerInventoryTransaction.EventCreator.STANDARD); try (EffectTransactor ignored = BroadcastInventoryChangesEffect.transact(pipeline.transactor())) { args.player().containerMenu.broadcastChanges(); diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemOnArgs.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemOnArgs.java new file mode 100644 index 00000000000..633ed3cc338 --- /dev/null +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/UseItemOnArgs.java @@ -0,0 +1,15 @@ +package org.spongepowered.common.event.tracking.context.transaction.effect; + +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; + +public record UseItemOnArgs( + UseOnContext context, + ItemStack itemStack, + ItemStackSnapshot itemStackSnapshot, + ServerPlayer player, + boolean isCreative +) implements ProcessingSideEffect.Args { +} diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/CompositeTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/CompositeTransaction.java new file mode 100644 index 00000000000..028e06feb5e --- /dev/null +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/CompositeTransaction.java @@ -0,0 +1,46 @@ +package org.spongepowered.common.event.tracking.context.transaction.inventory; + +import com.google.common.collect.ImmutableList; +import org.spongepowered.api.event.Cancellable; +import org.spongepowered.api.event.CauseStackManager; +import org.spongepowered.api.event.CompositeEvent; +import org.spongepowered.api.event.Event; +import org.spongepowered.api.event.block.InteractBlockEvent; +import org.spongepowered.api.event.impl.AbstractCompositeEvent; +import org.spongepowered.api.event.item.inventory.InteractItemEvent; +import org.spongepowered.common.event.tracking.context.transaction.GameTransaction; +import org.spongepowered.common.event.tracking.context.transaction.type.TransactionType; + +import java.util.stream.Stream; + +public abstract class CompositeTransaction extends GameTransaction { + protected CompositeTransaction(TransactionType transactionType) { + super(transactionType); + } + + @Override + public void associateSideEffectEvents(E event, Stream elements) { + elements.forEach(event.children()::add); + } + + @Override + public void finalizeSideEffects(E post) { + // This finalizes the list to be immutable + ((AbstractCompositeEvent) post).postInit(); + } + + public void pushCause(CauseStackManager.StackFrame frame, E e) { + frame.pushCause(e.baseEvent()); + } + + @Override + public boolean markCancelledTransactions( + final E event, + final ImmutableList> gameTransactions) { + event.children().stream().filter(e -> e instanceof Cancellable) + .map(e -> (Cancellable) e) + .forEach(e -> e.setCancelled(event.isCancelled())); + return false; + } + +} diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/InteractItemTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/InteractItemTransaction.java index 3302e01d076..c7e9ba2100e 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/InteractItemTransaction.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/InteractItemTransaction.java @@ -26,50 +26,50 @@ import com.google.common.collect.ImmutableList; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.spongepowered.api.block.BlockSnapshot; +import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cause; import org.spongepowered.api.event.CauseStackManager; -import org.spongepowered.api.event.block.InteractBlockEvent; +import org.spongepowered.api.event.CompositeEvent; +import org.spongepowered.api.event.Event; +import org.spongepowered.api.event.SpongeEventFactory; +import org.spongepowered.api.event.impl.AbstractCompositeEvent; +import org.spongepowered.api.event.item.inventory.InteractItemEvent; import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.Direction; import org.spongepowered.common.event.tracking.PhaseContext; import org.spongepowered.common.event.tracking.context.transaction.GameTransaction; import org.spongepowered.common.event.tracking.context.transaction.type.TransactionTypes; import org.spongepowered.common.item.util.ItemStackUtil; import org.spongepowered.common.util.PrettyPrinter; -import org.spongepowered.math.vector.Vector3d; +import java.util.ArrayList; +import java.util.List; import java.util.Optional; import java.util.function.BiConsumer; +import java.util.stream.Stream; -public class InteractItemTransaction extends GameTransaction { +public class InteractItemTransaction extends CompositeTransaction { - - private final Vector3d hitVec; - private final BlockSnapshot snapshot; - private final Direction direction; - private final InteractionHand hand; + private final ServerPlayer player; private final ItemStackSnapshot stack; - public InteractItemTransaction(ServerPlayer playerIn, ItemStack stackIn, Vector3d hitVec, BlockSnapshot snapshot, Direction direction, InteractionHand handIn) { - super(TransactionTypes.INTERACT_BLOCK_SECONDARY.get()); + public InteractItemTransaction( + final ServerPlayer playerIn, final ItemStack stackIn) { + super(TransactionTypes.INTERACT_ITEM_SECONDARY.get()); + this.player = playerIn; this.stack = ItemStackUtil.snapshotOf(stackIn); - this.hitVec = hitVec; - this.snapshot = snapshot; - this.direction = direction; - this.hand = handIn; - } + } @Override public Optional, CauseStackManager.StackFrame>> getFrameMutator( @Nullable GameTransaction<@NonNull ?> parent ) { - return Optional.empty(); + return Optional.of((context, frame) -> { + frame.pushCause(this.player); + }); } @Override @@ -78,24 +78,23 @@ public void addToPrinter(PrettyPrinter printer) { } @Override - public Optional generateEvent( + public Optional generateEvent( final PhaseContext<@NonNull ?> context, final @Nullable GameTransaction<@NonNull ?> parent, - final ImmutableList> gameTransactions, + final ImmutableList> gameTransactions, final Cause currentCause ) { - return Optional.empty(); + final var root = SpongeEventFactory.createInteractItemEventSecondary(currentCause, this.stack); + final List list = new ArrayList<>(); + final var composite = SpongeEventFactory.createInteractItemEventSecondaryPost(currentCause, root, list); + return Optional.of(composite); } - @Override - public void restore(PhaseContext<@NonNull ?> context, InteractBlockEvent.Secondary.Composite event) { - } @Override - public boolean markCancelledTransactions( - final InteractBlockEvent.Secondary.Composite event, - final ImmutableList> gameTransactions) { - return false; + public void restore(PhaseContext<@NonNull ?> context, InteractItemEvent.Secondary.Post event) { + } + } diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/InteractItemWithBlockTransaction.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/InteractItemWithBlockTransaction.java new file mode 100644 index 00000000000..d49727d6adb --- /dev/null +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/inventory/InteractItemWithBlockTransaction.java @@ -0,0 +1,112 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.spongepowered.common.event.tracking.context.transaction.inventory; + +import com.google.common.collect.ImmutableList; +import net.minecraft.server.level.ServerPlayer; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.spongepowered.api.block.BlockSnapshot; +import org.spongepowered.api.event.Cause; +import org.spongepowered.api.event.CauseStackManager; +import org.spongepowered.api.event.Event; +import org.spongepowered.api.event.SpongeEventFactory; +import org.spongepowered.api.event.block.InteractBlockEvent; +import org.spongepowered.api.util.Direction; +import org.spongepowered.api.util.Tristate; +import org.spongepowered.common.event.tracking.PhaseContext; +import org.spongepowered.common.event.tracking.context.transaction.GameTransaction; +import org.spongepowered.common.event.tracking.context.transaction.type.TransactionTypes; +import org.spongepowered.common.util.PrettyPrinter; +import org.spongepowered.math.vector.Vector3d; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.BiConsumer; + +public class InteractItemWithBlockTransaction extends CompositeTransaction { + + private final Vector3d hitVec; + private final BlockSnapshot snapshot; + private final Direction direction; + private final ServerPlayer player; + private final Tristate originalBlockResult, blockResult, originalItemResult, itemResult; + + public InteractItemWithBlockTransaction( + final ServerPlayer playerIn, final Vector3d hitVec, final BlockSnapshot snapshot, + final Direction direction, + final Tristate originalBlockResult, final Tristate useBlockResult, + final Tristate originalUseItemResult, final Tristate useItemResult) { + super(TransactionTypes.INTERACT_BLOCK_SECONDARY.get()); + this.player = playerIn; + this.hitVec = hitVec; + this.snapshot = snapshot; + this.direction = direction; + this.originalBlockResult = originalBlockResult; + this.blockResult = useBlockResult; + this.originalItemResult = originalUseItemResult; + this.itemResult = useItemResult; + } + + + @Override + public Optional, CauseStackManager.StackFrame>> getFrameMutator( + @Nullable GameTransaction<@NonNull ?> parent + ) { + return Optional.of((context, frame) -> { + frame.pushCause(this.player); + }); + } + + @Override + public void addToPrinter(PrettyPrinter printer) { + + } + + @Override + public Optional generateEvent( + final PhaseContext<@NonNull ?> context, + final @Nullable GameTransaction<@NonNull ?> parent, + final ImmutableList> gameTransactions, + final Cause currentCause + ) { + final var root = SpongeEventFactory.createInteractBlockEventSecondary(currentCause, + this.originalBlockResult, this.blockResult, + this.originalItemResult, this.itemResult, + this.snapshot, this.hitVec, + this.direction + ); + final List list = new ArrayList<>(); + final InteractBlockEvent.Secondary.Post composite = SpongeEventFactory.createInteractBlockEventSecondaryPost(currentCause, root, list); + return Optional.of(composite); + } + + @Override + public void restore(PhaseContext<@NonNull ?> context, InteractBlockEvent.Secondary.Post event) { + + } + +} diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseBlockPipeline.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseBlockPipeline.java index 4203d6474ad..f543af72bd6 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseBlockPipeline.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseBlockPipeline.java @@ -37,7 +37,7 @@ import org.spongepowered.common.event.tracking.context.transaction.ResultingTransactionBySideEffect; import org.spongepowered.common.event.tracking.context.transaction.TransactionalCaptureSupplier; import org.spongepowered.common.event.tracking.context.transaction.effect.EffectResult; -import org.spongepowered.common.event.tracking.context.transaction.effect.InteractionArgs; +import org.spongepowered.common.event.tracking.context.transaction.effect.InteractionAtArgs; import org.spongepowered.common.event.tracking.context.transaction.effect.InteractionItemEffect; import java.util.List; @@ -51,7 +51,7 @@ public class UseBlockPipeline { private final BlockHitResult blockRaytraceResult; private final BlockState blockstate; private final ItemStack copiedStack; - private final List> effects; + private final List> effects; private final TransactionalCaptureSupplier transactor; @@ -79,7 +79,7 @@ public InteractionResult processInteraction(PhaseContext context) { var interaction = InteractionResult.PASS; for (final var effect : this.effects) { try (final EffectTransactor ignored = context.getTransactor().pushEffect(effect)) { - final InteractionArgs args = new InteractionArgs(this.worldIn, this.player, this.hand, this.blockRaytraceResult, this.blockstate, this.copiedStack); + final InteractionAtArgs args = new InteractionAtArgs(this.worldIn, this.player, this.hand, this.blockRaytraceResult, this.blockstate, this.copiedStack); final EffectResult result = effect.effect.processSideEffect( this, interaction, diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemAtPipeline.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemAtPipeline.java new file mode 100644 index 00000000000..2f2c5f16b17 --- /dev/null +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemAtPipeline.java @@ -0,0 +1,100 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.spongepowered.common.event.tracking.context.transaction.pipeline; + +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.BlockHitResult; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.spongepowered.common.event.tracking.PhaseContext; +import org.spongepowered.common.event.tracking.context.transaction.EffectTransactor; +import org.spongepowered.common.event.tracking.context.transaction.ResultingTransactionBySideEffect; +import org.spongepowered.common.event.tracking.context.transaction.TransactionalCaptureSupplier; +import org.spongepowered.common.event.tracking.context.transaction.effect.EffectResult; +import org.spongepowered.common.event.tracking.context.transaction.effect.UseItemAtArgs; +import org.spongepowered.common.event.tracking.context.transaction.effect.UseItemAtEffect; + +import java.util.List; +import java.util.Objects; + +public class UseItemAtPipeline { + + private final ServerLevel worldIn; + private final ServerPlayer player; + private final InteractionHand hand; + private final ItemStack copiedStack; + private final BlockHitResult blockRaytraceResult; + private final boolean creative; + private final List> effects; + private final TransactionalCaptureSupplier transactor; + + + public UseItemAtPipeline(ServerLevel worldIn, + ServerPlayer playerIn, + InteractionHand handIn, + ItemStack copiedStack, + BlockHitResult blockRaytraceResult, + boolean creative, + final TransactionalCaptureSupplier transactor) { + + this.worldIn = worldIn; + this.player = playerIn; + this.hand = handIn; + this.copiedStack = copiedStack; + this.blockRaytraceResult = blockRaytraceResult; + this.creative = creative; + this.effects = List.of( + new ResultingTransactionBySideEffect<>(UseItemAtEffect.getInstance()) + ); + this.transactor = transactor; + } + + public InteractionResult processInteraction(PhaseContext context) { + var interaction = InteractionResult.PASS; + for (final var effect : this.effects) { + try (final EffectTransactor ignored = context.getTransactor().pushEffect(effect)) { + final var args = new UseItemAtArgs(this.worldIn, this.player, this.hand, this.blockRaytraceResult, this.copiedStack, this.creative); + final EffectResult result = effect.effect.processSideEffect( + this, + interaction, + args + ); + if (result.hasResult) { + final @Nullable InteractionResult resultingState = result.resultingState; + interaction = Objects.requireNonNullElse(resultingState, interaction); + } + } + } + return interaction; + } + + public TransactionalCaptureSupplier transactor() { + return this.transactor; + } + +} diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemOnBlockPipeline.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemOnBlockPipeline.java index 82ba980892b..c24001d5719 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemOnBlockPipeline.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemOnBlockPipeline.java @@ -37,7 +37,7 @@ import org.spongepowered.common.event.tracking.context.transaction.ResultingTransactionBySideEffect; import org.spongepowered.common.event.tracking.context.transaction.TransactionalCaptureSupplier; import org.spongepowered.common.event.tracking.context.transaction.effect.EffectResult; -import org.spongepowered.common.event.tracking.context.transaction.effect.InteractionArgs; +import org.spongepowered.common.event.tracking.context.transaction.effect.InteractionAtArgs; import org.spongepowered.common.event.tracking.context.transaction.effect.InteractionUseItemOnBlockEffect; import java.util.List; @@ -51,7 +51,7 @@ public final class UseItemOnBlockPipeline { private final BlockHitResult blockRaytraceResult; private final BlockState blockstate; private final ItemStack copiedStack; - private final List> effects; + private final List> effects; private final TransactionalCaptureSupplier transactor; @@ -79,7 +79,7 @@ public ItemInteractionResult processInteraction(PhaseContext context) { var interaction = ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; for (final var effect : this.effects) { try (final EffectTransactor ignored = context.getTransactor().pushEffect(effect)) { - final InteractionArgs args = new InteractionArgs(this.worldIn, this.player, this.hand, this.blockRaytraceResult, this.blockstate, this.copiedStack); + final InteractionAtArgs args = new InteractionAtArgs(this.worldIn, this.player, this.hand, this.blockRaytraceResult, this.blockstate, this.copiedStack); final EffectResult result = effect.effect.processSideEffect( this, interaction, diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemPipeline.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemPipeline.java index ce4fbd53238..f2f315e91a7 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemPipeline.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/pipeline/UseItemPipeline.java @@ -29,7 +29,6 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.phys.BlockHitResult; import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.common.event.tracking.PhaseContext; import org.spongepowered.common.event.tracking.context.transaction.EffectTransactor; @@ -48,26 +47,19 @@ public class UseItemPipeline { private final ServerPlayer player; private final InteractionHand hand; private final ItemStack copiedStack; - private final BlockHitResult blockRaytraceResult; - private final boolean creative; private final List> effects; private final TransactionalCaptureSupplier transactor; - public UseItemPipeline(ServerLevel worldIn, - ServerPlayer playerIn, - InteractionHand handIn, - ItemStack copiedStack, - BlockHitResult blockRaytraceResult, - boolean creative, - final TransactionalCaptureSupplier transactor) { + ServerPlayer playerIn, + InteractionHand handIn, + ItemStack copiedStack, + final TransactionalCaptureSupplier transactor) { this.worldIn = worldIn; this.player = playerIn; this.hand = handIn; this.copiedStack = copiedStack; - this.blockRaytraceResult = blockRaytraceResult; - this.creative = creative; this.effects = List.of( new ResultingTransactionBySideEffect<>(UseItemEffect.getInstance()) ); @@ -78,7 +70,7 @@ public InteractionResult processInteraction(PhaseContext context) { var interaction = InteractionResult.PASS; for (final var effect : this.effects) { try (final EffectTransactor ignored = context.getTransactor().pushEffect(effect)) { - final var args = new UseItemArgs(this.worldIn, this.player, this.hand, this.blockRaytraceResult, this.copiedStack, this.creative); + final var args = new UseItemArgs(this.worldIn, this.player, this.hand,this.copiedStack, this.player.gameMode); final EffectResult result = effect.effect.processSideEffect( this, interaction, diff --git a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/type/TransactionTypes.java b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/type/TransactionTypes.java index 83bb4d3ceb8..845734a54d3 100644 --- a/src/main/java/org/spongepowered/common/event/tracking/context/transaction/type/TransactionTypes.java +++ b/src/main/java/org/spongepowered/common/event/tracking/context/transaction/type/TransactionTypes.java @@ -27,6 +27,7 @@ import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; import org.spongepowered.api.event.Cancellable; +import org.spongepowered.api.event.CompositeEvent; import org.spongepowered.api.event.Event; import org.spongepowered.api.event.block.ChangeBlockEvent; import org.spongepowered.api.event.block.InteractBlockEvent; @@ -35,6 +36,7 @@ import org.spongepowered.api.event.entity.SpawnEntityEvent; import org.spongepowered.api.event.item.inventory.AffectSlotEvent; import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; +import org.spongepowered.api.event.item.inventory.InteractItemEvent; import org.spongepowered.api.event.item.inventory.container.ClickContainerEvent; import org.spongepowered.api.event.item.inventory.container.InteractContainerEvent; import org.spongepowered.api.registry.DefaultedRegistryReference; @@ -66,7 +68,8 @@ public final class TransactionTypes { public static final DefaultedRegistryReference> CHANGE_INVENTORY_EVENT = TransactionTypes.key(ResourceKey.sponge("change_inventory")); public static final DefaultedRegistryReference> SLOT_CHANGE = TransactionTypes.key(ResourceKey.sponge("slot_change")); - public static final DefaultedRegistryReference> INTERACT_BLOCK_SECONDARY = TransactionTypes.key(ResourceKey.sponge("interact_block_secondary")); + public static final DefaultedRegistryReference> INTERACT_BLOCK_SECONDARY = TransactionTypes.key(ResourceKey.sponge("interact_block_secondary")); + public static final DefaultedRegistryReference> INTERACT_ITEM_SECONDARY = TransactionTypes.key(ResourceKey.sponge("interact_block_secondary")); // SORTFIELDS:OFF diff --git a/src/main/java/org/spongepowered/common/registry/loader/SpongeCommonRegistryLoader.java b/src/main/java/org/spongepowered/common/registry/loader/SpongeCommonRegistryLoader.java index 879cadfed56..807d9ae15e4 100644 --- a/src/main/java/org/spongepowered/common/registry/loader/SpongeCommonRegistryLoader.java +++ b/src/main/java/org/spongepowered/common/registry/loader/SpongeCommonRegistryLoader.java @@ -47,6 +47,7 @@ public class SpongeCommonRegistryLoader { l.add(TransactionTypes.SPAWN_ENTITY, k -> new NoOpTransactionType<>(false, k.value().toUpperCase(Locale.ROOT))); l.add(TransactionTypes.CHANGE_INVENTORY_EVENT, k -> new NoOpTransactionType<>(false, k.value().toUpperCase(Locale.ROOT))); l.add(TransactionTypes.SLOT_CHANGE, k -> new NoOpTransactionType<>(false, k.value().toUpperCase(Locale.ROOT))); + l.add(TransactionTypes.INTERACT_BLOCK_SECONDARY, k -> new NoOpTransactionType<>(false, k.value().toUpperCase(Locale.ROOT))); l.add(TransactionTypes.INTERACT_CONTAINER_EVENT, k -> new NoOpTransactionType<>(false, k.value().toUpperCase(Locale.ROOT))); }); } diff --git a/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/ai/goal/GoalMixin.java b/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/ai/goal/GoalMixin.java index ab09ccf8e03..48052fae4f1 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/ai/goal/GoalMixin.java +++ b/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/ai/goal/GoalMixin.java @@ -29,6 +29,7 @@ import org.spongepowered.api.entity.ai.goal.GoalExecutor; import org.spongepowered.api.entity.ai.goal.GoalType; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -42,6 +43,8 @@ @Mixin(Goal.class) public abstract class GoalMixin implements GoalBridge { + @Shadow protected abstract int shadow$adjustedTickDelay(int $$0); + private Supplier impl$type; private GoalExecutor impl$owner; diff --git a/src/mixins/java/org/spongepowered/common/mixin/inventory/event/server/network/ServerGamePacketListenerImplMixin_Inventory.java b/src/mixins/java/org/spongepowered/common/mixin/inventory/event/server/network/ServerGamePacketListenerImplMixin_Inventory.java index c95c646d4f6..997b1d041e6 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/inventory/event/server/network/ServerGamePacketListenerImplMixin_Inventory.java +++ b/src/mixins/java/org/spongepowered/common/mixin/inventory/event/server/network/ServerGamePacketListenerImplMixin_Inventory.java @@ -49,6 +49,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Slice; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.common.bridge.world.TrackedWorldBridge; import org.spongepowered.common.bridge.world.inventory.container.MenuBridge; import org.spongepowered.common.event.tracking.PhaseContext; import org.spongepowered.common.event.tracking.PhaseTracker; @@ -123,11 +124,10 @@ public class ServerGamePacketListenerImplMixin_Inventory { final PhaseContext<@NonNull ?> context = PhaseTracker.SERVER.getPhaseContext(); final TransactionalCaptureSupplier transactor = context.getTransactor(); try (final EffectTransactor ignored = transactor.logPlayerInventoryChangeWithEffect(this.player, PlayerInventoryTransaction.EventCreator.STANDARD)) { - final InteractionResult result = serverPlayerGameMode.useItem(param0, param1, param2, param3); - this.player.inventoryMenu.broadcastChanges(); // capture - return result; + transactor.logSecondaryInteractItemTransaction(param0, param2); + final var pipeline = ((TrackedWorldBridge) param1).bridge$startItemInteractionUseChange(param1, param0, param3, param2); + return pipeline.processInteraction(context); } - // TrackingUtil.processBlockCaptures called by UseItemPacketState } @Redirect(method = "handleContainerClose", diff --git a/src/mixins/java/org/spongepowered/common/mixin/tracker/server/level/ServerLevelMixin_Tracker.java b/src/mixins/java/org/spongepowered/common/mixin/tracker/server/level/ServerLevelMixin_Tracker.java index 5581599d2ac..47fce7e7188 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/tracker/server/level/ServerLevelMixin_Tracker.java +++ b/src/mixins/java/org/spongepowered/common/mixin/tracker/server/level/ServerLevelMixin_Tracker.java @@ -113,6 +113,7 @@ import org.spongepowered.common.event.tracking.context.transaction.pipeline.TileEntityPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseBlockPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemOnBlockPipeline; +import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemAtPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.UseItemPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.WorldPipeline; import org.spongepowered.common.event.tracking.phase.tick.TickPhase; @@ -136,19 +137,21 @@ public abstract class ServerLevelMixin_Tracker extends LevelMixin_Tracker implements TrackedWorldBridge { // @formatting:off - @Shadow @Final List players; + @Shadow + @Final + List players; // @formatting:on @Redirect( - // This normally would target this.entityTickList.forEach((var2x) -> - // but we don't have lambda syntax support yet. - method = "lambda$tick$2", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/server/level/ServerLevel;guardEntityTick(Ljava/util/function/Consumer;Lnet/minecraft/world/entity/Entity;)V") + // This normally would target this.entityTickList.forEach((var2x) -> + // but we don't have lambda syntax support yet. + method = "lambda$tick$2", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/server/level/ServerLevel;guardEntityTick(Ljava/util/function/Consumer;Lnet/minecraft/world/entity/Entity;)V") ) private void tracker$wrapNormalEntityTick(final ServerLevel level, final Consumer entityUpdateConsumer, - final Entity entity + final Entity entity ) { final PhaseContext<@NonNull ?> currentState = PhaseTracker.SERVER.getPhaseContext(); TrackingUtil.tickEntity(entityUpdateConsumer, entity); @@ -167,9 +170,9 @@ public abstract class ServerLevelMixin_Tracker extends LevelMixin_Tracker implem * or we wrap in this method here. * * @param blockState The block state being ticked - * @param worldIn The world (this world) - * @param posIn The position of the block - * @param randomIn The world random + * @param worldIn The world (this world) + * @param posIn The position of the block + * @param randomIn The world random * @author gabizou - January 11th, 2020 - Minecraft 1.14.3 */ @Redirect(method = "tickBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V", @@ -187,11 +190,11 @@ public abstract class ServerLevelMixin_Tracker extends LevelMixin_Tracker implem } private ScheduledTick tracker$createTick(final BlockPos pos, final T type, final int triggerTick, final TickPriority priority) { - return new ScheduledTick<>(type, pos, this.getLevelData().getGameTime() + (long)triggerTick, priority, this.nextSubTickCount()); + return new ScheduledTick<>(type, pos, this.getLevelData().getGameTime() + (long) triggerTick, priority, this.nextSubTickCount()); } private ScheduledTick tracker$createTick(final BlockPos pos, final T type, final int triggerTick) { - return new ScheduledTick<>(type, pos, this.getLevelData().getGameTime() + (long)triggerTick, this.nextSubTickCount()); + return new ScheduledTick<>(type, pos, this.getLevelData().getGameTime() + (long) triggerTick, this.nextSubTickCount()); } @Override @@ -351,16 +354,16 @@ public void scheduleTick(final BlockPos pos, final Fluid fluid, final int trigge @SuppressWarnings({"unchecked", "rawtypes"}) @Override public Explosion tracker$triggerInternalExplosion(org.spongepowered.api.world.explosion.Explosion explosion, - final Function> contextCreator) { + final Function> contextCreator) { // Sponge start final Explosion originalExplosion = (Explosion) explosion; if (ShouldFire.EXPLOSION_EVENT_PRE) { // Set up the pre event final ExplosionEvent.Pre - event = - SpongeEventFactory.createExplosionEventPre( - PhaseTracker.SERVER.currentCause(), - explosion, ((org.spongepowered.api.world.server.ServerWorld) this)); + event = + SpongeEventFactory.createExplosionEventPre( + PhaseTracker.SERVER.currentCause(), + explosion, ((org.spongepowered.api.world.server.ServerWorld) this)); if (SpongeCommon.post(event)) { return (Explosion) explosion; } @@ -466,11 +469,11 @@ public void scheduleTick(final BlockPos pos, final Fluid fluid, final int trigge final ChunkPipeline chunkPipeline = mixinChunk.bridge$createChunkPipeline(pos, newState, currentState, spongeFlag, limit); final WorldPipeline.Builder worldPipelineBuilder = WorldPipeline.builder(chunkPipeline); worldPipelineBuilder.addEffect((pipeline, oldState, args) -> { - if (oldState == null) { - return EffectResult.nullReturn(); - } - return EffectResult.nullPass(); - }) + if (oldState == null) { + return EffectResult.nullReturn(); + } + return EffectResult.nullPass(); + }) .addEffect(UpdateLightSideEffect.getInstance()) .addEffect(CheckBlockPostPlacementIsSameEffect.getInstance()) .addEffect(UpdateWorldRendererEffect.getInstance()) @@ -560,7 +563,7 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable @Override public SpongeBlockSnapshot bridge$createSnapshot(final net.minecraft.world.level.block.state.BlockState state, final BlockPos pos, - final BlockChangeFlag updateFlag + final BlockChangeFlag updateFlag ) { final SpongeBlockSnapshot.BuilderImpl builder = SpongeBlockSnapshot.BuilderImpl.pooled(); builder.reset(); @@ -608,7 +611,7 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable if (instance.getSidedThread() != PhaseTracker.SERVER.getSidedThread() && instance != PhaseTracker.SERVER) { throw new UnsupportedOperationException("Cannot perform a tracked Block Change on a ServerWorld while not on the main thread!"); } - final var pipeline = new UseItemOnBlockPipeline( + return new UseItemOnBlockPipeline( (ServerLevel) worldIn, playerIn, handIn, @@ -617,9 +620,9 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable copiedStack, instance.getPhaseContext().getTransactor() ); - return pipeline; } + @Override public UseBlockPipeline bridge$startInteractionChange(net.minecraft.world.level.Level worldIn, ServerPlayer playerIn, InteractionHand handIn, BlockHitResult blockRaytraceResultIn, BlockState blockstate, ItemStack copiedStack) { if (this.shadow$isDebug()) { // isClientSide is always false since this is WorldServer @@ -633,7 +636,7 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable if (instance.getSidedThread() != PhaseTracker.SERVER.getSidedThread() && instance != PhaseTracker.SERVER) { throw new UnsupportedOperationException("Cannot perform a tracked Block Change on a ServerWorld while not on the main thread!"); } - final var pipeline = new UseBlockPipeline( + return new UseBlockPipeline( (ServerLevel) worldIn, playerIn, handIn, @@ -642,10 +645,9 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable copiedStack, instance.getPhaseContext().getTransactor() ); - return pipeline; } @Override - public UseItemPipeline bridge$startItemInteractionChange(net.minecraft.world.level.Level worldIn, ServerPlayer playerIn, InteractionHand handIn, ItemStack copiedStack, BlockHitResult blockRaytraceResult, boolean creative) { + public UseItemAtPipeline bridge$startItemInteractionChange(net.minecraft.world.level.Level worldIn, ServerPlayer playerIn, InteractionHand handIn, ItemStack copiedStack, BlockHitResult blockRaytraceResult, boolean creative) { if (this.shadow$isDebug()) { // isClientSide is always false since this is WorldServer return null; } @@ -657,7 +659,7 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable if (instance.getSidedThread() != PhaseTracker.SERVER.getSidedThread() && instance != PhaseTracker.SERVER) { throw new UnsupportedOperationException("Cannot perform a tracked Block Change on a ServerWorld while not on the main thread!"); } - return new UseItemPipeline( + return new UseItemAtPipeline( (ServerLevel) worldIn, playerIn, handIn, @@ -668,6 +670,27 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable ); } + public UseItemPipeline bridge$startItemInteractionUseChange(net.minecraft.world.level.Level worldIn, ServerPlayer playerIn, InteractionHand handIn, ItemStack copiedStack) { + if (this.shadow$isDebug()) { // isClientSide is always false since this is WorldServer + return null; + } + if (this.bridge$isFake()) { + return null; + } + + final var instance = PhaseTracker.getInstance(); + if (instance.getSidedThread() != PhaseTracker.SERVER.getSidedThread() && instance != PhaseTracker.SERVER) { + throw new UnsupportedOperationException("Cannot perform a tracked Block Change on a ServerWorld while not on the main thread!"); + } + return new UseItemPipeline( + (ServerLevel) worldIn, + playerIn, + handIn, + copiedStack, + instance.getPhaseContext().getTransactor() + ); + } + /** * Technically an overwrite, but because this is simply an override, we can * effectively do as we need to, which is determine if we are performing @@ -711,7 +734,7 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable final TileEntityPipeline pipeline = TileEntityPipeline.kickOff((ServerLevel) (Object) this, immutable) .addEffect(RemoveTileEntityFromChunkEffect.getInstance()) .build(); - pipeline.processEffects(current, new PipelineCursor(tileentity.getBlockState(), 0,immutable, tileentity, (Entity) null, Constants.World.DEFAULT_BLOCK_CHANGE_LIMIT)); + pipeline.processEffects(current, new PipelineCursor(tileentity.getBlockState(), 0, immutable, tileentity, (Entity) null, Constants.World.DEFAULT_BLOCK_CHANGE_LIMIT)); return; } super.shadow$removeBlockEntity(immutable); @@ -742,7 +765,7 @@ public boolean destroyBlock(final BlockPos pos, final boolean doDrops, @Nullable final TileEntityPipeline pipeline = TileEntityPipeline.kickOff((ServerLevel) (Object) this, immutable) .addEffect(SetAndRegisterBlockEntityToLevelChunk.getInstance()) .build(); - pipeline.processEffects(current, new PipelineCursor(proposed.getBlockState(), 0,immutable, proposed, (Entity) null, Constants.World.DEFAULT_BLOCK_CHANGE_LIMIT)); + pipeline.processEffects(current, new PipelineCursor(proposed.getBlockState(), 0, immutable, proposed, (Entity) null, Constants.World.DEFAULT_BLOCK_CHANGE_LIMIT)); return; } } diff --git a/src/mixins/java/org/spongepowered/common/mixin/tracker/server/level/ServerPlayerGameModeMixin_Tracker.java b/src/mixins/java/org/spongepowered/common/mixin/tracker/server/level/ServerPlayerGameModeMixin_Tracker.java index 30036cf280f..b966314fc93 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/tracker/server/level/ServerPlayerGameModeMixin_Tracker.java +++ b/src/mixins/java/org/spongepowered/common/mixin/tracker/server/level/ServerPlayerGameModeMixin_Tracker.java @@ -41,7 +41,6 @@ import org.spongepowered.api.block.BlockSnapshot; import org.spongepowered.api.event.CauseStackManager; import org.spongepowered.api.event.EventContextKeys; -import org.spongepowered.api.event.block.InteractBlockEvent; import org.spongepowered.api.event.item.inventory.InteractItemEvent; import org.spongepowered.api.util.Tristate; import org.spongepowered.api.world.server.ServerLocation; @@ -80,7 +79,7 @@ public abstract class ServerPlayerGameModeMixin_Tracker { public void impl$callInteractItemSecondary(final ServerPlayer player, final Level level, final ItemStack stack, final InteractionHand hand, final CallbackInfoReturnable cir ) { - final InteractItemEvent.Secondary event = SpongeCommonEventFactory.callInteractItemEventSecondary(player, stack, hand); + final InteractItemEvent.Secondary.Pre event = SpongeCommonEventFactory.callInteractItemEventSecondary(player, stack, hand); if (event.isCancelled()) { player.inventoryMenu.sendAllDataToRemote(); cir.setReturnValue(InteractionResult.FAIL); @@ -98,12 +97,16 @@ public InteractionResult useItemOn(final ServerPlayer playerIn, final Level worl // Sponge start final BlockSnapshot snapshot = ((ServerWorld) (worldIn)).createSnapshot(VecHelper.toVector3i(blockpos)); final Vector3d hitVec = Vector3d.from(blockRaytraceResultIn.getBlockPos().getX(), blockRaytraceResultIn.getBlockPos().getY(), blockRaytraceResultIn.getBlockPos().getZ()); - final org.spongepowered.api.util.Direction direction = DirectionFacingProvider.INSTANCE.getKey(blockRaytraceResultIn.getDirection()).get(); + final var direction = DirectionFacingProvider.INSTANCE.getKey(blockRaytraceResultIn.getDirection()).get(); final PhaseContext phaseContext = PhaseTracker.getInstance().getPhaseContext(); - phaseContext.getTransactor().logSecondaryInteractionTransaction(playerIn, stackIn, hitVec, snapshot, direction, handIn); - final InteractBlockEvent.Secondary.Pre event = SpongeCommonEventFactory.callInteractBlockEventSecondary(playerIn, stackIn, hitVec, snapshot, direction, handIn); + final var event = SpongeCommonEventFactory.callInteractBlockEventSecondary(playerIn, stackIn, hitVec, snapshot, direction, handIn); final Tristate useItem = event.useItemResult(); final Tristate useBlock = event.useBlockResult(); + phaseContext.getTransactor().logSecondaryInteractionTransaction(playerIn, + hitVec, + snapshot, + direction, + event); ((ServerPlayerGameModeBridge) this).bridge$setInteractBlockRightClickCancelled(event.isCancelled()); if (event.isCancelled()) { player.inventoryMenu.sendAllDataToRemote(); diff --git a/src/mixins/resources/mixins.sponge.api.json b/src/mixins/resources/mixins.sponge.api.json index 23fed4650a4..72627fa6f6d 100644 --- a/src/mixins/resources/mixins.sponge.api.json +++ b/src/mixins/resources/mixins.sponge.api.json @@ -1,495 +1,495 @@ { - "required": true, - "parent": "mixins.sponge.parent.json", - "package": "org.spongepowered.common.mixin.api", - "mixinPriority": 1100, - "mixins": [ - "common.entity.living.HumanEntityMixin_API", - "data.DataHolderMixin_API", - "data.persistence.DataContainerMixin_API", - "entity.ai.goal.AbstractGoalMixin_API", - "item.merchant.MerchantMixin_API", - "minecraft.advancements.AdvancementMixin_API", - "minecraft.advancements.AdvancementNodeMixin_API", - "minecraft.advancements.AdvancementProgressMixin_API", - "minecraft.advancements.AdvancementTypeMixin_API", - "minecraft.advancements.CriterionMixin_API", - "minecraft.advancements.CriterionProgressMixin_API", - "minecraft.advancements.CriterionTriggerInstanceMixin_API", - "minecraft.advancements.CriterionTriggerMixin_API", - "minecraft.advancements.DisplayInfoMixin_API", - "minecraft.block.AbstractBlockMixin_API", - "minecraft.block.BlockMixin_API", - "minecraft.block.BlockSoundGroupMixin_API", - "minecraft.commands.CommandSourceStackMixin_API", - "minecraft.commands.arguments.selector.EntitySelectorMixin_API", - "minecraft.commands.arguments.selector.EntitySelectorParserMixin_API", - "minecraft.commands.synchronization.SuggestionProviders_WrapperMixin_API", - "minecraft.core.MappedRegistryMixin_API", - "minecraft.core.particles.ParticleTypeMixin_API", - "minecraft.entity.boss.WitherEntityMixin_API", - "minecraft.item.BlockItemMixin_API", - "minecraft.map.MapDecorationMixin_API", - "minecraft.map.MapDecorationTypeMixin_API", - "minecraft.map.MapInfoMixin_API", - "minecraft.network.FriendlyByteBufMixin_API", - "minecraft.network.chat.ChatTypeMixin_API", - "minecraft.network.chat.ChatTypeMixin_API$BoundMixin_API", - "minecraft.network.chat.MessageSignatureMixin_API", - "minecraft.network.chat.NumberFormatMixin_API", - "minecraft.network.protocol.status.ServerStatus_FaviconMixin_API", - "minecraft.network.protocol.status.ServerStatus_PlayersMixin_API", - "minecraft.network.protocol.status.ServerStatus_VersionMixin_API", - "minecraft.network.protocol.status.ServerStatusMixin_API", - "minecraft.resources.ResourceLocationMixin_API", - "minecraft.server.MinecraftServerMixin_API", - "minecraft.server.ServerScoreboardMixin_API", - "minecraft.server.level.ChunkMapMixin_API", - "minecraft.server.level.ServerLevelMixin_API", - "minecraft.server.level.ServerPlayerMixin_API", - "minecraft.server.level.TicketMixin_API", - "minecraft.server.level.TicketTypeMixin_API", - "minecraft.server.level.WorldGenRegionMixin_API", - "minecraft.server.network.MemoryServerHandshakePacketListenerImplMixin_API", - "minecraft.server.network.ServerCommonPacketListenerImplMixin_API", - "minecraft.server.network.ServerConfigurationPacketListenerImplMixin_API", - "minecraft.server.network.ServerGamePacketListenerImplMixin_API", - "minecraft.server.network.ServerHandshakePacketListenerImplMixin_API", - "minecraft.server.network.ServerLoginPacketListenerImplMixin_API", - "minecraft.server.packs.PackResourcesMixin_API", - "minecraft.server.packs.PackTypeMixin_API", - "minecraft.server.packs.repository.PackCompatibilityMixin_API", - "minecraft.server.packs.repository.PackMixin_API", - "minecraft.server.packs.repository.PackRepositoryMixin_API", - "minecraft.server.packs.resources.ResourceManagerMixin_API", - "minecraft.server.players.BanListEntryMixin_API", - "minecraft.server.players.GameProfileCacheMixin_API", - "minecraft.server.players.IpBanListEntryMixin_API", - "minecraft.server.players.StoredUserEntryMixin_API", - "minecraft.server.players.UserBanListEntryMixin_API", - "minecraft.server.rcon.RconConsoleSourceMixin_API", - "minecraft.server.rcon.thread.RconClientMixin_API", - "minecraft.sounds.MusicMixin_API", - "minecraft.sounds.SoundEventMixin_API", - "minecraft.state.BooleanPropertyMixin_API", - "minecraft.state.EnumPropertyMixin_API", - "minecraft.state.IntegerPropertyMixin_API", - "minecraft.state.PropertyMixin_API", - "minecraft.stats.StatMixin_API", - "minecraft.stats.StatTypeMixin_API", - "minecraft.tags.TagKeyMixin_API", - "minecraft.util.RandomSourceMixin_API", - "minecraft.util.StringRepresentableMixin_API", - "minecraft.world.DifficultyMixin_API", - "minecraft.world.InteractionHandMixin_API", - "minecraft.world.IWorldGenerationBaseReaderMixin_API", - "minecraft.world.IWorldGenerationReaderMixin_API", - "minecraft.world.damagesource.DamageScalingMixin_API", - "minecraft.world.damagesource.DamageSourceMixin_API", - "minecraft.world.damagesource.DamageTypeMixin_API", - "minecraft.world.effect.MobEffectInstanceMixin_API", - "minecraft.world.effect.MobEffectMixin_API", - "minecraft.world.entity.AgeableMobMixin_API", - "minecraft.world.entity.AreaEffectCloudMixin_API", - "minecraft.world.entity.Display_BillboardConstraintsMixin_API", - "minecraft.world.entity.Display_BlockDisplayMixin_API", - "minecraft.world.entity.Display_ItemDisplayMixin_API", - "minecraft.world.entity.Display_TextDisplay_AlignMixin_API", - "minecraft.world.entity.Display_TextDisplayMixin_API", - "minecraft.world.entity.DisplayMixin_API", - "minecraft.world.entity.EntityMixin_API", - "minecraft.world.entity.EntityTypeMixin_API", - "minecraft.world.entity.ExperienceOrbMixin_API", - "minecraft.world.entity.FlyingMobMixin_API", - "minecraft.world.entity.HumanoidArmMixin_API", - "minecraft.world.entity.InteractionMixin_API", - "minecraft.world.entity.LightningBoltMixin_API", - "minecraft.world.entity.LivingEntityMixin_API", - "minecraft.world.entity.MarkerMixin_API", - "minecraft.world.entity.MobCategoryMixin_API", - "minecraft.world.entity.MobMixin_API", - "minecraft.world.entity.PathfinderMobMixin_API", - "minecraft.world.entity.TamableAnimalMixin_API", - "minecraft.world.entity.ai.attributes.AttributeInstanceMixin_API", - "minecraft.world.entity.ai.attributes.AttributeMixin_API", - "minecraft.world.entity.ai.attributes.AttributeModifier_OperationMixin_API", - "minecraft.world.entity.ai.attributes.AttributeModifierMixin_API", - "minecraft.world.entity.ai.attributes.RangedAttributeMixin_API", - "minecraft.world.entity.ai.goal.AvoidEntityGoalMixin_API", - "minecraft.world.entity.ai.goal.FloatGoalMixin_API", - "minecraft.world.entity.ai.goal.GoalMixin_API", - "minecraft.world.entity.ai.goal.GoalSelectorMixin_API", - "minecraft.world.entity.ai.goal.LookAtPlayerGoalMixin_API", - "minecraft.world.entity.ai.goal.MeleeAttackGoalMixin_API", - "minecraft.world.entity.ai.goal.RandomLookAroundGoalMixin_API", - "minecraft.world.entity.ai.goal.RandomStrollGoalMixin_API", - "minecraft.world.entity.ai.goal.RangedAttackGoalMixin_API", - "minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoalMixin_API", - "minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoalMixin_API", - "minecraft.world.entity.ai.goal.target.TargetGoalMixin_API", - "minecraft.world.entity.ambient.AmbientCreatureMixin_API", - "minecraft.world.entity.ambient.BatMixin_API", - "minecraft.world.entity.animal.AbstractFishMixin_API", - "minecraft.world.entity.animal.AbstractGolemMixin_API", - "minecraft.world.entity.animal.AbstractSchoolingFishMixin_API", - "minecraft.world.entity.animal.AnimalMixin_API", - "minecraft.world.entity.animal.BeeMixin_API", - "minecraft.world.entity.animal.CatMixin_API", - "minecraft.world.entity.animal.CatVariantMixin_API", - "minecraft.world.entity.animal.ChickenMixin_API", - "minecraft.world.entity.animal.CodMixin_API", - "minecraft.world.entity.animal.CowMixin_API", - "minecraft.world.entity.animal.DolphinMixin_API", - "minecraft.world.entity.animal.Fox_TypeMixin_API", - "minecraft.world.entity.animal.FoxMixin_API", - "minecraft.world.entity.animal.IronGolemMixin_API", - "minecraft.world.entity.animal.MushroomCow_MushroomTypeMixin_API", - "minecraft.world.entity.animal.MushroomCowMixin_API", - "minecraft.world.entity.animal.OcelotMixin_API", - "minecraft.world.entity.animal.Panda_GeneMixin_API", - "minecraft.world.entity.animal.PandaMixin_API", - "minecraft.world.entity.animal.Parrot_VariantMixin_API", - "minecraft.world.entity.animal.ParrotMixin_API", - "minecraft.world.entity.animal.PigMixin_API", - "minecraft.world.entity.animal.PolarBearMixin_API", - "minecraft.world.entity.animal.PufferfishMixin_API", - "minecraft.world.entity.animal.Rabbit_VariantMixin_API", - "minecraft.world.entity.animal.RabbitMixin_API", - "minecraft.world.entity.animal.SalmonMixin_API", - "minecraft.world.entity.animal.SheepMixin_API", - "minecraft.world.entity.animal.ShoulderRidingEntityMixin_API", - "minecraft.world.entity.animal.SnowGolemMixin_API", - "minecraft.world.entity.animal.SquidMixin_API", - "minecraft.world.entity.animal.TropicalFish_PatternMixin_API", - "minecraft.world.entity.animal.TropicalFishMixin_API", - "minecraft.world.entity.animal.TurtleMixin_API", - "minecraft.world.entity.animal.WaterAnimalMixin_API", - "minecraft.world.entity.animal.WolfMixin_API", - "minecraft.world.entity.animal.allay.AllayMixin_API", - "minecraft.world.entity.animal.camel.CamelMixin_API", - "minecraft.world.entity.animal.frog.FrogMixin_API", - "minecraft.world.entity.animal.frog.TadpoleMixin_API", - "minecraft.world.entity.animal.horse.AbstractChestedHorseMixin_API", - "minecraft.world.entity.animal.horse.AbstractHorseMixin_API", - "minecraft.world.entity.animal.horse.DonkeyMixin_API", - "minecraft.world.entity.animal.horse.HorseMixin_API", - "minecraft.world.entity.animal.horse.LLama_VariantMixin_API", - "minecraft.world.entity.animal.horse.LlamaMixin_API", - "minecraft.world.entity.animal.horse.MarkingsMixin_API", - "minecraft.world.entity.animal.horse.MuleMixin_API", - "minecraft.world.entity.animal.horse.SkeletonHorseMixin_API", - "minecraft.world.entity.animal.horse.TraderLlamaMixin_API", - "minecraft.world.entity.animal.horse.VariantMixin_API", - "minecraft.world.entity.animal.horse.ZombieHorseMixin_API", - "minecraft.world.entity.animal.sniffer.SnifferMixin_API", - "minecraft.world.entity.boss.EnderDragonPartMixin_API", - "minecraft.world.entity.boss.enderdragon.EndCrystalMixin_API", - "minecraft.world.entity.boss.enderdragon.EnderDragonMixin_API", - "minecraft.world.entity.boss.enderdragon.phases.DragonPhaseInstanceMixin_API", - "minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhaseManagerMixin_API", - "minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhaseMixin_API", - "minecraft.world.entity.decoration.ArmorStandMixin_API", - "minecraft.world.entity.decoration.HangingEntityMixin_API", - "minecraft.world.entity.decoration.ItemFrameMixin_API", - "minecraft.world.entity.decoration.LeashFenceKnotEntityMixin_API", - "minecraft.world.entity.decoration.PaintingMixin_API", - "minecraft.world.entity.decoration.PaintingVariantMixin_API", - "minecraft.world.entity.item.FallingBlockEntityMixin_API", - "minecraft.world.entity.item.ItemEntityMixin_API", - "minecraft.world.entity.item.PrimedTntMixin_API", - "minecraft.world.entity.monster.AbstractIllagerMixin_API", - "minecraft.world.entity.monster.AbstractSkeletonMixin_API", - "minecraft.world.entity.monster.BlazeMixin_API", - "minecraft.world.entity.monster.BreezeMixin_API", - "minecraft.world.entity.monster.CaveSpiderMixin_API", - "minecraft.world.entity.monster.CreeperMixin_API", - "minecraft.world.entity.monster.DrownedMixin_API", - "minecraft.world.entity.monster.ElderGuardianMixin_API", - "minecraft.world.entity.monster.EnderManMixin_API", - "minecraft.world.entity.monster.EndermiteMixin_API", - "minecraft.world.entity.monster.EvokerMixin_API", - "minecraft.world.entity.monster.GhastMixin_API", - "minecraft.world.entity.monster.GiantMixin_API", - "minecraft.world.entity.monster.GuardianMixin_API", - "minecraft.world.entity.monster.HoglinMixin_API", - "minecraft.world.entity.monster.HuskMixin_API", - "minecraft.world.entity.monster.IllusionerMixin_API", - "minecraft.world.entity.monster.MagmaCubeMixin_API", - "minecraft.world.entity.monster.MonsterMixin_API", - "minecraft.world.entity.monster.PatrollingMonsterMixin_API", - "minecraft.world.entity.monster.Phantom_AttackPhaseMixin_API", - "minecraft.world.entity.monster.PhantomMixin_API", - "minecraft.world.entity.monster.PiglinBruteMixin_API", - "minecraft.world.entity.monster.PiglinMixin_API", - "minecraft.world.entity.monster.PillagerMixin_API", - "minecraft.world.entity.monster.RangedAttackMobMixin_API", - "minecraft.world.entity.monster.RavagerMixin_API", - "minecraft.world.entity.monster.ShulkerMixin_API", - "minecraft.world.entity.monster.SilverfishMixin_API", - "minecraft.world.entity.monster.SkeletonMixin_API", - "minecraft.world.entity.monster.SlimeMixin_API", - "minecraft.world.entity.monster.SpellcasterIllager_IllagerSpellMixin_API", - "minecraft.world.entity.monster.SpellcasterIllagerMixin_API", - "minecraft.world.entity.monster.SpiderMixin_API", - "minecraft.world.entity.monster.StrayMixin_API", - "minecraft.world.entity.monster.VexMixin_API", - "minecraft.world.entity.monster.VindicatorMixin_API", - "minecraft.world.entity.monster.WitchMixin_API", - "minecraft.world.entity.monster.WitherSkeletonMixin_API", - "minecraft.world.entity.monster.ZoglinMixin_API", - "minecraft.world.entity.monster.ZombieMixin_API", - "minecraft.world.entity.monster.ZombieVillagerMixin_API", - "minecraft.world.entity.monster.ZombifiedPiglinMixin_API", - "minecraft.world.entity.monster.warden.WardenMixin_API", - "minecraft.world.entity.npc.AbstractVillagerMixin_API", - "minecraft.world.entity.npc.VillagerMixin_API", - "minecraft.world.entity.npc.VillagerProfessionMixin_API", - "minecraft.world.entity.npc.VillagerTrades_ItemListingMixin_API", - "minecraft.world.entity.npc.VillagerTypeMixin_API", - "minecraft.world.entity.npc.WanderingTraderMixin_API", - "minecraft.world.entity.player.ChatVisiblityMixin_API", - "minecraft.world.entity.player.PlayerMixin_API", - "minecraft.world.entity.projectile.AbstractArrow_PickupMixin_API", - "minecraft.world.entity.projectile.AbstractArrowMixin_API", - "minecraft.world.entity.projectile.AbstractHurtingProjectileMixin_API", - "minecraft.world.entity.projectile.ArrowMixin_API", - "minecraft.world.entity.projectile.DragonFireballMixin_API", - "minecraft.world.entity.projectile.EvokerFangsMixin_API", - "minecraft.world.entity.projectile.EyeOfEnderMixin_API", - "minecraft.world.entity.projectile.FireballMixin_API", - "minecraft.world.entity.projectile.FireworkRocketEntityMixin_API", - "minecraft.world.entity.projectile.FishingHookMixin_API", - "minecraft.world.entity.projectile.LargeFireballMixin_API", - "minecraft.world.entity.projectile.LlamaSpitMixin_API", - "minecraft.world.entity.projectile.ProjectileMixin_API", - "minecraft.world.entity.projectile.ShulkerBulletMixin_API", - "minecraft.world.entity.projectile.SmallFireballMixin_API", - "minecraft.world.entity.projectile.SnowballMixin_API", - "minecraft.world.entity.projectile.SpectralArrowMixin_API", - "minecraft.world.entity.projectile.ThrowableItemProjectileMixin_API", - "minecraft.world.entity.projectile.ThrowableProjectileMixin_API", - "minecraft.world.entity.projectile.ThrownEggMixin_API", - "minecraft.world.entity.projectile.ThrownEnderpearlMixin_API", - "minecraft.world.entity.projectile.ThrownExperienceBottleMixin_API", - "minecraft.world.entity.projectile.ThrownPotionMixin_API", - "minecraft.world.entity.projectile.ThrownTridentMixin_API", - "minecraft.world.entity.projectile.WindChargeMixin_API", - "minecraft.world.entity.projectile.WitherSkullMixin_API", - "minecraft.world.entity.raid.Raid_RaidStatusMixin_API", - "minecraft.world.entity.raid.RaiderMixin_API", - "minecraft.world.entity.raid.RaidMixin_API", - "minecraft.world.entity.vehicle.AbstractMinecartContainerMixin_API", - "minecraft.world.entity.vehicle.AbstractMinecartMixin_API", - "minecraft.world.entity.vehicle.Boat_TypeMixin_API", - "minecraft.world.entity.vehicle.BoatMixin_API", - "minecraft.world.entity.vehicle.ChestBoatMixin_API", - "minecraft.world.entity.vehicle.MinecartChestMixin_API", - "minecraft.world.entity.vehicle.MinecartCommandBlockMixin_API", - "minecraft.world.entity.vehicle.MinecartFurnaceMixin_API", - "minecraft.world.entity.vehicle.MinecartHopperMixin_API", - "minecraft.world.entity.vehicle.MinecartMixin_API", - "minecraft.world.entity.vehicle.MinecartSpawnerMixin_API", - "minecraft.world.entity.vehicle.MinecartTNTMixin_API", - "minecraft.world.item.ArmorMaterialMixin_API", - "minecraft.world.item.DyeColorMixin_API", - "minecraft.world.item.FireworkExplosion_ShapeMixin_API", - "minecraft.world.item.ItemCooldownsMixin_API", - "minecraft.world.item.ItemDisplayContextMixin_API", - "minecraft.world.item.ItemMixin_API", - "minecraft.world.item.ItemStackMixin_API", - "minecraft.world.item.RarityMixin_API", - "minecraft.world.item.TiersMixin_API", - "minecraft.world.item.alchemy.PotionMixin_API", - "minecraft.world.item.component.FireworkExplosionMixin_API", - "minecraft.world.item.component.Tool_RuleMixin_API", - "minecraft.world.item.crafting.AbstractCookingRecipeMixin_API", - "minecraft.world.item.crafting.CraftingRecipeMixin_API", - "minecraft.world.item.crafting.CustomRecipeMixin_API", - "minecraft.world.item.crafting.IngredientMixin_API", - "minecraft.world.item.crafting.RecipeManagerMixin_API", - "minecraft.world.item.crafting.RecipeMixin_API", - "minecraft.world.item.crafting.RecipeTypeMixin_API", - "minecraft.world.item.crafting.ShapedRecipeMixin_API", - "minecraft.world.item.crafting.ShapelessRecipeMixin_API", - "minecraft.world.item.crafting.SingleItemRecipeMixin_API", - "minecraft.world.item.crafting.SmithingTransformRecipeMixin_API", - "minecraft.world.item.crafting.StonecutterRecipeMixin_API", - "minecraft.world.item.enchantment.EnchantmentMixin_API", - "minecraft.world.item.trading.MerchantOfferMixin_API", - "minecraft.world.level.BlockGetterMixin_API", - "minecraft.world.level.EntityGetterMixin_API", - "minecraft.world.level.ExplosionMixin_API", - "minecraft.world.level.GameRules_KeyMixin_API", - "minecraft.world.level.GameTypeMixin_API", - "minecraft.world.level.LevelAccessorMixin_API", - "minecraft.world.level.LevelMixin_API", - "minecraft.world.level.LevelReaderMixin_API", - "minecraft.world.level.LevelWriterMixin_API", - "minecraft.world.level.LightLayerMixin_API", - "minecraft.world.level.biome.AmbientAdditionsSettingsMixin_API", - "minecraft.world.level.biome.AmbientMoodSettingsMixin_API", - "minecraft.world.level.biome.AmbientParticleSettingsMixin_API", - "minecraft.world.level.biome.Biome_PrecipitationMixin_API", - "minecraft.world.level.biome.Biome_TemperatureModifierMixin_API", - "minecraft.world.level.biome.BiomeMixin_API", - "minecraft.world.level.biome.BiomeSourceMixin_API", - "minecraft.world.level.biome.BiomeSpecialEffects_GrassColorModifierMixin_API", - "minecraft.world.level.biome.CheckerboardColumnBiomeSourceMixin_API", - "minecraft.world.level.biome.Climate_ParameterMixin_API", - "minecraft.world.level.biome.Climate_ParameterPointMixin_API", - "minecraft.world.level.biome.FixedBiomeSourceMixin_API", - "minecraft.world.level.biome.MobSpawnSettings_MobSpawnCostMixin_API", - "minecraft.world.level.biome.MobSpawnSettings_SpawnerDataMixin_API", - "minecraft.world.level.biome.MultiNoiseBiomeSourceMixin_API", - "minecraft.world.level.biome.TheEndBiomeSourceMixin_API", - "minecraft.world.level.block.MirrorMixin_API", - "minecraft.world.level.block.RotationMixin_API", - "minecraft.world.level.block.entity.AbstractFurnaceBlockEntityMixin_API", - "minecraft.world.level.block.entity.BannerBlockEntityMixin_API", - "minecraft.world.level.block.entity.BannerPatternLayers_LayerMixin_API", - "minecraft.world.level.block.entity.BannerPatternMixin_API", - "minecraft.world.level.block.entity.BarrelBlockEntityMixin_API", - "minecraft.world.level.block.entity.BaseContainerBlockEntityMixin_API", - "minecraft.world.level.block.entity.BeaconBlockEntityMixin_API", - "minecraft.world.level.block.entity.BedBlockEntityMixin_API", - "minecraft.world.level.block.entity.BeehiveBlockEntityMixin_API", - "minecraft.world.level.block.entity.BellBlockEntityMixin_API", - "minecraft.world.level.block.entity.BlastFurnaceBlockEntityMixin_API", - "minecraft.world.level.block.entity.BlockEntityMixin_API", - "minecraft.world.level.block.entity.BlockEntityTypeMixin_API", - "minecraft.world.level.block.entity.BrewingStandBlockEntityMixin_API", - "minecraft.world.level.block.entity.CampfireBlockEntityMixin_API", - "minecraft.world.level.block.entity.ChestBlockEntityMixin_API", - "minecraft.world.level.block.entity.CommandBlockEntityMixin_API", - "minecraft.world.level.block.entity.ComparatorBlockEntityMixin_API", - "minecraft.world.level.block.entity.ConduitBlockEntityMixin_API", - "minecraft.world.level.block.entity.DaylightDetectorBlockEntityMixin_API", - "minecraft.world.level.block.entity.DispenserBlockEntityMixin_API", - "minecraft.world.level.block.entity.DropperBlockEntityMixin_API", - "minecraft.world.level.block.entity.EnchantmentTableBlockEntityMixin_API", - "minecraft.world.level.block.entity.EnderChestBlockEntityMixin_API", - "minecraft.world.level.block.entity.FurnaceBlockEntityMixin_API", - "minecraft.world.level.block.entity.HopperBlockEntityMixin_API", - "minecraft.world.level.block.entity.JigsawBlockEntityMixin_API", - "minecraft.world.level.block.entity.JukeboxBlockEntityMixin_API", - "minecraft.world.level.block.entity.LecternBlockEntityMixin_API", - "minecraft.world.level.block.entity.RandomizableContainerBlockEntityMixin_API", - "minecraft.world.level.block.entity.SculkSensorBlockEntityMixin_API", - "minecraft.world.level.block.entity.ShulkerBoxBlockEntityMixin_API", - "minecraft.world.level.block.entity.SignBlockEntityMixin_API", - "minecraft.world.level.block.entity.SignTextMixin_API", - "minecraft.world.level.block.entity.SkullBlockEntityMixin_API", - "minecraft.world.level.block.entity.SmokerBlockEntityMixin_API", - "minecraft.world.level.block.entity.SpawnerBlockEntityMixin_API", - "minecraft.world.level.block.entity.StructureBlockEntityMixin_API", - "minecraft.world.level.block.entity.TheEndGatewayBlockEntityMixin_API", - "minecraft.world.level.block.entity.TheEndPortalBlockEntityMixin_API", - "minecraft.world.level.block.entity.TrappedCheckBlockEntityMixin_API", - "minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateMixin_API", - "minecraft.world.level.block.entity.vault.VaultStateMixin_API", - "minecraft.world.level.block.piston.PistonMovingBlockEntityMixin_API", - "minecraft.world.level.block.state.BlockBehaviour_BlockStateBaseMixin_API", - "minecraft.world.level.block.state.BlockStateMixin_API", - "minecraft.world.level.block.state.StateHolderMixin_API", - "minecraft.world.level.block.state.properties.AttachFaceMixin_API", - "minecraft.world.level.block.state.properties.BambooLeavesMixin_API", - "minecraft.world.level.block.state.properties.BellAttachTypeMixin_API", - "minecraft.world.level.block.state.properties.ChestTypeMixin_API", - "minecraft.world.level.block.state.properties.ComparatorModeMixin_API", - "minecraft.world.level.block.state.properties.DoorHingeSideMixin_API", - "minecraft.world.level.block.state.properties.DripstoneThicknessMixin_API", - "minecraft.world.level.block.state.properties.FrontAndTopMixin_API", - "minecraft.world.level.block.state.properties.HalfMixin_API", - "minecraft.world.level.block.state.properties.NoteBlockInstrumentMixin_API", - "minecraft.world.level.block.state.properties.PistonTypeMixin_API", - "minecraft.world.level.block.state.properties.RailShapeMixin_API", - "minecraft.world.level.block.state.properties.RedstoneSideMixin_API", - "minecraft.world.level.block.state.properties.SculkSensorPhaseMixin_API", - "minecraft.world.level.block.state.properties.SlabTypeMixin_API", - "minecraft.world.level.block.state.properties.StairsShapeMixin_API", - "minecraft.world.level.block.state.properties.StructureModeMixin_API", - "minecraft.world.level.block.state.properties.TiltMixin_API", - "minecraft.world.level.block.state.properties.WallSideMixin_API", - "minecraft.world.level.border.WorldBorderMixin_Settings_API", - "minecraft.world.level.chunk.ChunkAccessMixin_API", - "minecraft.world.level.chunk.ChunkGeneratorMixin_API", - "minecraft.world.level.chunk.ChunkStatusMixin_API", - "minecraft.world.level.chunk.EmptyLevelChunkMixin_API", - "minecraft.world.level.chunk.LevelChunkMixin_API", - "minecraft.world.level.chunk.ProtoChunkMixin_API", - "minecraft.world.level.dimension.DimensionTypeMixin_API", - "minecraft.world.level.levelgen.DensityFunctionMixin_API", - "minecraft.world.level.levelgen.FlatLevelSourceMixin_API", - "minecraft.world.level.levelgen.GenerationStep_CarvingMixin_API", - "minecraft.world.level.levelgen.GenerationStep_DecorationMixin_API", - "minecraft.world.level.levelgen.Heightmap_TypeMixin_API", - "minecraft.world.level.levelgen.NoiseBasedChunkGeneratorMixin_API", - "minecraft.world.level.levelgen.NoiseGeneratorSettingsMixin_API", - "minecraft.world.level.levelgen.NoiseRouterMixin_API", - "minecraft.world.level.levelgen.NoiseSettingsMixin_API", - "minecraft.world.level.levelgen.NormalNoise_NoiseParametersMixin_API", - "minecraft.world.level.levelgen.SurfaceRules_ConditionSourceMixin_API", - "minecraft.world.level.levelgen.SurfaceRules_RulesSourceMixin_API", - "minecraft.world.level.levelgen.VerticalAnchorMixin_API", - "minecraft.world.level.levelgen.WorldOptionsMixin_API", - "minecraft.world.level.levelgen.carver.ConfiguredWorldCarverMixin_API", - "minecraft.world.level.levelgen.carver.WorldCarverMixin_API", - "minecraft.world.level.levelgen.feature.ConfiguredFeatureMixin_API", - "minecraft.world.level.levelgen.feature.FeatureMixin_API", - "minecraft.world.level.levelgen.flat.FlatLayerInfoMixin_API", - "minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettingsMixin_API", - "minecraft.world.level.levelgen.placement.PlacedFeatureMixin_API", - "minecraft.world.level.levelgen.placement.PlacementModifierMixin_API", - "minecraft.world.level.levelgen.placement.PlacementModifierTypeMixin_API", - "minecraft.world.level.levelgen.structure.StructureMixin_API", - "minecraft.world.level.levelgen.structure.StructurePlacementMixin_API", - "minecraft.world.level.levelgen.structure.StructureSetMixin_API", - "minecraft.world.level.levelgen.structure.StructureSpawnOverrideMixin_API", - "minecraft.world.level.levelgen.structure.StructureTypeMixin_API", - "minecraft.world.level.levelgen.structure.pools.StructurePoolElementMixin_API", - "minecraft.world.level.levelgen.structure.pools.StructureTemplatePool_ProjectionMixin_API", - "minecraft.world.level.levelgen.structure.pools.StructureTemplatePoolMixin_API", - "minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorListMixin_API", - "minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorMixin_API", - "minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorTypeMixin_API", - "minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateMixin_API", - "minecraft.world.level.material.FluidMixin_API", - "minecraft.world.level.material.FluidStateMixin_API", - "minecraft.world.level.material.PushReactionMixin_API", - "minecraft.world.level.saveddata.MapDecorationMixin", - "minecraft.world.level.saveddata.MapItemSavedDataMixin", - "minecraft.world.level.storage.LevelDataMixin_API", - "minecraft.world.level.storage.PrimaryLevelDataMixin_API", - "minecraft.world.level.storage.ServerLevelDataMixin_API", - "minecraft.world.scores.DisplaySlotMixin_API", - "minecraft.world.scores.PlayerTeamMixin_API", - "minecraft.world.scores.Team_CollisionRuleMixin_API", - "minecraft.world.scores.Team_VisibilityMixin_API", - "minecraft.world.scores.criteria.ObjectiveCriteria_RenderTypeMixin_API", - "minecraft.world.scores.criteria.ObjectiveCriteriaMixin_API", - "minecraft.world.ticks.LevelTicksMixin_API", - "minecraft.world.ticks.ScheduledTickMixin_API", - "minecraft.world.ticks.TickPriorityMixin_API", - "service.permission.SubjectMixin_API", - "world.LocatableBlockMixin_API" - ], - "client": [ - "minecraft.client.MinecraftMixin_API", - "minecraft.client.multiplayer.ClientCommonPacketListenerImplMixin_API", - "minecraft.client.multiplayer.ClientConfigurationPacketListenerImplMixin_API", - "minecraft.client.multiplayer.ClientHandshakePacketListenerImplMixin_API", - "minecraft.client.multiplayer.ClientLevel_ClientLevelDataMixin_API", - "minecraft.client.multiplayer.ClientLevelMixin_API", - "minecraft.client.multiplayer.ClientPacketListenerMixin_API", - "minecraft.client.player.AbstractClientPlayerMixin_API", - "minecraft.client.player.LocalPlayerMixin_API", - "minecraft.client.player.RemotePlayerMixin_API", - "minecraft.client.server.IntegratedServerMixin_API" - ], - "server": [ - "minecraft.server.dedicated.DedicatedServerMixin_API" - ], - "overwrites": { - "conformVisibility": true - } + "required": true, + "parent": "mixins.sponge.parent.json", + "package": "org.spongepowered.common.mixin.api", + "mixinPriority": 1100, + "mixins": [ + "common.entity.living.HumanEntityMixin_API", + "data.DataHolderMixin_API", + "data.persistence.DataContainerMixin_API", + "entity.ai.goal.AbstractGoalMixin_API", + "item.merchant.MerchantMixin_API", + "minecraft.advancements.AdvancementMixin_API", + "minecraft.advancements.AdvancementNodeMixin_API", + "minecraft.advancements.AdvancementProgressMixin_API", + "minecraft.advancements.AdvancementTypeMixin_API", + "minecraft.advancements.CriterionMixin_API", + "minecraft.advancements.CriterionProgressMixin_API", + "minecraft.advancements.CriterionTriggerInstanceMixin_API", + "minecraft.advancements.CriterionTriggerMixin_API", + "minecraft.advancements.DisplayInfoMixin_API", + "minecraft.block.AbstractBlockMixin_API", + "minecraft.block.BlockMixin_API", + "minecraft.block.BlockSoundGroupMixin_API", + "minecraft.commands.CommandSourceStackMixin_API", + "minecraft.commands.arguments.selector.EntitySelectorMixin_API", + "minecraft.commands.arguments.selector.EntitySelectorParserMixin_API", + "minecraft.commands.synchronization.SuggestionProviders_WrapperMixin_API", + "minecraft.core.MappedRegistryMixin_API", + "minecraft.core.particles.ParticleTypeMixin_API", + "minecraft.entity.boss.WitherEntityMixin_API", + "minecraft.item.BlockItemMixin_API", + "minecraft.map.MapDecorationMixin_API", + "minecraft.map.MapDecorationTypeMixin_API", + "minecraft.map.MapInfoMixin_API", + "minecraft.network.FriendlyByteBufMixin_API", + "minecraft.network.chat.ChatTypeMixin_API", + "minecraft.network.chat.ChatTypeMixin_API$BoundMixin_API", + "minecraft.network.chat.MessageSignatureMixin_API", + "minecraft.network.chat.NumberFormatMixin_API", + "minecraft.network.protocol.status.ServerStatus_FaviconMixin_API", + "minecraft.network.protocol.status.ServerStatus_PlayersMixin_API", + "minecraft.network.protocol.status.ServerStatus_VersionMixin_API", + "minecraft.network.protocol.status.ServerStatusMixin_API", + "minecraft.resources.ResourceLocationMixin_API", + "minecraft.server.MinecraftServerMixin_API", + "minecraft.server.ServerScoreboardMixin_API", + "minecraft.server.level.ChunkMapMixin_API", + "minecraft.server.level.ServerLevelMixin_API", + "minecraft.server.level.ServerPlayerMixin_API", + "minecraft.server.level.TicketMixin_API", + "minecraft.server.level.TicketTypeMixin_API", + "minecraft.server.level.WorldGenRegionMixin_API", + "minecraft.server.network.MemoryServerHandshakePacketListenerImplMixin_API", + "minecraft.server.network.ServerCommonPacketListenerImplMixin_API", + "minecraft.server.network.ServerConfigurationPacketListenerImplMixin_API", + "minecraft.server.network.ServerGamePacketListenerImplMixin_API", + "minecraft.server.network.ServerHandshakePacketListenerImplMixin_API", + "minecraft.server.network.ServerLoginPacketListenerImplMixin_API", + "minecraft.server.packs.PackResourcesMixin_API", + "minecraft.server.packs.PackTypeMixin_API", + "minecraft.server.packs.repository.PackCompatibilityMixin_API", + "minecraft.server.packs.repository.PackMixin_API", + "minecraft.server.packs.repository.PackRepositoryMixin_API", + "minecraft.server.packs.resources.ResourceManagerMixin_API", + "minecraft.server.players.BanListEntryMixin_API", + "minecraft.server.players.GameProfileCacheMixin_API", + "minecraft.server.players.IpBanListEntryMixin_API", + "minecraft.server.players.StoredUserEntryMixin_API", + "minecraft.server.players.UserBanListEntryMixin_API", + "minecraft.server.rcon.RconConsoleSourceMixin_API", + "minecraft.server.rcon.thread.RconClientMixin_API", + "minecraft.sounds.MusicMixin_API", + "minecraft.sounds.SoundEventMixin_API", + "minecraft.state.BooleanPropertyMixin_API", + "minecraft.state.EnumPropertyMixin_API", + "minecraft.state.IntegerPropertyMixin_API", + "minecraft.state.PropertyMixin_API", + "minecraft.stats.StatMixin_API", + "minecraft.stats.StatTypeMixin_API", + "minecraft.tags.TagKeyMixin_API", + "minecraft.util.RandomSourceMixin_API", + "minecraft.util.StringRepresentableMixin_API", + "minecraft.world.DifficultyMixin_API", + "minecraft.world.InteractionHandMixin_API", + "minecraft.world.IWorldGenerationBaseReaderMixin_API", + "minecraft.world.IWorldGenerationReaderMixin_API", + "minecraft.world.damagesource.DamageScalingMixin_API", + "minecraft.world.damagesource.DamageSourceMixin_API", + "minecraft.world.damagesource.DamageTypeMixin_API", + "minecraft.world.effect.MobEffectInstanceMixin_API", + "minecraft.world.effect.MobEffectMixin_API", + "minecraft.world.entity.AgeableMobMixin_API", + "minecraft.world.entity.AreaEffectCloudMixin_API", + "minecraft.world.entity.Display_BillboardConstraintsMixin_API", + "minecraft.world.entity.Display_BlockDisplayMixin_API", + "minecraft.world.entity.Display_ItemDisplayMixin_API", + "minecraft.world.entity.Display_TextDisplay_AlignMixin_API", + "minecraft.world.entity.Display_TextDisplayMixin_API", + "minecraft.world.entity.DisplayMixin_API", + "minecraft.world.entity.EntityMixin_API", + "minecraft.world.entity.EntityTypeMixin_API", + "minecraft.world.entity.ExperienceOrbMixin_API", + "minecraft.world.entity.FlyingMobMixin_API", + "minecraft.world.entity.HumanoidArmMixin_API", + "minecraft.world.entity.InteractionMixin_API", + "minecraft.world.entity.LightningBoltMixin_API", + "minecraft.world.entity.LivingEntityMixin_API", + "minecraft.world.entity.MarkerMixin_API", + "minecraft.world.entity.MobCategoryMixin_API", + "minecraft.world.entity.MobMixin_API", + "minecraft.world.entity.PathfinderMobMixin_API", + "minecraft.world.entity.TamableAnimalMixin_API", + "minecraft.world.entity.ai.attributes.AttributeInstanceMixin_API", + "minecraft.world.entity.ai.attributes.AttributeMixin_API", + "minecraft.world.entity.ai.attributes.AttributeModifier_OperationMixin_API", + "minecraft.world.entity.ai.attributes.AttributeModifierMixin_API", + "minecraft.world.entity.ai.attributes.RangedAttributeMixin_API", + "minecraft.world.entity.ai.goal.AvoidEntityGoalMixin_API", + "minecraft.world.entity.ai.goal.FloatGoalMixin_API", + "minecraft.world.entity.ai.goal.GoalMixin_API", + "minecraft.world.entity.ai.goal.GoalSelectorMixin_API", + "minecraft.world.entity.ai.goal.LookAtPlayerGoalMixin_API", + "minecraft.world.entity.ai.goal.MeleeAttackGoalMixin_API", + "minecraft.world.entity.ai.goal.RandomLookAroundGoalMixin_API", + "minecraft.world.entity.ai.goal.RandomStrollGoalMixin_API", + "minecraft.world.entity.ai.goal.RangedAttackGoalMixin_API", + "minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoalMixin_API", + "minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoalMixin_API", + "minecraft.world.entity.ai.goal.target.TargetGoalMixin_API", + "minecraft.world.entity.ambient.AmbientCreatureMixin_API", + "minecraft.world.entity.ambient.BatMixin_API", + "minecraft.world.entity.animal.AbstractFishMixin_API", + "minecraft.world.entity.animal.AbstractGolemMixin_API", + "minecraft.world.entity.animal.AbstractSchoolingFishMixin_API", + "minecraft.world.entity.animal.AnimalMixin_API", + "minecraft.world.entity.animal.BeeMixin_API", + "minecraft.world.entity.animal.CatMixin_API", + "minecraft.world.entity.animal.CatVariantMixin_API", + "minecraft.world.entity.animal.ChickenMixin_API", + "minecraft.world.entity.animal.CodMixin_API", + "minecraft.world.entity.animal.CowMixin_API", + "minecraft.world.entity.animal.DolphinMixin_API", + "minecraft.world.entity.animal.Fox_TypeMixin_API", + "minecraft.world.entity.animal.FoxMixin_API", + "minecraft.world.entity.animal.IronGolemMixin_API", + "minecraft.world.entity.animal.MushroomCow_MushroomTypeMixin_API", + "minecraft.world.entity.animal.MushroomCowMixin_API", + "minecraft.world.entity.animal.OcelotMixin_API", + "minecraft.world.entity.animal.Panda_GeneMixin_API", + "minecraft.world.entity.animal.PandaMixin_API", + "minecraft.world.entity.animal.Parrot_VariantMixin_API", + "minecraft.world.entity.animal.ParrotMixin_API", + "minecraft.world.entity.animal.PigMixin_API", + "minecraft.world.entity.animal.PolarBearMixin_API", + "minecraft.world.entity.animal.PufferfishMixin_API", + "minecraft.world.entity.animal.Rabbit_VariantMixin_API", + "minecraft.world.entity.animal.RabbitMixin_API", + "minecraft.world.entity.animal.SalmonMixin_API", + "minecraft.world.entity.animal.SheepMixin_API", + "minecraft.world.entity.animal.ShoulderRidingEntityMixin_API", + "minecraft.world.entity.animal.SnowGolemMixin_API", + "minecraft.world.entity.animal.SquidMixin_API", + "minecraft.world.entity.animal.TropicalFish_PatternMixin_API", + "minecraft.world.entity.animal.TropicalFishMixin_API", + "minecraft.world.entity.animal.TurtleMixin_API", + "minecraft.world.entity.animal.WaterAnimalMixin_API", + "minecraft.world.entity.animal.WolfMixin_API", + "minecraft.world.entity.animal.allay.AllayMixin_API", + "minecraft.world.entity.animal.camel.CamelMixin_API", + "minecraft.world.entity.animal.frog.FrogMixin_API", + "minecraft.world.entity.animal.frog.TadpoleMixin_API", + "minecraft.world.entity.animal.horse.AbstractChestedHorseMixin_API", + "minecraft.world.entity.animal.horse.AbstractHorseMixin_API", + "minecraft.world.entity.animal.horse.DonkeyMixin_API", + "minecraft.world.entity.animal.horse.HorseMixin_API", + "minecraft.world.entity.animal.horse.LLama_VariantMixin_API", + "minecraft.world.entity.animal.horse.LlamaMixin_API", + "minecraft.world.entity.animal.horse.MarkingsMixin_API", + "minecraft.world.entity.animal.horse.MuleMixin_API", + "minecraft.world.entity.animal.horse.SkeletonHorseMixin_API", + "minecraft.world.entity.animal.horse.TraderLlamaMixin_API", + "minecraft.world.entity.animal.horse.VariantMixin_API", + "minecraft.world.entity.animal.horse.ZombieHorseMixin_API", + "minecraft.world.entity.animal.sniffer.SnifferMixin_API", + "minecraft.world.entity.boss.EnderDragonPartMixin_API", + "minecraft.world.entity.boss.enderdragon.EndCrystalMixin_API", + "minecraft.world.entity.boss.enderdragon.EnderDragonMixin_API", + "minecraft.world.entity.boss.enderdragon.phases.DragonPhaseInstanceMixin_API", + "minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhaseManagerMixin_API", + "minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhaseMixin_API", + "minecraft.world.entity.decoration.ArmorStandMixin_API", + "minecraft.world.entity.decoration.HangingEntityMixin_API", + "minecraft.world.entity.decoration.ItemFrameMixin_API", + "minecraft.world.entity.decoration.LeashFenceKnotEntityMixin_API", + "minecraft.world.entity.decoration.PaintingMixin_API", + "minecraft.world.entity.decoration.PaintingVariantMixin_API", + "minecraft.world.entity.item.FallingBlockEntityMixin_API", + "minecraft.world.entity.item.ItemEntityMixin_API", + "minecraft.world.entity.item.PrimedTntMixin_API", + "minecraft.world.entity.monster.AbstractIllagerMixin_API", + "minecraft.world.entity.monster.AbstractSkeletonMixin_API", + "minecraft.world.entity.monster.BlazeMixin_API", + "minecraft.world.entity.monster.BreezeMixin_API", + "minecraft.world.entity.monster.CaveSpiderMixin_API", + "minecraft.world.entity.monster.CreeperMixin_API", + "minecraft.world.entity.monster.DrownedMixin_API", + "minecraft.world.entity.monster.ElderGuardianMixin_API", + "minecraft.world.entity.monster.EnderManMixin_API", + "minecraft.world.entity.monster.EndermiteMixin_API", + "minecraft.world.entity.monster.EvokerMixin_API", + "minecraft.world.entity.monster.GhastMixin_API", + "minecraft.world.entity.monster.GiantMixin_API", + "minecraft.world.entity.monster.GuardianMixin_API", + "minecraft.world.entity.monster.HoglinMixin_API", + "minecraft.world.entity.monster.HuskMixin_API", + "minecraft.world.entity.monster.IllusionerMixin_API", + "minecraft.world.entity.monster.MagmaCubeMixin_API", + "minecraft.world.entity.monster.MonsterMixin_API", + "minecraft.world.entity.monster.PatrollingMonsterMixin_API", + "minecraft.world.entity.monster.Phantom_AttackPhaseMixin_API", + "minecraft.world.entity.monster.PhantomMixin_API", + "minecraft.world.entity.monster.PiglinBruteMixin_API", + "minecraft.world.entity.monster.PiglinMixin_API", + "minecraft.world.entity.monster.PillagerMixin_API", + "minecraft.world.entity.monster.RangedAttackMobMixin_API", + "minecraft.world.entity.monster.RavagerMixin_API", + "minecraft.world.entity.monster.ShulkerMixin_API", + "minecraft.world.entity.monster.SilverfishMixin_API", + "minecraft.world.entity.monster.SkeletonMixin_API", + "minecraft.world.entity.monster.SlimeMixin_API", + "minecraft.world.entity.monster.SpellcasterIllager_IllagerSpellMixin_API", + "minecraft.world.entity.monster.SpellcasterIllagerMixin_API", + "minecraft.world.entity.monster.SpiderMixin_API", + "minecraft.world.entity.monster.StrayMixin_API", + "minecraft.world.entity.monster.VexMixin_API", + "minecraft.world.entity.monster.VindicatorMixin_API", + "minecraft.world.entity.monster.WitchMixin_API", + "minecraft.world.entity.monster.WitherSkeletonMixin_API", + "minecraft.world.entity.monster.ZoglinMixin_API", + "minecraft.world.entity.monster.ZombieMixin_API", + "minecraft.world.entity.monster.ZombieVillagerMixin_API", + "minecraft.world.entity.monster.ZombifiedPiglinMixin_API", + "minecraft.world.entity.monster.warden.WardenMixin_API", + "minecraft.world.entity.npc.AbstractVillagerMixin_API", + "minecraft.world.entity.npc.VillagerMixin_API", + "minecraft.world.entity.npc.VillagerProfessionMixin_API", + "minecraft.world.entity.npc.VillagerTrades_ItemListingMixin_API", + "minecraft.world.entity.npc.VillagerTypeMixin_API", + "minecraft.world.entity.npc.WanderingTraderMixin_API", + "minecraft.world.entity.player.ChatVisiblityMixin_API", + "minecraft.world.entity.player.PlayerMixin_API", + "minecraft.world.entity.projectile.AbstractArrow_PickupMixin_API", + "minecraft.world.entity.projectile.AbstractArrowMixin_API", + "minecraft.world.entity.projectile.AbstractHurtingProjectileMixin_API", + "minecraft.world.entity.projectile.ArrowMixin_API", + "minecraft.world.entity.projectile.DragonFireballMixin_API", + "minecraft.world.entity.projectile.EvokerFangsMixin_API", + "minecraft.world.entity.projectile.EyeOfEnderMixin_API", + "minecraft.world.entity.projectile.FireballMixin_API", + "minecraft.world.entity.projectile.FireworkRocketEntityMixin_API", + "minecraft.world.entity.projectile.FishingHookMixin_API", + "minecraft.world.entity.projectile.LargeFireballMixin_API", + "minecraft.world.entity.projectile.LlamaSpitMixin_API", + "minecraft.world.entity.projectile.ProjectileMixin_API", + "minecraft.world.entity.projectile.ShulkerBulletMixin_API", + "minecraft.world.entity.projectile.SmallFireballMixin_API", + "minecraft.world.entity.projectile.SnowballMixin_API", + "minecraft.world.entity.projectile.SpectralArrowMixin_API", + "minecraft.world.entity.projectile.ThrowableItemProjectileMixin_API", + "minecraft.world.entity.projectile.ThrowableProjectileMixin_API", + "minecraft.world.entity.projectile.ThrownEggMixin_API", + "minecraft.world.entity.projectile.ThrownEnderpearlMixin_API", + "minecraft.world.entity.projectile.ThrownExperienceBottleMixin_API", + "minecraft.world.entity.projectile.ThrownPotionMixin_API", + "minecraft.world.entity.projectile.ThrownTridentMixin_API", + "minecraft.world.entity.projectile.WindChargeMixin_API", + "minecraft.world.entity.projectile.WitherSkullMixin_API", + "minecraft.world.entity.raid.Raid_RaidStatusMixin_API", + "minecraft.world.entity.raid.RaiderMixin_API", + "minecraft.world.entity.raid.RaidMixin_API", + "minecraft.world.entity.vehicle.AbstractMinecartContainerMixin_API", + "minecraft.world.entity.vehicle.AbstractMinecartMixin_API", + "minecraft.world.entity.vehicle.Boat_TypeMixin_API", + "minecraft.world.entity.vehicle.BoatMixin_API", + "minecraft.world.entity.vehicle.ChestBoatMixin_API", + "minecraft.world.entity.vehicle.MinecartChestMixin_API", + "minecraft.world.entity.vehicle.MinecartCommandBlockMixin_API", + "minecraft.world.entity.vehicle.MinecartFurnaceMixin_API", + "minecraft.world.entity.vehicle.MinecartHopperMixin_API", + "minecraft.world.entity.vehicle.MinecartMixin_API", + "minecraft.world.entity.vehicle.MinecartSpawnerMixin_API", + "minecraft.world.entity.vehicle.MinecartTNTMixin_API", + "minecraft.world.item.ArmorMaterialMixin_API", + "minecraft.world.item.DyeColorMixin_API", + "minecraft.world.item.FireworkExplosion_ShapeMixin_API", + "minecraft.world.item.ItemCooldownsMixin_API", + "minecraft.world.item.ItemDisplayContextMixin_API", + "minecraft.world.item.ItemMixin_API", + "minecraft.world.item.ItemStackMixin_API", + "minecraft.world.item.RarityMixin_API", + "minecraft.world.item.TiersMixin_API", + "minecraft.world.item.alchemy.PotionMixin_API", + "minecraft.world.item.component.FireworkExplosionMixin_API", + "minecraft.world.item.component.Tool_RuleMixin_API", + "minecraft.world.item.crafting.AbstractCookingRecipeMixin_API", + "minecraft.world.item.crafting.CraftingRecipeMixin_API", + "minecraft.world.item.crafting.CustomRecipeMixin_API", + "minecraft.world.item.crafting.IngredientMixin_API", + "minecraft.world.item.crafting.RecipeManagerMixin_API", + "minecraft.world.item.crafting.RecipeMixin_API", + "minecraft.world.item.crafting.RecipeTypeMixin_API", + "minecraft.world.item.crafting.ShapedRecipeMixin_API", + "minecraft.world.item.crafting.ShapelessRecipeMixin_API", + "minecraft.world.item.crafting.SingleItemRecipeMixin_API", + "minecraft.world.item.crafting.SmithingTransformRecipeMixin_API", + "minecraft.world.item.crafting.StonecutterRecipeMixin_API", + "minecraft.world.item.enchantment.EnchantmentMixin_API", + "minecraft.world.item.trading.MerchantOfferMixin_API", + "minecraft.world.level.BlockGetterMixin_API", + "minecraft.world.level.EntityGetterMixin_API", + "minecraft.world.level.ExplosionMixin_API", + "minecraft.world.level.GameRules_KeyMixin_API", + "minecraft.world.level.GameTypeMixin_API", + "minecraft.world.level.LevelAccessorMixin_API", + "minecraft.world.level.LevelMixin_API", + "minecraft.world.level.LevelReaderMixin_API", + "minecraft.world.level.LevelWriterMixin_API", + "minecraft.world.level.LightLayerMixin_API", + "minecraft.world.level.biome.AmbientAdditionsSettingsMixin_API", + "minecraft.world.level.biome.AmbientMoodSettingsMixin_API", + "minecraft.world.level.biome.AmbientParticleSettingsMixin_API", + "minecraft.world.level.biome.Biome_PrecipitationMixin_API", + "minecraft.world.level.biome.Biome_TemperatureModifierMixin_API", + "minecraft.world.level.biome.BiomeMixin_API", + "minecraft.world.level.biome.BiomeSourceMixin_API", + "minecraft.world.level.biome.BiomeSpecialEffects_GrassColorModifierMixin_API", + "minecraft.world.level.biome.CheckerboardColumnBiomeSourceMixin_API", + "minecraft.world.level.biome.Climate_ParameterMixin_API", + "minecraft.world.level.biome.Climate_ParameterPointMixin_API", + "minecraft.world.level.biome.FixedBiomeSourceMixin_API", + "minecraft.world.level.biome.MobSpawnSettings_MobSpawnCostMixin_API", + "minecraft.world.level.biome.MobSpawnSettings_SpawnerDataMixin_API", + "minecraft.world.level.biome.MultiNoiseBiomeSourceMixin_API", + "minecraft.world.level.biome.TheEndBiomeSourceMixin_API", + "minecraft.world.level.block.MirrorMixin_API", + "minecraft.world.level.block.RotationMixin_API", + "minecraft.world.level.block.entity.AbstractFurnaceBlockEntityMixin_API", + "minecraft.world.level.block.entity.BannerBlockEntityMixin_API", + "minecraft.world.level.block.entity.BannerPatternLayers_LayerMixin_API", + "minecraft.world.level.block.entity.BannerPatternMixin_API", + "minecraft.world.level.block.entity.BarrelBlockEntityMixin_API", + "minecraft.world.level.block.entity.BaseContainerBlockEntityMixin_API", + "minecraft.world.level.block.entity.BeaconBlockEntityMixin_API", + "minecraft.world.level.block.entity.BedBlockEntityMixin_API", + "minecraft.world.level.block.entity.BeehiveBlockEntityMixin_API", + "minecraft.world.level.block.entity.BellBlockEntityMixin_API", + "minecraft.world.level.block.entity.BlastFurnaceBlockEntityMixin_API", + "minecraft.world.level.block.entity.BlockEntityMixin_API", + "minecraft.world.level.block.entity.BlockEntityTypeMixin_API", + "minecraft.world.level.block.entity.BrewingStandBlockEntityMixin_API", + "minecraft.world.level.block.entity.CampfireBlockEntityMixin_API", + "minecraft.world.level.block.entity.ChestBlockEntityMixin_API", + "minecraft.world.level.block.entity.CommandBlockEntityMixin_API", + "minecraft.world.level.block.entity.ComparatorBlockEntityMixin_API", + "minecraft.world.level.block.entity.ConduitBlockEntityMixin_API", + "minecraft.world.level.block.entity.DaylightDetectorBlockEntityMixin_API", + "minecraft.world.level.block.entity.DispenserBlockEntityMixin_API", + "minecraft.world.level.block.entity.DropperBlockEntityMixin_API", + "minecraft.world.level.block.entity.EnchantmentTableBlockEntityMixin_API", + "minecraft.world.level.block.entity.EnderChestBlockEntityMixin_API", + "minecraft.world.level.block.entity.FurnaceBlockEntityMixin_API", + "minecraft.world.level.block.entity.HopperBlockEntityMixin_API", + "minecraft.world.level.block.entity.JigsawBlockEntityMixin_API", + "minecraft.world.level.block.entity.JukeboxBlockEntityMixin_API", + "minecraft.world.level.block.entity.LecternBlockEntityMixin_API", + "minecraft.world.level.block.entity.RandomizableContainerBlockEntityMixin_API", + "minecraft.world.level.block.entity.SculkSensorBlockEntityMixin_API", + "minecraft.world.level.block.entity.ShulkerBoxBlockEntityMixin_API", + "minecraft.world.level.block.entity.SignBlockEntityMixin_API", + "minecraft.world.level.block.entity.SignTextMixin_API", + "minecraft.world.level.block.entity.SkullBlockEntityMixin_API", + "minecraft.world.level.block.entity.SmokerBlockEntityMixin_API", + "minecraft.world.level.block.entity.SpawnerBlockEntityMixin_API", + "minecraft.world.level.block.entity.StructureBlockEntityMixin_API", + "minecraft.world.level.block.entity.TheEndGatewayBlockEntityMixin_API", + "minecraft.world.level.block.entity.TheEndPortalBlockEntityMixin_API", + "minecraft.world.level.block.entity.TrappedCheckBlockEntityMixin_API", + "minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateMixin_API", + "minecraft.world.level.block.entity.vault.VaultStateMixin_API", + "minecraft.world.level.block.piston.PistonMovingBlockEntityMixin_API", + "minecraft.world.level.block.state.BlockBehaviour_BlockStateBaseMixin_API", + "minecraft.world.level.block.state.BlockStateMixin_API", + "minecraft.world.level.block.state.StateHolderMixin_API", + "minecraft.world.level.block.state.properties.AttachFaceMixin_API", + "minecraft.world.level.block.state.properties.BambooLeavesMixin_API", + "minecraft.world.level.block.state.properties.BellAttachTypeMixin_API", + "minecraft.world.level.block.state.properties.ChestTypeMixin_API", + "minecraft.world.level.block.state.properties.ComparatorModeMixin_API", + "minecraft.world.level.block.state.properties.DoorHingeSideMixin_API", + "minecraft.world.level.block.state.properties.DripstoneThicknessMixin_API", + "minecraft.world.level.block.state.properties.FrontAndTopMixin_API", + "minecraft.world.level.block.state.properties.HalfMixin_API", + "minecraft.world.level.block.state.properties.NoteBlockInstrumentMixin_API", + "minecraft.world.level.block.state.properties.PistonTypeMixin_API", + "minecraft.world.level.block.state.properties.RailShapeMixin_API", + "minecraft.world.level.block.state.properties.RedstoneSideMixin_API", + "minecraft.world.level.block.state.properties.SculkSensorPhaseMixin_API", + "minecraft.world.level.block.state.properties.SlabTypeMixin_API", + "minecraft.world.level.block.state.properties.StairsShapeMixin_API", + "minecraft.world.level.block.state.properties.StructureModeMixin_API", + "minecraft.world.level.block.state.properties.TiltMixin_API", + "minecraft.world.level.block.state.properties.WallSideMixin_API", + "minecraft.world.level.border.WorldBorderMixin_Settings_API", + "minecraft.world.level.chunk.ChunkAccessMixin_API", + "minecraft.world.level.chunk.ChunkGeneratorMixin_API", + "minecraft.world.level.chunk.ChunkStatusMixin_API", + "minecraft.world.level.chunk.EmptyLevelChunkMixin_API", + "minecraft.world.level.chunk.LevelChunkMixin_API", + "minecraft.world.level.chunk.ProtoChunkMixin_API", + "minecraft.world.level.dimension.DimensionTypeMixin_API", + "minecraft.world.level.levelgen.DensityFunctionMixin_API", + "minecraft.world.level.levelgen.FlatLevelSourceMixin_API", + "minecraft.world.level.levelgen.GenerationStep_CarvingMixin_API", + "minecraft.world.level.levelgen.GenerationStep_DecorationMixin_API", + "minecraft.world.level.levelgen.Heightmap_TypeMixin_API", + "minecraft.world.level.levelgen.NoiseBasedChunkGeneratorMixin_API", + "minecraft.world.level.levelgen.NoiseGeneratorSettingsMixin_API", + "minecraft.world.level.levelgen.NoiseRouterMixin_API", + "minecraft.world.level.levelgen.NoiseSettingsMixin_API", + "minecraft.world.level.levelgen.NormalNoise_NoiseParametersMixin_API", + "minecraft.world.level.levelgen.SurfaceRules_ConditionSourceMixin_API", + "minecraft.world.level.levelgen.SurfaceRules_RulesSourceMixin_API", + "minecraft.world.level.levelgen.VerticalAnchorMixin_API", + "minecraft.world.level.levelgen.WorldOptionsMixin_API", + "minecraft.world.level.levelgen.carver.ConfiguredWorldCarverMixin_API", + "minecraft.world.level.levelgen.carver.WorldCarverMixin_API", + "minecraft.world.level.levelgen.feature.ConfiguredFeatureMixin_API", + "minecraft.world.level.levelgen.feature.FeatureMixin_API", + "minecraft.world.level.levelgen.flat.FlatLayerInfoMixin_API", + "minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettingsMixin_API", + "minecraft.world.level.levelgen.placement.PlacedFeatureMixin_API", + "minecraft.world.level.levelgen.placement.PlacementModifierMixin_API", + "minecraft.world.level.levelgen.placement.PlacementModifierTypeMixin_API", + "minecraft.world.level.levelgen.structure.StructureMixin_API", + "minecraft.world.level.levelgen.structure.StructurePlacementMixin_API", + "minecraft.world.level.levelgen.structure.StructureSetMixin_API", + "minecraft.world.level.levelgen.structure.StructureSpawnOverrideMixin_API", + "minecraft.world.level.levelgen.structure.StructureTypeMixin_API", + "minecraft.world.level.levelgen.structure.pools.StructurePoolElementMixin_API", + "minecraft.world.level.levelgen.structure.pools.StructureTemplatePool_ProjectionMixin_API", + "minecraft.world.level.levelgen.structure.pools.StructureTemplatePoolMixin_API", + "minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorListMixin_API", + "minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorMixin_API", + "minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorTypeMixin_API", + "minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateMixin_API", + "minecraft.world.level.material.FluidMixin_API", + "minecraft.world.level.material.FluidStateMixin_API", + "minecraft.world.level.material.PushReactionMixin_API", + "minecraft.world.level.saveddata.MapDecorationMixin", + "minecraft.world.level.saveddata.MapItemSavedDataMixin", + "minecraft.world.level.storage.LevelDataMixin_API", + "minecraft.world.level.storage.PrimaryLevelDataMixin_API", + "minecraft.world.level.storage.ServerLevelDataMixin_API", + "minecraft.world.scores.DisplaySlotMixin_API", + "minecraft.world.scores.PlayerTeamMixin_API", + "minecraft.world.scores.Team_CollisionRuleMixin_API", + "minecraft.world.scores.Team_VisibilityMixin_API", + "minecraft.world.scores.criteria.ObjectiveCriteria_RenderTypeMixin_API", + "minecraft.world.scores.criteria.ObjectiveCriteriaMixin_API", + "minecraft.world.ticks.LevelTicksMixin_API", + "minecraft.world.ticks.ScheduledTickMixin_API", + "minecraft.world.ticks.TickPriorityMixin_API", + "service.permission.SubjectMixin_API", + "world.LocatableBlockMixin_API" + ], + "client": [ + "minecraft.client.MinecraftMixin_API", + "minecraft.client.multiplayer.ClientCommonPacketListenerImplMixin_API", + "minecraft.client.multiplayer.ClientConfigurationPacketListenerImplMixin_API", + "minecraft.client.multiplayer.ClientHandshakePacketListenerImplMixin_API", + "minecraft.client.multiplayer.ClientLevel_ClientLevelDataMixin_API", + "minecraft.client.multiplayer.ClientLevelMixin_API", + "minecraft.client.multiplayer.ClientPacketListenerMixin_API", + "minecraft.client.player.AbstractClientPlayerMixin_API", + "minecraft.client.player.LocalPlayerMixin_API", + "minecraft.client.player.RemotePlayerMixin_API", + "minecraft.client.server.IntegratedServerMixin_API" + ], + "server": [ + "minecraft.server.dedicated.DedicatedServerMixin_API" + ], + "overwrites": { + "conformVisibility": true + } } diff --git a/testplugins/src/main/java/org/spongepowered/test/projectile/ProjectileTest.java b/testplugins/src/main/java/org/spongepowered/test/projectile/ProjectileTest.java index 9d9743c1ce3..1f70e0e6626 100644 --- a/testplugins/src/main/java/org/spongepowered/test/projectile/ProjectileTest.java +++ b/testplugins/src/main/java/org/spongepowered/test/projectile/ProjectileTest.java @@ -208,7 +208,7 @@ public ProjectileTestListener() { } @Listener - private void onClickBlock(final InteractBlockEvent.Secondary event, @First final ServerPlayer player) { + private void onClickBlock(final InteractBlockEvent.Secondary.Pre event, @First final ServerPlayer player) { final Vector3d interactionPoint = event.interactionPoint(); final ServerWorld world = player.world(); final EntityType nextType = this.projectileTypes.poll(); diff --git a/testplugins/src/main/java/org/spongepowered/test/volumestream/VolumeStreamTest.java b/testplugins/src/main/java/org/spongepowered/test/volumestream/VolumeStreamTest.java index 1de067274ed..67e0a85ccb0 100644 --- a/testplugins/src/main/java/org/spongepowered/test/volumestream/VolumeStreamTest.java +++ b/testplugins/src/main/java/org/spongepowered/test/volumestream/VolumeStreamTest.java @@ -407,7 +407,7 @@ private void onInteract(final InteractBlockEvent.Primary event, @Root final Play } @Listener - public void onInteract(final InteractBlockEvent.Secondary event, @Root final Player player) { + public void onInteract(final InteractBlockEvent.Secondary.Pre event, @Root final Player player) { event.context().get(EventContextKeys.USED_ITEM).ifPresent(snapshot -> { final BlockSnapshot block = event.block(); if (snapshot.type().equals(ItemTypes.WOODEN_AXE.get()) && block != BlockSnapshot.empty()) {