diff --git a/gradle.properties b/gradle.properties index 786a57f..f12cba6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,10 +4,10 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21.1 -loader_version=0.16.14 +minecraft_version=1.21.4 +loader_version=0.17.2 -parchment_mappings=2024.11.17 +parchment_mappings=2025.03.23 # Mod Properties mod_version=1.9.2 @@ -15,12 +15,12 @@ maven_group=me.alexdevs archives_base_name=solstice # Dependencies -fabric_version=0.116.4+1.21.1 +fabric_version=0.119.4+1.21.4 configurate_version=4.1.2 -permissions_api_version=0.2-SNAPSHOT -placeholderapi_version=2.4.2+1.21 -sgui_version=1.6.1+1.21.1 -commoneconomy_version=1.1.1 +permissions_api_version=0.3.3 +placeholderapi_version=2.5.2+1.21.3 +sgui_version=1.8.2+1.21.4 +commoneconomy_version=1.2.0 trinkets_version=3.10.0 \ No newline at end of file diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/me/alexdevs/solstice/api/ServerLocation.java b/src/main/java/me/alexdevs/solstice/api/ServerLocation.java index a207aab..36a07ae 100644 --- a/src/main/java/me/alexdevs/solstice/api/ServerLocation.java +++ b/src/main/java/me/alexdevs/solstice/api/ServerLocation.java @@ -18,6 +18,7 @@ import net.minecraft.world.phys.Vec3; import java.util.Objects; +import java.util.Set; public class ServerLocation { protected final double x; @@ -80,7 +81,7 @@ public void teleport(ServerPlayer player, boolean setBackPosition) { player.setDeltaMovement(player.getDeltaMovement().multiply(1f, 0f, 1f)); player.setOnGround(true); - player.teleportTo(serverWorld, this.getX(), this.getY(), this.getZ(), this.getYaw(), this.getPitch()); + player.teleportTo(serverWorld, this.getX(), this.getY(), this.getZ(), Set.of(), this.getYaw(), this.getPitch(), false); // There is a bug (presumably in Fabric's api) that causes experience level to be set to 0 when teleporting between dimensions/worlds. // Therefore, this will update the experience client side as a temporary solution. diff --git a/src/main/java/me/alexdevs/solstice/mixin/modules/back/PreTeleportMixin.java b/src/main/java/me/alexdevs/solstice/mixin/modules/back/PreTeleportMixin.java index 7be2445..dc02b06 100644 --- a/src/main/java/me/alexdevs/solstice/mixin/modules/back/PreTeleportMixin.java +++ b/src/main/java/me/alexdevs/solstice/mixin/modules/back/PreTeleportMixin.java @@ -1,12 +1,10 @@ package me.alexdevs.solstice.mixin.modules.back; -import me.alexdevs.solstice.Solstice; import me.alexdevs.solstice.api.ServerLocation; import me.alexdevs.solstice.modules.ModuleProvider; -import me.alexdevs.solstice.modules.back.BackModule; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.RelativeMovement; +import net.minecraft.world.entity.Relative; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -16,9 +14,10 @@ @Mixin(ServerPlayer.class) public abstract class PreTeleportMixin { - @Inject(method = "teleportTo(Lnet/minecraft/server/level/ServerLevel;DDDLjava/util/Set;FF)Z", at = @At("HEAD")) - public void solstice$getPreTeleportLocation(ServerLevel world, double destX, double destY, double destZ, Set flags, float yaw, float pitch, CallbackInfoReturnable cir) { + @Inject(method = "teleportTo(Lnet/minecraft/server/level/ServerLevel;DDDLjava/util/Set;FFZ)Z", at = @At("HEAD")) + public void solstice$getPreTeleportLocation(ServerLevel world, double destX, double destY, double destZ, Set flags, float yaw, float pitch, boolean setCamera, CallbackInfoReturnable cir) { var player = (ServerPlayer) (Object) this; ModuleProvider.BACK.setPlayerLastLocation(player.getUUID(), new ServerLocation(player)); } + } diff --git a/src/main/java/me/alexdevs/solstice/mixin/modules/spawn/OverrideSpawnPointMixin.java b/src/main/java/me/alexdevs/solstice/mixin/modules/spawn/OverrideSpawnPointMixin.java index 2baa295..8602741 100644 --- a/src/main/java/me/alexdevs/solstice/mixin/modules/spawn/OverrideSpawnPointMixin.java +++ b/src/main/java/me/alexdevs/solstice/mixin/modules/spawn/OverrideSpawnPointMixin.java @@ -4,7 +4,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.level.portal.TeleportTransition; import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -22,8 +22,9 @@ public abstract class OverrideSpawnPointMixin { @Shadow private BlockPos respawnPosition; + @Inject(method = "findRespawnPositionAndUseSpawnBlock", at = @At("RETURN"), cancellable = true) - public void solstice$overrideRespawnTarget(boolean keepInventory, DimensionTransition.PostDimensionTransition postDimensionTransition, CallbackInfoReturnable cir) { + public void solstice$overrideRespawnTarget(boolean useCharge, TeleportTransition.PostTeleportTransition postTeleportTransition, CallbackInfoReturnable cir) { var spawnModule = ModuleProvider.SPAWN; var config = spawnModule.getConfig(); @@ -35,14 +36,13 @@ public abstract class OverrideSpawnPointMixin { spawn.getZ() ); - var transition = new DimensionTransition( + var transition = new TeleportTransition( world, pos, Vec3.ZERO, spawn.getYaw(), spawn.getPitch(), - false, - DimensionTransition.DO_NOTHING + TeleportTransition.DO_NOTHING ); if (config.globalSpawn.onRespawn) { @@ -54,4 +54,5 @@ public abstract class OverrideSpawnPointMixin { cir.setReturnValue(transition); } } + } diff --git a/src/main/java/me/alexdevs/solstice/modules/afk/AfkModule.java b/src/main/java/me/alexdevs/solstice/modules/afk/AfkModule.java index 08f2dac..d9f4e6e 100644 --- a/src/main/java/me/alexdevs/solstice/modules/afk/AfkModule.java +++ b/src/main/java/me/alexdevs/solstice/modules/afk/AfkModule.java @@ -21,7 +21,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; @@ -343,7 +342,7 @@ private void registerTriggers() { if (getConfig().triggers.onItemUse) { clearAfk((ServerPlayer) player, AfkTriggerReason.ITEM_USE); } - return InteractionResultHolder.pass(player.getItemInHand(hand)); + return InteractionResult.PASS; }); ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) -> { diff --git a/src/main/java/me/alexdevs/solstice/modules/jail/JailModule.java b/src/main/java/me/alexdevs/solstice/modules/jail/JailModule.java index a08de60..f3d7f8b 100644 --- a/src/main/java/me/alexdevs/solstice/modules/jail/JailModule.java +++ b/src/main/java/me/alexdevs/solstice/modules/jail/JailModule.java @@ -24,7 +24,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import java.util.Map; import java.util.UUID; @@ -88,24 +87,24 @@ public void init() { }); AttackBlockCallback.EVENT.register((player, world, hand, blockPos, direction) -> { - if (isPlayerJailed(player.getUUID())) { - player.sendSystemMessage(locale().get("cannotBreakBlocks")); + if (isPlayerJailed(player.getUUID()) && player instanceof ServerPlayer) { + ((ServerPlayer) player).sendSystemMessage(locale().get("cannotBreakBlocks")); return InteractionResult.FAIL; } return InteractionResult.PASS; }); AttackEntityCallback.EVENT.register((player, world, hand, entity, entityHitResult) -> { - if (isPlayerJailed(player.getUUID())) { - player.sendSystemMessage(locale().get("cannotAttackEntities")); + if (isPlayerJailed(player.getUUID()) && player instanceof ServerPlayer) { + ((ServerPlayer) player).sendSystemMessage(locale().get("cannotAttackEntities")); return InteractionResult.FAIL; } return InteractionResult.PASS; }); PlayerBlockBreakEvents.BEFORE.register((world, player, blockPos, blockState, blockEntity) -> { - if (isPlayerJailed(player.getUUID())) { - player.sendSystemMessage(locale().get("cannotBreakBlocks")); + if (isPlayerJailed(player.getUUID()) && player instanceof ServerPlayer) { + ((ServerPlayer) player).sendSystemMessage(locale().get("cannotBreakBlocks")); return false; } @@ -113,28 +112,27 @@ public void init() { }); UseBlockCallback.EVENT.register((player, world, hand, blockHitResult) -> { - if (isPlayerJailed(player.getUUID())) { - player.sendSystemMessage(locale().get("cannotUseBlocks")); + if (isPlayerJailed(player.getUUID()) && player instanceof ServerPlayer) { + ((ServerPlayer) player).sendSystemMessage(locale().get("cannotUseBlocks")); return InteractionResult.FAIL; } return InteractionResult.PASS; }); UseEntityCallback.EVENT.register((player, world, hand, entity, entityHitResult) -> { - if (isPlayerJailed(player.getUUID())) { - player.sendSystemMessage(locale().get("cannotUseEntities")); + if (isPlayerJailed(player.getUUID()) && player instanceof ServerPlayer) { + ((ServerPlayer) player).sendSystemMessage(locale().get("cannotUseEntities")); return InteractionResult.FAIL; } return InteractionResult.PASS; }); UseItemCallback.EVENT.register((player, world, hand) -> { - var stack = player.getItemInHand(hand); - if (isPlayerJailed(player.getUUID())) { - player.sendSystemMessage(locale().get("cannotUseItems")); - return InteractionResultHolder.fail(stack); + if (isPlayerJailed(player.getUUID()) && player instanceof ServerPlayer) { + ((ServerPlayer) player).sendSystemMessage(locale().get("cannotUseItems")); + return InteractionResult.FAIL; } - return InteractionResultHolder.pass(stack); + return InteractionResult.PASS; }); ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((signedMessage, player, parameters) -> { diff --git a/src/main/java/me/alexdevs/solstice/modules/miscellaneous/commands/KittyCannonCommand.java b/src/main/java/me/alexdevs/solstice/modules/miscellaneous/commands/KittyCannonCommand.java index 28587bc..60d867f 100644 --- a/src/main/java/me/alexdevs/solstice/modules/miscellaneous/commands/KittyCannonCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/miscellaneous/commands/KittyCannonCommand.java @@ -9,7 +9,7 @@ import net.minecraft.commands.Commands; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntitySpawnReason; import java.util.List; import java.util.concurrent.TimeUnit; @@ -45,7 +45,7 @@ public LiteralArgumentBuilder command(String name) { DummyExplosion.spawn(world, pos, 0); entity.remove(Entity.RemovalReason.DISCARDED); }, 1, TimeUnit.SECONDS); - }, player.blockPosition().above(), MobSpawnType.COMMAND, true, false); + }, player.blockPosition().above(), EntitySpawnReason.COMMAND, true, false); return 1; diff --git a/src/main/java/me/alexdevs/solstice/modules/powertool/PowerToolModule.java b/src/main/java/me/alexdevs/solstice/modules/powertool/PowerToolModule.java index 661a0d6..2545d83 100644 --- a/src/main/java/me/alexdevs/solstice/modules/powertool/PowerToolModule.java +++ b/src/main/java/me/alexdevs/solstice/modules/powertool/PowerToolModule.java @@ -14,8 +14,8 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionResult; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.item.ItemStack; import java.util.UUID; @@ -46,14 +46,14 @@ public void init() { if (data.powerTools.containsKey(itemId)) { var powertool = data.powerTools.get(itemId); if (powertool.containsKey(Action.USE)) { - var source = player.createCommandSourceStack(); + var source = player.createCommandSourceStackForNameResolution(((ServerLevel) player.level())); execute(source, powertool.get(Action.USE), PlaceholderContext.of(player)); - return InteractionResultHolder.consume(stack); + return InteractionResult.CONSUME; } } } - return InteractionResultHolder.pass(stack); + return InteractionResult.PASS; }); // ATTACK_BLOCK @@ -65,7 +65,7 @@ public void init() { if (data.powerTools.containsKey(itemId)) { var powertool = data.powerTools.get(itemId); if (powertool.containsKey(Action.ATTACK_BLOCK)) { - var source = player.createCommandSourceStack(); + var source = player.createCommandSourceStackForNameResolution(((ServerLevel) player.level())); execute(source, powertool.get(Action.ATTACK_BLOCK), PlaceholderContext.of(player)); return InteractionResult.CONSUME; @@ -84,7 +84,7 @@ public void init() { if (data.powerTools.containsKey(itemId)) { var powertool = data.powerTools.get(itemId); if (powertool.containsKey(Action.ATTACK_ENTITY)) { - var source = player.createCommandSourceStack(); + var source = player.createCommandSourceStackForNameResolution(((ServerLevel) player.level())); execute(source, powertool.get(Action.ATTACK_ENTITY), PlaceholderContext.of(entity)); return InteractionResult.CONSUME; @@ -103,7 +103,7 @@ public void init() { if (data.powerTools.containsKey(itemId)) { var powertool = data.powerTools.get(itemId); if (powertool.containsKey(Action.INTERACT_BLOCK)) { - var source = player.createCommandSourceStack(); + var source = player.createCommandSourceStackForNameResolution(((ServerLevel) player.level())); execute(source, powertool.get(Action.INTERACT_BLOCK), PlaceholderContext.of(player)); return InteractionResult.CONSUME; @@ -122,7 +122,7 @@ public void init() { if (data.powerTools.containsKey(itemId)) { var powertool = data.powerTools.get(itemId); if (powertool.containsKey(Action.INTERACT_ENTITY)) { - var source = player.createCommandSourceStack(); + var source = player.createCommandSourceStackForNameResolution(((ServerLevel) player.level())); execute(source, powertool.get(Action.INTERACT_ENTITY), PlaceholderContext.of(entity)); return InteractionResult.CONSUME; diff --git a/src/main/java/me/alexdevs/solstice/modules/rtp/core/Locator.java b/src/main/java/me/alexdevs/solstice/modules/rtp/core/Locator.java index 87d1845..c71a5c2 100644 --- a/src/main/java/me/alexdevs/solstice/modules/rtp/core/Locator.java +++ b/src/main/java/me/alexdevs/solstice/modules/rtp/core/Locator.java @@ -122,7 +122,7 @@ private BlockPos getTopBlock(BlockPos pos) { } private BlockPos getEmptySpace(BlockPos pos) { - var bottom = chunk.getMinBuildHeight(); + var bottom = chunk.getMinY(); var top = world.getLogicalHeight(); var blockPos = new BlockPos.MutableBlockPos(pos.getX(), top, pos.getZ()); @@ -151,10 +151,10 @@ private void findValidPlacement() { var dx = i % 16; var dz = i / 16; - pos = chunk.getPos().getBlockAt(dx, chunk.getMinBuildHeight(), dz); + pos = chunk.getPos().getBlockAt(dx, chunk.getMinY(), dz); } - if (pos.getY() <= chunk.getMinBuildHeight()) { + if (pos.getY() <= chunk.getMinY()) { callback.accept(new Result(Result.Type.UNSAFE, Optional.empty())); return; } diff --git a/src/main/java/me/alexdevs/solstice/modules/smite/commands/SmiteCommand.java b/src/main/java/me/alexdevs/solstice/modules/smite/commands/SmiteCommand.java index 8579427..611ae3c 100644 --- a/src/main/java/me/alexdevs/solstice/modules/smite/commands/SmiteCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/smite/commands/SmiteCommand.java @@ -12,7 +12,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntitySpawnReason; import net.minecraft.world.phys.HitResult; import java.util.List; @@ -85,7 +85,7 @@ private void summon(ServerLevel world, BlockPos pos) { world, world::addFreshEntity, pos, - MobSpawnType.COMMAND, + EntitySpawnReason.COMMAND, false, false); } diff --git a/src/main/java/me/alexdevs/solstice/modules/sudo/commands/DoAsCommand.java b/src/main/java/me/alexdevs/solstice/modules/sudo/commands/DoAsCommand.java index 726e46c..b0110e8 100644 --- a/src/main/java/me/alexdevs/solstice/modules/sudo/commands/DoAsCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/sudo/commands/DoAsCommand.java @@ -75,7 +75,7 @@ public LiteralArgumentBuilder command(String name) { CommandSource commandOutput; if (context.getSource().isPlayer()) { - commandOutput = context.getSource().getPlayer(); + commandOutput = context.getSource().getPlayer().commandSource(); } else { commandOutput = context.getSource().getServer(); } diff --git a/src/main/java/me/alexdevs/solstice/modules/sudo/commands/SudoCommand.java b/src/main/java/me/alexdevs/solstice/modules/sudo/commands/SudoCommand.java index da8f1c4..d45c77d 100644 --- a/src/main/java/me/alexdevs/solstice/modules/sudo/commands/SudoCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/sudo/commands/SudoCommand.java @@ -52,7 +52,7 @@ public LiteralArgumentBuilder command(String name) { CommandSource commandOutput; if (context.getSource().isPlayer()) { - commandOutput = context.getSource().getPlayer(); + commandOutput = context.getSource().getPlayer().commandSource(); } else { commandOutput = context.getSource().getServer(); } diff --git a/src/main/java/me/alexdevs/solstice/modules/suicide/commands/SuicideCommand.java b/src/main/java/me/alexdevs/solstice/modules/suicide/commands/SuicideCommand.java index acc15bd..aea3c69 100644 --- a/src/main/java/me/alexdevs/solstice/modules/suicide/commands/SuicideCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/suicide/commands/SuicideCommand.java @@ -26,7 +26,7 @@ public LiteralArgumentBuilder command(String name) { .executes(context -> { var player = context.getSource().getPlayerOrException(); - player.kill(); + player.kill(player.serverLevel()); return 1; }); diff --git a/src/main/java/me/alexdevs/solstice/modules/teleportHere/commands/TeleportHereCommand.java b/src/main/java/me/alexdevs/solstice/modules/teleportHere/commands/TeleportHereCommand.java index 29cd2ac..13a9bc9 100644 --- a/src/main/java/me/alexdevs/solstice/modules/teleportHere/commands/TeleportHereCommand.java +++ b/src/main/java/me/alexdevs/solstice/modules/teleportHere/commands/TeleportHereCommand.java @@ -39,7 +39,7 @@ public LiteralArgumentBuilder command(String name) { var targets = EntityArgument.getEntities(context, "targets"); targets.forEach(target -> { - target.teleportTo(world, vec3d.x, vec3d.y, vec3d.z, Set.of(), yaw, pitch); + target.teleportTo(world, vec3d.x, vec3d.y, vec3d.z, Set.of(), yaw, pitch,false); target.setDeltaMovement(target.getDeltaMovement().multiply(1.0, 0.0, 1.0)); target.setOnGround(true);