Support for Minecraft 1.21.6
This commit is contained in:
9 files changed
+24
-37
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// To change the versions see the gradle.properties file
|
// To change the versions see the gradle.properties file1
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
# Done to increase the memory available to gradle.
|
# Done to increase the memory available to gradle.
|
||||||
org.gradle.jvmargs=-Xmx4G
|
org.gradle.jvmargs=-Xmx4G
|
||||||
minecraft_version=1.21.5
|
minecraft_version=1.21.6
|
||||||
yarn_mappings=1.21.5+build.1
|
yarn_mappings=1.21.6+build.1
|
||||||
loader_version=0.16.10
|
loader_version=0.16.14
|
||||||
# Fabric API
|
# Fabric API
|
||||||
fabric_version=0.119.5+1.21.5
|
fabric_version=0.127.0+1.21.6
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.1
|
mod_version=1.1
|
||||||
maven_group=io.ib67
|
maven_group=io.ib67
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.ib67.sfcraft.mixin.common.fixes;
|
package io.ib67.sfcraft.mixin.common.fixes;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.LazyEntityReference;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.projectile.ProjectileEntity;
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
@@ -18,10 +19,8 @@ import java.util.UUID;
|
|||||||
@Mixin(ProjectileEntity.class)
|
@Mixin(ProjectileEntity.class)
|
||||||
public class ProjectileEntityMixin {
|
public class ProjectileEntityMixin {
|
||||||
@Shadow
|
@Shadow
|
||||||
private @Nullable Entity owner;
|
@Nullable
|
||||||
|
protected LazyEntityReference<Entity> owner;
|
||||||
@Shadow
|
|
||||||
private @Nullable UUID ownerUuid;
|
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
private boolean isPlayer;
|
private boolean isPlayer;
|
||||||
@@ -37,20 +36,16 @@ public class ProjectileEntityMixin {
|
|||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public @Nullable Entity getOwner() {
|
public @Nullable Entity getOwner() {
|
||||||
if (this.owner != null && !this.owner.isRemoved()) {
|
if (this.owner != null) {
|
||||||
return this.owner;
|
var ownerUuid = this.owner.getUuid();
|
||||||
} else if (this.ownerUuid != null) {
|
|
||||||
var server = $().getWorld().getServer();
|
var server = $().getWorld().getServer();
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (isPlayer) {
|
if (isPlayer) {
|
||||||
return server.getPlayerManager().getPlayer(this.ownerUuid);
|
return server.getPlayerManager().getPlayer(ownerUuid);
|
||||||
} else {
|
} else {
|
||||||
for (ServerWorld world : server.getWorlds()) {
|
return LazyEntityReference.resolve(this.owner, $().getWorld(), Entity.class);
|
||||||
var entity = world.getEntity(this.ownerUuid);
|
|
||||||
if (entity != null) return entity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public abstract class SleepManagerMixin {
|
|||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var world = players.getFirst().getServerWorld();
|
var world = players.getFirst().getWorld();
|
||||||
if (world.getTimeOfDay() % 24000 >= 12544) {
|
if (world.getTimeOfDay() % 24000 >= 12544) {
|
||||||
if(!world.isRaining()){
|
if(!world.isRaining()){
|
||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
|
|||||||
@@ -6,18 +6,10 @@ import io.ib67.sfcraft.callback.SFCallbacks;
|
|||||||
import io.ib67.sfcraft.inject.MinecraftServerSupplier;
|
import io.ib67.sfcraft.inject.MinecraftServerSupplier;
|
||||||
import io.ib67.sfcraft.module.chat.ChatPrefix;
|
import io.ib67.sfcraft.module.chat.ChatPrefix;
|
||||||
import io.ib67.sfcraft.module.chat.ChatPrefixModule;
|
import io.ib67.sfcraft.module.chat.ChatPrefixModule;
|
||||||
import net.fabricmc.fabric.api.networking.v1.PacketSender;
|
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
|
||||||
import net.minecraft.network.packet.s2c.play.TeamS2CPacket;
|
|
||||||
import net.minecraft.scoreboard.Team;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Colors;
|
import net.minecraft.util.Colors;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class AFKModule extends ServerModule {
|
public class AFKModule extends ServerModule {
|
||||||
@Inject
|
@Inject
|
||||||
private MinecraftServerSupplier serverSupplier;
|
private MinecraftServerSupplier serverSupplier;
|
||||||
@@ -47,7 +39,7 @@ public class AFKModule extends ServerModule {
|
|||||||
|
|
||||||
private void enAFK(ServerPlayerEntity player) {
|
private void enAFK(ServerPlayerEntity player) {
|
||||||
chatPrefixModule.applyPrefix(player, prefix);
|
chatPrefixModule.applyPrefix(player, prefix);
|
||||||
player.server.getPlayerManager().broadcast(
|
player.getServer().getPlayerManager().broadcast(
|
||||||
Text.literal(" * " + player.getName().getLiteralString() + " 正在挂机.").withColor(Colors.LIGHT_GRAY),
|
Text.literal(" * " + player.getName().getLiteralString() + " 正在挂机.").withColor(Colors.LIGHT_GRAY),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
@@ -57,7 +49,7 @@ public class AFKModule extends ServerModule {
|
|||||||
public void deAFK(ServerPlayerEntity player) {
|
public void deAFK(ServerPlayerEntity player) {
|
||||||
String playerName = player.getName().getLiteralString();
|
String playerName = player.getName().getLiteralString();
|
||||||
chatPrefixModule.removePrefix(player, prefix);
|
chatPrefixModule.removePrefix(player, prefix);
|
||||||
player.server.getPlayerManager().broadcast(
|
player.getServer().getPlayerManager().broadcast(
|
||||||
Text.literal(" * " + playerName + " 回来了.").withColor(Colors.LIGHT_GRAY),
|
Text.literal(" * " + playerName + " 回来了.").withColor(Colors.LIGHT_GRAY),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class ChatSendLocModule extends ServerModule implements MessageDecorator
|
|||||||
var x = sender.getBlockPos().getX();
|
var x = sender.getBlockPos().getX();
|
||||||
var y = sender.getBlockPos().getY();
|
var y = sender.getBlockPos().getY();
|
||||||
var z = sender.getBlockPos().getZ();
|
var z = sender.getBlockPos().getZ();
|
||||||
var key = sender.getServerWorld().getRegistryKey();
|
var key = sender.getWorld().getRegistryKey();
|
||||||
var world = translate(key);
|
var world = translate(key);
|
||||||
return Text
|
return Text
|
||||||
.literal(" " + x + ", " + y + ", " + z + world + " ")
|
.literal(" " + x + ", " + y + ", " + z + world + " ")
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class BackModule extends ServerModule {
|
|||||||
public int onBack(CommandContext<ServerCommandSource> it) {
|
public int onBack(CommandContext<ServerCommandSource> it) {
|
||||||
var player = it.getSource().getPlayer();
|
var player = it.getSource().getPlayer();
|
||||||
var pos = player.getLastDeathPos().get();
|
var pos = player.getLastDeathPos().get();
|
||||||
var wld = player.server.getWorld(pos.dimension());
|
var wld = player.getServer().getWorld(pos.dimension());
|
||||||
var _pos = pos.pos();
|
var _pos = pos.pos();
|
||||||
if (wld == null) return 0;
|
if (wld == null) return 0;
|
||||||
var nearby = wld.getClosestPlayer(_pos.getX(), _pos.getY(), _pos.getZ(), 100, true);
|
var nearby = wld.getClosestPlayer(_pos.getX(), _pos.getY(), _pos.getZ(), 100, true);
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class CreativeRoomModule extends ServerModule {
|
|||||||
private @NotNull TriState onOtherCommands(@NotNull CommandSource commandSource, @NotNull String s) {
|
private @NotNull TriState onOtherCommands(@NotNull CommandSource commandSource, @NotNull String s) {
|
||||||
if (commandSource instanceof ServerCommandSource source && source.getPlayer() != null) {
|
if (commandSource instanceof ServerCommandSource source && source.getPlayer() != null) {
|
||||||
var p = source.getPlayer();
|
var p = source.getPlayer();
|
||||||
if (p.getServerWorld().getRegistryKey().equals(CreativeSpaceRoom.WORLD)) {
|
if (p.getWorld().getRegistryKey().equals(CreativeSpaceRoom.WORLD)) {
|
||||||
if (BYPASS_PERMISSIONS.contains(s)) {
|
if (BYPASS_PERMISSIONS.contains(s)) {
|
||||||
return TriState.TRUE;
|
return TriState.TRUE;
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ public class CreativeRoomModule extends ServerModule {
|
|||||||
private @NotNull TriState onWorldEdit(@NotNull CommandSource commandSource, @NotNull String s) {
|
private @NotNull TriState onWorldEdit(@NotNull CommandSource commandSource, @NotNull String s) {
|
||||||
if (commandSource instanceof ServerCommandSource source && source.getPlayer() != null) {
|
if (commandSource instanceof ServerCommandSource source && source.getPlayer() != null) {
|
||||||
var p = source.getPlayer();
|
var p = source.getPlayer();
|
||||||
if (p.getServerWorld().getRegistryKey().equals(CreativeSpaceRoom.WORLD)) {
|
if (p.getWorld().getRegistryKey().equals(CreativeSpaceRoom.WORLD)) {
|
||||||
if (s.startsWith("worldedit") && SFConsts.WORLDEDIT_AT_PLAYGROUND.hasPermission(p)) {
|
if (s.startsWith("worldedit") && SFConsts.WORLDEDIT_AT_PLAYGROUND.hasPermission(p)) {
|
||||||
return TriState.TRUE;
|
return TriState.TRUE;
|
||||||
}
|
}
|
||||||
@@ -132,10 +132,10 @@ public class CreativeRoomModule extends ServerModule {
|
|||||||
if (src instanceof ServerCommandSource source && source.getPlayer() != null) {
|
if (src instanceof ServerCommandSource source && source.getPlayer() != null) {
|
||||||
var p = source.getPlayer();
|
var p = source.getPlayer();
|
||||||
var dest = EntityArgumentType.getEntity(ctx, "dest");
|
var dest = EntityArgumentType.getEntity(ctx, "dest");
|
||||||
if (p.getServerWorld().getRegistryKey().equals(CreativeSpaceRoom.WORLD)) {
|
if (p.getWorld().getRegistryKey().equals(CreativeSpaceRoom.WORLD)) {
|
||||||
if (dest.getWorld() == p.getServerWorld()) {
|
if (dest.getWorld() == p.getWorld()) {
|
||||||
Helper.teleportSafely(
|
Helper.teleportSafely(
|
||||||
p, p.getServerWorld(),
|
p, p.getWorld(),
|
||||||
dest.getBlockX(), dest.getBlockY(), dest.getBlockZ(),
|
dest.getBlockX(), dest.getBlockY(), dest.getBlockZ(),
|
||||||
dest.getYaw(), dest.getPitch()
|
dest.getYaw(), dest.getPitch()
|
||||||
);
|
);
|
||||||
@@ -152,7 +152,7 @@ public class CreativeRoomModule extends ServerModule {
|
|||||||
if (src instanceof ServerCommandSource source && source.getPlayer() != null) {
|
if (src instanceof ServerCommandSource source && source.getPlayer() != null) {
|
||||||
var p = source.getPlayer();
|
var p = source.getPlayer();
|
||||||
var mode = ctx.getArgument("mode", GameMode.class);
|
var mode = ctx.getArgument("mode", GameMode.class);
|
||||||
if (p.getServerWorld().getRegistryKey().equals(CreativeSpaceRoom.WORLD)) {
|
if (p.getWorld().getRegistryKey().equals(CreativeSpaceRoom.WORLD)) {
|
||||||
p.changeGameMode(mode);
|
p.changeGameMode(mode);
|
||||||
p.sendMessage(Text.of("Your gamemode has been changed to " + mode.asString()));
|
p.sendMessage(Text.of("Your gamemode has been changed to " + mode.asString()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class Helper {
|
|||||||
public static boolean canBack(ServerPlayerEntity player) {
|
public static boolean canBack(ServerPlayerEntity player) {
|
||||||
if (!SFConsts.COMMAND_BACK.hasPermission(player)) return false;
|
if (!SFConsts.COMMAND_BACK.hasPermission(player)) return false;
|
||||||
var pos = player.getLastDeathPos().get();
|
var pos = player.getLastDeathPos().get();
|
||||||
var wld = player.server.getWorld(pos.dimension());
|
var wld = player.getServer().getWorld(pos.dimension());
|
||||||
var _pos = pos.pos();
|
var _pos = pos.pos();
|
||||||
if (wld == null) return false;
|
if (wld == null) return false;
|
||||||
var nearby = wld.getClosestPlayer(_pos.getX(), _pos.getY(), _pos.getZ(), 100, true);
|
var nearby = wld.getClosestPlayer(_pos.getX(), _pos.getY(), _pos.getZ(), 100, true);
|
||||||
|
|||||||
Reference in new issue
Block a user