From d06ec29c60e778057d3399fa10081df6575ab0c4 Mon Sep 17 00:00:00 2001 From: Drex Date: Thu, 22 Aug 2024 21:06:02 +0200 Subject: [PATCH] Update to 24w34a --- gradle/wrapper/gradle-wrapper.properties | 2 +- libs.versions.toml | 10 +++++----- .../ledger/mixin/AbstractBlockMixin.java | 15 +++++++-------- .../ledger/mixin/BlockItemMixin.java | 5 ++++- .../ledger/mixin/BucketItemMixin.java | 5 ++--- ...xplosionMixin.java => ExplosionImplMixin.java} | 15 +++++++-------- .../mixin/JukeboxPlayableComponentMixin.java | 4 ++-- .../ledger/mixin/blocks/CakeBlockMixin.java | 3 +-- .../ledger/mixin/blocks/CampfireBlockMixin.java | 4 ++-- .../ledger/mixin/blocks/DoorBlockMixin.java | 3 ++- .../ledger/mixin/blocks/FenceGateBlockMixin.java | 3 ++- .../ledger/mixin/blocks/TrapdoorBlockMixin.java | 3 ++- .../mixin/entities/EndCrystalEntityMixin.java | 2 +- ...ityMixin.java => ServerPlayerEntityMixin.java} | 11 ++++++----- .../ledger/actions/EntityKillActionType.kt | 5 +++-- .../ledger/commands/parameters/ObjectParameter.kt | 6 +++--- .../commands/subcommands/TeleportCommand.kt | 2 +- src/main/resources/fabric.mod.json | 4 ++-- src/main/resources/ledger.mixins.json | 4 ++-- 19 files changed, 55 insertions(+), 51 deletions(-) rename src/main/java/com/github/quiltservertools/ledger/mixin/{ExplosionMixin.java => ExplosionImplMixin.java} (79%) rename src/main/java/com/github/quiltservertools/ledger/mixin/entities/{PlayerEntityMixin.java => ServerPlayerEntityMixin.java} (63%) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a..9355b415 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/libs.versions.toml b/libs.versions.toml index 5836b88c..87d332c3 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -1,9 +1,9 @@ [versions] -minecraft = "1.21" -yarn-mappings = "1.21+build.1" -fabric-loader = "0.15.11" +minecraft = "24w34a" +yarn-mappings = "24w34a+build.3" +fabric-loader = "0.16.2" -fabric-api = "0.100.1+1.21" +fabric-api = "0.102.3+1.21.2" # Kotlin kotlin = "2.0.0" @@ -48,7 +48,7 @@ wdmcf = { module = "me.bymartrixx:wdmcf", version.ref = "wdmcf" } [plugins] kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detect" } -loom = { id = "fabric-loom", version = "1.6.+" } +loom = { id = "fabric-loom", version = "1.7.+" } git_hooks = { id = "com.github.jakemarsden.git-hooks", version = "0.0.2" } # https://github.com/johnrengelman/shadow/issues/894 shadow = { id = "io.github.goooler.shadow", version = "8.1.7" } diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/AbstractBlockMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/AbstractBlockMixin.java index eeb6518d..3ebc620d 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/AbstractBlockMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/AbstractBlockMixin.java @@ -3,32 +3,31 @@ import com.github.quiltservertools.ledger.callbacks.BlockBreakCallback; import com.github.quiltservertools.ledger.utility.PlayerCausable; import com.github.quiltservertools.ledger.utility.Sources; +import java.util.function.BiConsumer; import net.minecraft.block.AbstractBlock; import net.minecraft.block.BlockState; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; +import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import net.minecraft.world.explosion.Explosion; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.function.BiConsumer; - @Mixin(AbstractBlock.class) public abstract class AbstractBlockMixin { @Inject( method = "onExploded", at = @At( - value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z" + value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z" ) ) - private void ledgerBlockExplodeCallback(BlockState blockState, World world, BlockPos blockPos, Explosion explosion, BiConsumer biConsumer, CallbackInfo ci) { + private void ledgerBlockExplodeCallback(BlockState state, ServerWorld world, BlockPos pos, Explosion explosion, BiConsumer stackMerger, CallbackInfo ci) { LivingEntity entity; if (explosion.getCausingEntity() instanceof PlayerCausable playerCausable && playerCausable.getCausingPlayer() != null) { entity = playerCausable.getCausingPlayer(); @@ -45,9 +44,9 @@ private void ledgerBlockExplodeCallback(BlockState blockState, World world, Bloc BlockBreakCallback.EVENT.invoker().breakBlock( world, - blockPos, - blockState, - world.getBlockEntity(blockPos) != null ? world.getBlockEntity(blockPos) : null, + pos, + state, + world.getBlockEntity(pos) != null ? world.getBlockEntity(pos) : null, source, entity instanceof PlayerEntity player ? player : null ); diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/BlockItemMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/BlockItemMixin.java index 7f1870b0..2127ea3d 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/BlockItemMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/BlockItemMixin.java @@ -23,7 +23,10 @@ public BlockItemMixin(Settings settings) { @Inject( method = "place(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/util/ActionResult;", - at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;success(Z)Lnet/minecraft/util/ActionResult;") + at = @At( + value = "FIELD", + target = "Lnet/minecraft/util/ActionResult;SUCCESS_SERVER:Lnet/minecraft/util/ActionResult$Success;" + ) ) public void ledgerPlayerPlaceBlockCallback(ItemPlacementContext context, CallbackInfoReturnable cir) { World world = context.getWorld(); diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/BucketItemMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/BucketItemMixin.java index c335a9c0..a8d446ba 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/BucketItemMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/BucketItemMixin.java @@ -10,9 +10,8 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.item.BucketItem; -import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.TypedActionResult; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -73,7 +72,7 @@ private void logWaterlog(PlayerEntity player, World world, BlockPos pos, BlockHi } @Inject(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;incrementStat(Lnet/minecraft/stat/Stat;)V", ordinal = 0)) - private void logFluidPickup(World world, PlayerEntity player, Hand hand, CallbackInfoReturnable> cir, @Local(ordinal = 0) BlockPos pos, @Local BlockState blockState) { + private void logFluidPickup(World world, PlayerEntity player, Hand hand, CallbackInfoReturnable cir, @Local(ordinal = 0) BlockPos pos, @Local BlockState blockState) { if (blockState.getBlock() instanceof Waterloggable) { BlockChangeCallback.EVENT.invoker().changeBlock( world, diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/ExplosionMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/ExplosionImplMixin.java similarity index 79% rename from src/main/java/com/github/quiltservertools/ledger/mixin/ExplosionMixin.java rename to src/main/java/com/github/quiltservertools/ledger/mixin/ExplosionImplMixin.java index e71e42e4..7b5717fb 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/ExplosionMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/ExplosionImplMixin.java @@ -4,7 +4,7 @@ import com.github.quiltservertools.ledger.utility.PlayerCausable; import com.github.quiltservertools.ledger.utility.Sources; import com.llamalad7.mixinextras.sugar.Local; -import it.unimi.dsi.fastutil.objects.ObjectListIterator; +import java.util.List; import net.minecraft.block.AbstractFireBlock; import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; @@ -13,7 +13,7 @@ import net.minecraft.registry.Registries; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.explosion.Explosion; +import net.minecraft.world.explosion.ExplosionImpl; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -22,8 +22,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(Explosion.class) -public abstract class ExplosionMixin { +@Mixin(ExplosionImpl.class) +public abstract class ExplosionImplMixin { @Shadow @Final private World world; @@ -37,14 +37,13 @@ public abstract class ExplosionMixin { private Entity entity; @Inject( - method = "affectWorld", + method = "createFire", at = @At( value = "INVOKE", - target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z" + target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z" ) ) - private void ledgerExplosionFireCallback(boolean particles, CallbackInfo ci, - @Local ObjectListIterator affectedBlocks, @Local BlockPos blockPos) { + private void ledgerExplosionFireCallback(List positions, CallbackInfo ci, @Local BlockPos blockPos) { BlockState blockState = AbstractFireBlock.getState(world, blockPos); LivingEntity entity; diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/JukeboxPlayableComponentMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/JukeboxPlayableComponentMixin.java index accd681e..eefee657 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/JukeboxPlayableComponentMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/JukeboxPlayableComponentMixin.java @@ -6,7 +6,7 @@ import net.minecraft.component.type.JukeboxPlayableComponent; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.ItemActionResult; +import net.minecraft.util.ActionResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; @@ -22,7 +22,7 @@ public abstract class JukeboxPlayableComponentMixin { @Inject(method = "tryPlayStack", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/JukeboxBlockEntity;setStack(Lnet/minecraft/item/ItemStack;)V")) - private static void ledgerPlayerInsertMusicDisc(World world, BlockPos pos, ItemStack itemStack, PlayerEntity player, CallbackInfoReturnable cir) { + private static void ledgerPlayerInsertMusicDisc(World world, BlockPos pos, ItemStack itemStack, PlayerEntity player, CallbackInfoReturnable cir) { BlockState blockState = world.getBlockState(pos); BlockChangeCallback.EVENT.invoker().changeBlock( diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/CakeBlockMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/CakeBlockMixin.java index c78dc1f6..d116adac 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/CakeBlockMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/CakeBlockMixin.java @@ -9,7 +9,6 @@ import net.minecraft.state.property.IntProperty; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.ItemActionResult; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -62,7 +61,7 @@ private static void ledgerLogCakeEatAndRemove( target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z", shift = At.Shift.AFTER)) private void ledgerLogCakeAddCandle( - ItemStack itemStack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable cir) { + ItemStack itemStack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable cir) { BlockChangeCallback.EVENT.invoker().changeBlock( player.getWorld(), pos, diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/CampfireBlockMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/CampfireBlockMixin.java index 09e62653..98b5daed 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/CampfireBlockMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/CampfireBlockMixin.java @@ -11,8 +11,8 @@ import net.minecraft.entity.projectile.ProjectileEntity; import net.minecraft.item.ItemStack; import net.minecraft.state.property.BooleanProperty; +import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.ItemActionResult; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -35,7 +35,7 @@ public abstract class CampfireBlockMixin { @Inject(method = "onUseWithItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;incrementStat(Lnet/minecraft/util/Identifier;)V") ) - public void logCampfireAddItem(ItemStack itemStack, BlockState blockState, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable cir, @Local BlockEntity oldBlockEntity) { + public void logCampfireAddItem(ItemStack itemStack, BlockState blockState, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable cir, @Local BlockEntity oldBlockEntity) { BlockChangeCallback.EVENT.invoker().changeBlock(world, pos, blockState, world.getBlockState(pos), oldBlockEntity, world.getBlockEntity(pos), Sources.INSERT, player); } diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/DoorBlockMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/DoorBlockMixin.java index 72e07366..2c627b56 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/DoorBlockMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/DoorBlockMixin.java @@ -11,6 +11,7 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.block.WireOrientation; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -31,7 +32,7 @@ public void logDoorInteraction(BlockState state, World world, BlockPos pos, Play } @Inject(method = "neighborUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z")) - public void logRedstoneDoorInteraction(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify, CallbackInfo ci) { + public void logRedstoneDoorInteraction(BlockState state, World world, BlockPos pos, Block sourceBlock, WireOrientation wireOrientation, boolean notify, CallbackInfo ci) { BlockChangeCallback.EVENT.invoker().changeBlock(world, pos, state, state.cycle(OPEN), null, null, Sources.REDSTONE); } } diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/FenceGateBlockMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/FenceGateBlockMixin.java index 5fb7f3fd..206dc4a3 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/FenceGateBlockMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/FenceGateBlockMixin.java @@ -11,6 +11,7 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.block.WireOrientation; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -31,7 +32,7 @@ public void logFenceGateInteraction(BlockState state, World world, BlockPos pos, } @Inject(method = "neighborUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z")) - public void logRedstoneFenceGateInteraction(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify, CallbackInfo ci) { + public void logRedstoneFenceGateInteraction(BlockState state, World world, BlockPos pos, Block sourceBlock, WireOrientation wireOrientation, boolean notify, CallbackInfo ci) { BlockChangeCallback.EVENT.invoker().changeBlock(world, pos, state, state.cycle(OPEN), null, null, Sources.REDSTONE); } } diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/TrapdoorBlockMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/TrapdoorBlockMixin.java index f14af511..d2047f48 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/TrapdoorBlockMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/blocks/TrapdoorBlockMixin.java @@ -9,6 +9,7 @@ import net.minecraft.state.property.BooleanProperty; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.block.WireOrientation; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -28,7 +29,7 @@ public void logTrapdoorInteraction(BlockState state, World world, BlockPos pos, } @Inject(method = "neighborUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z")) - public void logTrapdoorRedstoneInteraction(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify, CallbackInfo ci) { + public void logTrapdoorRedstoneInteraction(BlockState state, World world, BlockPos pos, Block sourceBlock, WireOrientation wireOrientation, boolean notify, CallbackInfo ci) { BlockChangeCallback.EVENT.invoker().changeBlock(world, pos, state, state.cycle(OPEN), null, null, Sources.REDSTONE); } } diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/entities/EndCrystalEntityMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/entities/EndCrystalEntityMixin.java index 340a0ea1..3056ab2c 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/entities/EndCrystalEntityMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/entities/EndCrystalEntityMixin.java @@ -23,7 +23,7 @@ public PlayerEntity getCausingPlayer() { return causingPlayer; } - @Inject(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;createExplosion(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/damage/DamageSource;Lnet/minecraft/world/explosion/ExplosionBehavior;DDDFZLnet/minecraft/world/World$ExplosionSourceType;)Lnet/minecraft/world/explosion/Explosion;")) + @Inject(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;createExplosion(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/damage/DamageSource;Lnet/minecraft/world/explosion/ExplosionBehavior;DDDFZLnet/minecraft/world/World$ExplosionSourceType;)V")) public void correctEndCrystalEntitySource(DamageSource source, float amount, CallbackInfoReturnable cir) { if (source.getSource() instanceof PlayerEntity player) { this.causingPlayer = player; diff --git a/src/main/java/com/github/quiltservertools/ledger/mixin/entities/PlayerEntityMixin.java b/src/main/java/com/github/quiltservertools/ledger/mixin/entities/ServerPlayerEntityMixin.java similarity index 63% rename from src/main/java/com/github/quiltservertools/ledger/mixin/entities/PlayerEntityMixin.java rename to src/main/java/com/github/quiltservertools/ledger/mixin/entities/ServerPlayerEntityMixin.java index f121a672..1770b0da 100644 --- a/src/main/java/com/github/quiltservertools/ledger/mixin/entities/PlayerEntityMixin.java +++ b/src/main/java/com/github/quiltservertools/ledger/mixin/entities/ServerPlayerEntityMixin.java @@ -1,19 +1,20 @@ package com.github.quiltservertools.ledger.mixin.entities; import com.github.quiltservertools.ledger.callbacks.ItemDropCallback; +import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.entity.ItemEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.server.network.ServerPlayerEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -@Mixin(PlayerEntity.class) -public abstract class PlayerEntityMixin { - @Inject(method = "dropItem(Lnet/minecraft/item/ItemStack;ZZ)Lnet/minecraft/entity/ItemEntity;", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ItemEntity;setPickupDelay(I)V"), locals = LocalCapture.CAPTURE_FAILEXCEPTION) - private void logPlayerItemDrop(ItemStack stack, boolean throwRandomly, boolean retainOwnership, CallbackInfoReturnable cir, double d, ItemEntity itemEntity) { +@Mixin(ServerPlayerEntity.class) +public abstract class ServerPlayerEntityMixin { + @Inject(method = "dropPlayerItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ItemEntity;setPickupDelay(I)V")) + private void logPlayerItemDrop(ItemStack stack, boolean throwRandomly, boolean retainOwnership, CallbackInfoReturnable cir, @Local ItemEntity itemEntity) { PlayerEntity player = (PlayerEntity) (Object) this; ItemDropCallback.EVENT.invoker().drop(itemEntity, player); } diff --git a/src/main/kotlin/com/github/quiltservertools/ledger/actions/EntityKillActionType.kt b/src/main/kotlin/com/github/quiltservertools/ledger/actions/EntityKillActionType.kt index a0924f88..5012c7df 100644 --- a/src/main/kotlin/com/github/quiltservertools/ledger/actions/EntityKillActionType.kt +++ b/src/main/kotlin/com/github/quiltservertools/ledger/actions/EntityKillActionType.kt @@ -5,6 +5,7 @@ import com.github.quiltservertools.ledger.utility.UUID import com.github.quiltservertools.ledger.utility.getWorld import net.minecraft.entity.Entity import net.minecraft.entity.LivingEntity +import net.minecraft.entity.SpawnReason import net.minecraft.nbt.StringNbtReader import net.minecraft.registry.Registries import net.minecraft.server.MinecraftServer @@ -23,7 +24,7 @@ class EntityKillActionType : AbstractActionType() { val entityType = Registries.ENTITY_TYPE.getOrEmpty(objectIdentifier) if (entityType.isEmpty) return - val entity: LivingEntity = (entityType.get().create(world) as LivingEntity?)!! + val entity: LivingEntity = (entityType.get().create(world, SpawnReason.COMMAND) as LivingEntity?)!! entity.readNbt(StringNbtReader.parse(extraData)) entity.health = entity.defaultMaxHealth.toFloat() entity.velocity = Vec3d.ZERO @@ -53,7 +54,7 @@ class EntityKillActionType : AbstractActionType() { val entityType = Registries.ENTITY_TYPE.getOrEmpty(objectIdentifier) if (entityType.isPresent) { - val entity = entityType.get().create(world)!! + val entity = entityType.get().create(world, SpawnReason.COMMAND)!! entity.readNbt(StringNbtReader.parse(extraData)) entity.velocity = Vec3d.ZERO entity.fireTicks = 0 diff --git a/src/main/kotlin/com/github/quiltservertools/ledger/commands/parameters/ObjectParameter.kt b/src/main/kotlin/com/github/quiltservertools/ledger/commands/parameters/ObjectParameter.kt index a7772a33..1952660a 100644 --- a/src/main/kotlin/com/github/quiltservertools/ledger/commands/parameters/ObjectParameter.kt +++ b/src/main/kotlin/com/github/quiltservertools/ledger/commands/parameters/ObjectParameter.kt @@ -54,9 +54,9 @@ class ObjectParameter : SimpleParameter>() { return if (builder.remaining.startsWith("#")) { CommandSource.suggestIdentifiers( mutableListOf().apply { - addAll(Registries.BLOCK.streamTags().map { it.id }.toList()) - addAll(Registries.ITEM.streamTags().map { it.id }.toList()) - addAll(Registries.ENTITY_TYPE.streamTags().map { it.id }.toList()) + addAll(Registries.BLOCK.streamTags().map { it.tag.id }.toList()) + addAll(Registries.ITEM.streamTags().map { it.tag.id }.toList()) + addAll(Registries.ENTITY_TYPE.streamTags().map { it.tag.id }.toList()) }, builder.createOffset(builder.start + 1) ) diff --git a/src/main/kotlin/com/github/quiltservertools/ledger/commands/subcommands/TeleportCommand.kt b/src/main/kotlin/com/github/quiltservertools/ledger/commands/subcommands/TeleportCommand.kt index 4fc652b9..664bf772 100644 --- a/src/main/kotlin/com/github/quiltservertools/ledger/commands/subcommands/TeleportCommand.kt +++ b/src/main/kotlin/com/github/quiltservertools/ledger/commands/subcommands/TeleportCommand.kt @@ -33,7 +33,7 @@ object TeleportCommand : BuildableCommand { private fun teleport(context: Context, world: ServerWorld, posArg: PosArgument): Int { val player = context.source.playerOrThrow val pos = posArg.toAbsolutePos(context.source) - player.teleport(world, pos.x, pos.y, pos.z, player.yaw, player.pitch) + player.teleport(world, pos.x, pos.y, pos.z, player.yaw, player.pitch, true) return 1 } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 567ca7d4..d8e41d13 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,10 +26,10 @@ "ledger.mixins.json" ], "depends": { - "fabricloader": ">=0.15.10", + "fabricloader": ">=0.16.2", "fabric": ">=${fabricApi}", "fabric-language-kotlin": ">=${fabricKotlin}", - "minecraft": ">=${minecraft}" + "minecraft": ">=1.21.2-alpha.24.34.a" }, "breaks": { "cardboard": "*" diff --git a/src/main/resources/ledger.mixins.json b/src/main/resources/ledger.mixins.json index 3707605d..bc4f66d4 100644 --- a/src/main/resources/ledger.mixins.json +++ b/src/main/resources/ledger.mixins.json @@ -12,7 +12,7 @@ "CampfireBlockEntityMixin", "DoubleInventoryMixin", "DyeItemMixin", - "ExplosionMixin", + "ExplosionImplMixin", "FillCommandMixin", "FlintAndSteelItemMixin", "FrostWalkerEnchantmentMixin", @@ -84,7 +84,7 @@ "entities.ItemFrameEntityMixin", "entities.LightningEntityMixin", "entities.LivingEntityMixin", - "entities.PlayerEntityMixin", + "entities.ServerPlayerEntityMixin", "entities.RavagerEntityMixin", "entities.SheepEntityMixin", "entities.SnowGolemEntityMixin",