Skip to content

Commit

Permalink
feat: update to event-impl-gen 8 release
Browse files Browse the repository at this point in the history
  • Loading branch information
gabizou committed Jan 5, 2025
1 parent d83145f commit 5e670a9
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 65 deletions.
2 changes: 1 addition & 1 deletion SpongeAPI
61 changes: 54 additions & 7 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<trust group="org.codehaus.groovy" name="groovy-templates" reason="FIX"/>
<trust group="org.codehaus.groovy" name="groovy-test" reason="FIX"/>
<trust group="org.codehaus.groovy" name="groovy-xml" reason="FIX"/>
<trust group="org.spongepowered" name="event-impl-gen" reason="SNAPSHOT"/>
<trust group="org.spongepowered" name="event-impl-gen-annotations" reason="SNAPSHOT"/>
<trust group="org.spongepowered" name="vanillagradle" reason="FIX THIS"/>
<trust group="org.spongepowered" name="vanillagradle-downloader-apache-http" reason="FIX THIS"/>
<trust group="org.spongepowered" name="vanillagradle-resolver-core" reason="FIX THIS"/>
Expand Down Expand Up @@ -704,11 +702,6 @@
<sha256 value="8acb1f3b72a6f026916ac0735bad9aab0293d527edb7b365327def13a9367b7a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.code.gson" name="gson-parent" version="2.11.0">
<artifact name="gson-parent-2.11.0.pom">
<sha256 value="8acb1f3b72a6f026916ac0735bad9aab0293d527edb7b365327def13a9367b7a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.code.gson" name="gson-parent" version="2.8.0">
<artifact name="gson-parent-2.8.0.pom">
<sha256 value="0f1d8369b1e9f1bc4b467c8dcfdd8b59733aad5b5c8419c3a59b2f9abaf04cd2" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -737,6 +730,14 @@
<sha256 value="ca6529bd6d79090f0ab6f5da452eb4fbb29377b48e6a806e7612396dcb2998e0" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.dagger" name="dagger" version="2.54">
<artifact name="dagger-2.54.jar">
<sha256 value="7ab0d8278a532888de19025dc6ee70a80ecd4567778a6a7e7ec256a2073e40a3" origin="Generated by Gradle"/>
</artifact>
<artifact name="dagger-2.54.pom">
<sha256 value="af43413fd91fc49532884ca32191ab31bec609c344d4939aece9d3efef699f81" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.errorprone" name="error_prone_annotation" version="2.24.1">
<artifact name="error_prone_annotation-2.24.1.jar">
<sha256 value="dc202da451680aa8cdda7c68d959f27c112dca8f8fdeaf7c597de73cb2b1a0a6" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -1564,6 +1565,14 @@
<sha256 value="b864299a7d0a21020a831699438f7d3f85408ab24a34e911faa99ff684eb76fd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.palantir.javapoet" name="javapoet" version="0.6.0">
<artifact name="javapoet-0.6.0.jar">
<sha256 value="1c8dd1cc4404b9eeb5c54fef8a1cf2be7a138a42783b9460fbae9caf85ed5b2f" origin="Generated by Gradle"/>
</artifact>
<artifact name="javapoet-0.6.0.pom">
<sha256 value="f6e34a26ac09a3a68a91cc9235cb1f8c7736b07fe89db59a324acd8d57d9e797" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.puppycrawl.tools" name="checkstyle" version="10.12.7">
<artifact name="checkstyle-10.12.7.jar">
<sha256 value="767cc2393169f0abe4292e59c3b62317149f900a472cd6b01f74346f6bdae581" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -2363,6 +2372,14 @@
<sha256 value="5632476925b0c55ffd54f9984ca71dfb6ff9ec77e5b2096496de53f1059a37d7" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="jakarta.inject" name="jakarta.inject-api" version="2.0.1">
<artifact name="jakarta.inject-api-2.0.1.jar">
<sha256 value="f7dc98062fccf14126abb751b64fab12c312566e8cbdc8483598bffcea93af7c" origin="Generated by Gradle"/>
</artifact>
<artifact name="jakarta.inject-api-2.0.1.pom">
<sha256 value="e7fd7232e96307a575b2494c9367d68cf43ec98244aace3ccc23e1773ffa6fda" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="jakarta.platform" name="jakarta.jakartaee-bom" version="9.0.0">
<artifact name="jakarta.jakartaee-bom-9.0.0.pom">
<sha256 value="91903d0dd876dec67f8b923f1332ba72bf295b06bd397d18f3af19307ce1a2ce" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -5875,6 +5892,9 @@
<artifact name="apiguardian-api-1.1.2.module">
<sha256 value="e08028131375b357d1d28734e9a4fb4216da84b240641cb3ef7e7c7d628223fc" origin="Generated by Gradle"/>
</artifact>
<artifact name="apiguardian-api-1.1.2.pom">
<sha256 value="32355081d109095c3d5d374d5a43b4f4c1b75d549e983ef50723e2772e5302a0" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.cadixdev" name="at" version="0.1.0-rc1">
<artifact name="at-0.1.0-rc1.jar">
Expand Down Expand Up @@ -5944,6 +5964,9 @@
<artifact name="checker-qual-3.19.0.module">
<sha256 value="53e1899dde3c513ca1efd376abffac0e6907e8e84abd5f966242634c95e4d157" origin="Generated by Gradle"/>
</artifact>
<artifact name="checker-qual-3.19.0.pom">
<sha256 value="29ba9c5ce1a94b700bd823c4ed612f5827b590f19a49775fd7eb8f997f8aa371" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.checkerframework" name="checker-qual" version="3.26.0">
<artifact name="checker-qual-3.26.0.jar">
Expand Down Expand Up @@ -6601,6 +6624,14 @@
<sha256 value="33b8c22f2424c2903241a7fea258fc41ab0c4d6889776576c519047562ee43a5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jspecify" name="jspecify" version="1.0.0">
<artifact name="jspecify-1.0.0.jar">
<sha256 value="1fad6e6be7557781e4d33729d49ae1cdc8fdda6fe477bb0cc68ce351eafdfbab" origin="Generated by Gradle"/>
</artifact>
<artifact name="jspecify-1.0.0.module">
<sha256 value="d307ca77a54e18ac1ef1aaed4e5bbe014bd2f49f29e1d2f813e47c278283195b" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.junit" name="junit-bom" version="5.10.0">
<artifact name="junit-bom-5.10.0.module">
<sha256 value="eb3ee6127608010694a898056e7407d117296003aba5f5db801df430b9887fcf" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -7913,6 +7944,22 @@
<sha256 value="b68149d290f328b6b54d0f7f7d304adab5148cedd6ae18dc3baae8bf9f1757c6" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.spongepowered" name="event-impl-gen" version="8.0.0">
<artifact name="event-impl-gen-8.0.0.jar">
<sha256 value="6e26ff9a8d9f5a9fe39fe3e64781061bf068405c04095d78c044719ac2918992" origin="Generated by Gradle"/>
</artifact>
<artifact name="event-impl-gen-8.0.0.module">
<sha256 value="5b919469a6bead6b6107212e4bf441c7576fc52f0b590db4bc13f742ebbfd983" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.spongepowered" name="event-impl-gen-annotations" version="8.0.0">
<artifact name="event-impl-gen-annotations-8.0.0.jar">
<sha256 value="278e01efedb92a95be74714ea2bec08d29326b4893f6e957aa3bd39a15840776" origin="Generated by Gradle"/>
</artifact>
<artifact name="event-impl-gen-annotations-8.0.0.module">
<sha256 value="b0fddddd441038c0889450e8c0ebac970f0d606b246db99fd59c23c73e7ba534" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.spongepowered" name="math" version="2.0.1">
<artifact name="math-2.0.1-javadoc.jar">
<sha256 value="eef4d1e6421cd975ebdb7ae6be8632c0e89c0e8b671ee0fb542d8e6ddad2df12" origin="Generated by Gradle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private BlockData() {
}

