Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ 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
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
Empty file modified gradlew
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion src/main/java/me/alexdevs/solstice/api/ServerLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<RelativeMovement> flags, float yaw, float pitch, CallbackInfoReturnable<Boolean> 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<Relative> flags, float yaw, float pitch, boolean setCamera, CallbackInfoReturnable<Boolean> cir) {
var player = (ServerPlayer) (Object) this;
ModuleProvider.BACK.setPlayerLastLocation(player.getUUID(), new ServerLocation(player));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<DimensionTransition> cir) {
public void solstice$overrideRespawnTarget(boolean useCharge, TeleportTransition.PostTeleportTransition postTeleportTransition, CallbackInfoReturnable<Object> cir) {
var spawnModule = ModuleProvider.SPAWN;
var config = spawnModule.getConfig();

Expand All @@ -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) {
Expand All @@ -54,4 +54,5 @@ public abstract class OverrideSpawnPointMixin {
cir.setReturnValue(transition);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) -> {
Expand Down
30 changes: 14 additions & 16 deletions src/main/java/me/alexdevs/solstice/modules/jail/JailModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -88,53 +87,52 @@ 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;
}

return true;
});

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) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -45,7 +45,7 @@ public LiteralArgumentBuilder<CommandSourceStack> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -85,7 +85,7 @@ private void summon(ServerLevel world, BlockPos pos) {
world,
world::addFreshEntity,
pos,
MobSpawnType.COMMAND,
EntitySpawnReason.COMMAND,
false,
false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public LiteralArgumentBuilder<CommandSourceStack> command(String name) {

CommandSource commandOutput;
if (context.getSource().isPlayer()) {
commandOutput = context.getSource().getPlayer();
commandOutput = context.getSource().getPlayer().commandSource();
} else {
commandOutput = context.getSource().getServer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public LiteralArgumentBuilder<CommandSourceStack> command(String name) {

CommandSource commandOutput;
if (context.getSource().isPlayer()) {
commandOutput = context.getSource().getPlayer();
commandOutput = context.getSource().getPlayer().commandSource();
} else {
commandOutput = context.getSource().getServer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public LiteralArgumentBuilder<CommandSourceStack> command(String name) {
.executes(context -> {
var player = context.getSource().getPlayerOrException();

player.kill();
player.kill(player.serverLevel());

return 1;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public LiteralArgumentBuilder<CommandSourceStack> 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);

Expand Down