// @formatter:off
public static void register(final DataProviderRegistrator registrator) {
@SuppressWarnings("deprecation") public static void register(final DataProviderRegistrator registrator) {
registrator
.asImmutable(Block.class)
.create(Keys.BLAST_RESISTANCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
*/
package org.spongepowered.common.event.tracking.context.transaction.effect;

import net.minecraft.world.ItemInteractionResult;
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.UseItemOnBlockPipeline;

public final class InteractionUseItemOnBlockEffect implements ProcessingSideEffect<UseItemOnBlockPipeline, ItemInteractionResult, InteractionAtArgs, ItemInteractionResult> {
public final class InteractionUseItemOnBlockEffect implements ProcessingSideEffect<UseItemOnBlockPipeline, InteractionResult, InteractionAtArgs, InteractionResult> {

private static final class Holder {
static final InteractionUseItemOnBlockEffect INSTANCE = new InteractionUseItemOnBlockEffect();
Expand All @@ -40,15 +40,15 @@ public static InteractionUseItemOnBlockEffect getInstance() {
}

@Override
public EffectResult<ItemInteractionResult> processSideEffect(
UseItemOnBlockPipeline pipeline, ItemInteractionResult oldState, InteractionAtArgs args
public EffectResult<InteractionResult> processSideEffect(
UseItemOnBlockPipeline pipeline, InteractionResult oldState, InteractionAtArgs args
) {
final var player = args.player();
final var hand = args.hand();
final var world = args.world();
final var blockRaytraceResult = args.blockRaytraceResult();
final var blockstate = args.blockstate();
final ItemInteractionResult result = blockstate.useItemOn(args.copiedStack(), world, player, hand, blockRaytraceResult);
final InteractionResult result = blockstate.useItemOn(args.copiedStack(), world, player, hand, blockRaytraceResult);
pipeline.transactor().logPlayerInventoryChange(args.player(), PlayerInventoryTransaction.EventCreator.STANDARD);
try (EffectTransactor ignored = BroadcastInventoryChangesEffect.transact(pipeline.transactor())) {
args.player().containerMenu.broadcastChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

import java.util.stream.Stream;

public abstract class CompositeTransaction<E extends CompositeEvent> extends GameTransaction<E> {
protected CompositeTransaction(TransactionType<? extends E> transactionType) {
public abstract class CompositeTransaction<E extends CompositeEvent<?>> extends GameTransaction<E> {
protected CompositeTransaction(TransactionType<? super E> transactionType) {
super(transactionType);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public UseBlockPipeline(ServerLevel worldIn,
}

public InteractionResult processInteraction(PhaseContext<?> context) {
var interaction = InteractionResult.PASS;
InteractionResult interaction = InteractionResult.PASS;
for (final var effect : this.effects) {
try (final EffectTransactor ignored = context.getTransactor().pushEffect(effect)) {
final InteractionAtArgs args = new InteractionAtArgs(this.worldIn, this.player, this.hand, this.blockRaytraceResult, this.blockstate, this.copiedStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public UseItemAtPipeline(ServerLevel worldIn,
}

public InteractionResult processInteraction(PhaseContext<?> context) {
var interaction = InteractionResult.PASS;
InteractionResult 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
Expand All @@ -51,7 +51,7 @@ public final class UseItemOnBlockPipeline {
private final BlockHitResult blockRaytraceResult;
private final BlockState blockstate;
private final ItemStack copiedStack;
private final List<ResultingTransactionBySideEffect<UseItemOnBlockPipeline, ItemInteractionResult, InteractionAtArgs, ItemInteractionResult>> effects;
private final List<ResultingTransactionBySideEffect<UseItemOnBlockPipeline, InteractionResult, InteractionAtArgs, InteractionResult>> effects;
private final TransactionalCaptureSupplier transactor;


Expand All @@ -75,18 +75,18 @@ public UseItemOnBlockPipeline(ServerLevel worldIn,
this.transactor = transactor;
}

public ItemInteractionResult processInteraction(PhaseContext<?> context) {
var interaction = ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
public InteractionResult processInteraction(PhaseContext<?> context) {
InteractionResult interaction = InteractionResult.TRY_WITH_EMPTY_HAND;
for (final var effect : this.effects) {
try (final EffectTransactor ignored = context.getTransactor().pushEffect(effect)) {
final InteractionAtArgs args = new InteractionAtArgs(this.worldIn, this.player, this.hand, this.blockRaytraceResult, this.blockstate, this.copiedStack);
final EffectResult<ItemInteractionResult> result = effect.effect.processSideEffect(
final EffectResult<InteractionResult> result = effect.effect.processSideEffect(
this,
interaction,
args
);
if (result.hasResult) {
final @Nullable ItemInteractionResult resultingState = result.resultingState;
final @Nullable InteractionResult resultingState = result.resultingState;
interaction = Objects.requireNonNullElse(resultingState, interaction);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public UseItemPipeline(ServerLevel worldIn,
}

public InteractionResult processInteraction(PhaseContext<?> context) {
var interaction = InteractionResult.PASS;
InteractionResult 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.copiedStack, this.player.gameMode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public final class TransactionTypes {

public static final DefaultedRegistryReference<TransactionType<InteractBlockEvent.Secondary.Post>> INTERACT_BLOCK_SECONDARY = TransactionTypes.key(ResourceKey.sponge("interact_block_secondary"));
public static final DefaultedRegistryReference<TransactionType<InteractItemEvent.Secondary.Post>> INTERACT_ITEM_SECONDARY = TransactionTypes.key(ResourceKey.sponge("interact_block_secondary"));
public static final DefaultedRegistryReference<TransactionType<SpawnEntityEvent>> SPAWN_ENTITY = TransactionTypes.key(ResourceKey.sponge("spawn_entity"));

// SORTFIELDS:OFF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class SpongeCommonRegistryLoader {
l.add(TransactionTypes.SCHEDULE_BLOCK_UPDATE, 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.SPAWN_ENTITY, k -> new NoOpTransactionType<>(false, k.value().toUpperCase(Locale.ROOT)));
});
}

Expand Down
Loading

0 comments on commit 5e670a9

Please sign in to comment.