Skip to content

Commit e0b8616

Browse files
committed
update: update to 1.21.10
1 parent a015adb commit e0b8616

File tree

13 files changed

+107
-44
lines changed

13 files changed

+107
-44
lines changed

README-en.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Most other MC versions that are the same as the supported major versions but hav
1717

1818
| Minecraft Version | Support Status |
1919
|-------------------|--------------------------------------------------------------------------|
20+
| 1.21.10 | Supporting, developing actively |
2021
| 1.21.5 | Supporting, developing actively |
2122
| 1.21 | Supporting, developing actively |
2223
| 1.20.4 | Supporting, developing actively |

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Language: [English](https://github.com/OptiJava/OptCarpetAddition/blob/master/RE
1616

1717
| Minecraft 版本 | 支持状态 |
1818
|--------------|----------------------------|
19+
| 1.21.10 | 支持,积极开发 |
1920
| 1.21.5 | 支持,积极开发 |
2021
| 1.21 | 支持,积极开发 |
2122
| 1.20.4 | 支持,积极开发 |
@@ -295,8 +296,8 @@ DispenserBlockEntity dispenserBlockEntity = (DispenserBlockEntity)blockPointerIm
295296

296297
### optimizeFakePlayerSpawn
297298

298-
如果你的服务器连接mojang服务器的时间长,spawn假人的时候就会卡顿一会,此规则强制所有假人使用离线uuid,解决这一问题(但是也许引发新的问题
299-
299+
如果你的服务器连接mojang服务器的时间长,spawn假人的时候就会卡顿一会,此规则强制所有假人使用离线uuid,解决这一问题(但是也许引发新的问题\
300+
(1.17.1-1.21.5)
300301
- Default value: `false`
301302
- Acceptable value: `true` `false`
302303
- Categories: `Optimization`

build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
plugins {
2-
id 'fabric-loom' version '1.10-SNAPSHOT' apply false
2+
//旧版fabric loom 无法识别1.21.10
3+
// id 'fabric-loom' version '1.10-SNAPSHOT' apply false
4+
id 'fabric-loom' version '1.11-SNAPSHOT' apply false
35
id 'maven-publish'
46
id 'com.replaymod.preprocess' version '20c7ec554a'
57
}
@@ -10,8 +12,10 @@ preprocess {
1012
def mc1204 = createNode('1.20.4' , 1_20_04, 'yarn')
1113
def mc1210 = createNode('1.21' , 1_21_00, 'yarn')
1214
def mc1215 = createNode('1.21.5' , 1_21_05, 'yarn')
15+
def mc12110 = createNode('1.21.10', 1_21_10, 'yarn')
1316

1417
mc117 .link(mc1204, null)
1518
mc1204.link(mc1210, null)
1619
mc1210.link(mc1215, null)
20+
mc1215.link(mc12110, null)
1721
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ systemProp.http.socketTimeout=60000
88
systemProp.https.socketTimeout=60000
99

1010
# Fabric Configurations
11-
loader_version=0.16.14
11+
loader_version=0.17.3
1212
loader_requirement_version=>=0.15
1313

1414
# Mod Metadata

src/main/java/io/github/optijava/opt_carpet_addition/OptCarpetSettings.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,15 @@ public class OptCarpetSettings {
173173
)
174174
public static boolean dropperCrashFix = false;
175175
//#endif
176-
176+
177+
//#if MC < 12110
177178
@Rule(
178179
desc = "Always spawn offline fake player to reduce lagging",
179180
category = {RuleCategory.OPTIMIZATION,OCA}
180181
)
181182
public static boolean optimizeFakePlayerSpawn = false;
182-
183+
//#endif
184+
183185
//#if MC < 12100
184186
@Rule(
185187
desc = "Fix CCE Suppression crashes",

src/main/java/io/github/optijava/opt_carpet_addition/commands/ListAdvanceCommand.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ private static int listAdvance(CommandContext<ServerCommandSource> context) {
3131
StringBuilder sb = new StringBuilder();
3232
sb.append("\n");
3333
for (ServerPlayerEntity s : minecraftServer.getPlayerManager().getPlayerList()) {
34-
//#if MC >= 12004
34+
//#if MC >= 12110
35+
//$$ sb.append(s.getName().getString()).append(" ").append(s.getGameMode().getId()).append(" ").append(s.networkHandler.getLatency()).append("ms ").append(s.getIp()).append(" ").append(s.getGameProfile().id().toString()).append("\n");
36+
//#endif
37+
//#if MC >= 12004 && MC < 12110
3538
//$$ sb.append(s.getName().getString()).append(" ").append(s.interactionManager.getGameMode().getName()).append(" ").append(s.networkHandler.getLatency()).append("ms ").append(s.getIp()).append(" ").append(s.getGameProfile().getId().toString()).append("\n");
36-
//#else
39+
//#endif
40+
//#if MC < 12004
3741
sb.append(s.getName().getString()).append(" ").append(s.interactionManager.getGameMode().getName()).append(" ").append(s.pingMilliseconds).append("ms ").append(s.getIp()).append(" ").append(s.getGameProfile().getId().toString()).append("\n");
3842
//#endif
3943
}

src/main/java/io/github/optijava/opt_carpet_addition/commands/PlayerTpCommand.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
import net.minecraft.server.MinecraftServer;
1515
import net.minecraft.server.command.ServerCommandSource;
1616
import net.minecraft.server.network.ServerPlayerEntity;
17+
//#if MC >= 12110
18+
//$$ import net.minecraft.server.PlayerConfigEntry;
19+
//#endif
1720
import net.minecraft.world.GameMode;
1821

1922
import java.util.HashMap;
@@ -82,14 +85,22 @@ private static int teleport(CommandContext<ServerCommandSource> context) {
8285
}
8386

8487
try {
88+
//#if MC >= 17001
8589
final String commandSourcePlayerName = Objects.requireNonNull(context.getSource().getPlayer()).getGameProfile().getName();
90+
//#else
91+
//$$ final String commandSourcePlayerName = Objects.requireNonNull(context.getSource().getPlayerOrThrow()).getName().getString();
92+
//#endif
8693

8794
if (server.getPlayerManager().getPlayer(target) instanceof EntityPlayerMPFake) {
8895

8996
switch (OptCarpetSettings.commandTpToFakePlayer) {
9097
case "true" -> executeTp(commandSourcePlayerName, context, server);
9198
case "ops" -> {
99+
//#if MC < 12110
92100
if ((server.getPlayerManager().isOperator(context.getSource().getPlayer().getGameProfile()))) {
101+
//#else
102+
//$$ if ((server.getPlayerManager().isOperator(new PlayerConfigEntry(context.getSource().getPlayerOrThrow().getGameProfile())))) {
103+
//#endif
93104
executeTp(commandSourcePlayerName, context, server);
94105
} else {
95106
if (OptCarpetSettings.allowSpectatorTpToAnyPlayer && context.getSource().getPlayer().interactionManager.getGameMode().equals(GameMode.SPECTATOR)){
@@ -114,7 +125,11 @@ private static int teleport(CommandContext<ServerCommandSource> context) {
114125
case "true" ->
115126
server.getCommandManager().getDispatcher().execute(server.getCommandManager().getDispatcher().parse("tp " + commandSourcePlayerName + " " + target, server.getCommandSource()));
116127
case "ops" -> {
128+
//#if MC < 12110
117129
if ((server.getPlayerManager().isOperator(context.getSource().getPlayer().getGameProfile()))) {
130+
//#else
131+
//$$ if ((server.getPlayerManager().isOperator(new PlayerConfigEntry(context.getSource().getPlayerOrThrow().getGameProfile())))) {
132+
//#endif
118133
server.getCommandManager().getDispatcher().execute(server.getCommandManager().getDispatcher().parse("tp " + commandSourcePlayerName + " " + target, server.getCommandSource()));
119134
} else {
120135
if (OptCarpetSettings.allowSpectatorTpToAnyPlayer && context.getSource().getPlayer().interactionManager.getGameMode().equals(GameMode.SPECTATOR)){
@@ -170,14 +185,22 @@ private static int teleportHere(CommandContext<ServerCommandSource> context) {
170185
}
171186

172187
try {
188+
//#if MC >= 17001
173189
final String commandSourcePlayerName = Objects.requireNonNull(context.getSource().getPlayer()).getGameProfile().getName();
190+
//#else
191+
//$$ final String commandSourcePlayerName = Objects.requireNonNull(context.getSource().getPlayerOrThrow()).getName().getString();
192+
//#endif
174193

175194
if (server.getPlayerManager().getPlayer(target) instanceof EntityPlayerMPFake) {
176195

177196
switch (OptCarpetSettings.commandTpHereFakePlayer) {
178197
case "true" -> executeTpHere(commandSourcePlayerName, context, server);
179198
case "ops" -> {
199+
//#if MC < 12110
180200
if ((server.getPlayerManager().isOperator(context.getSource().getPlayer().getGameProfile()))) {
201+
//#else
202+
//$$ if ((server.getPlayerManager().isOperator(new PlayerConfigEntry(context.getSource().getPlayerOrThrow().getGameProfile())))) {
203+
//#endif
181204
executeTpHere(commandSourcePlayerName, context, server);
182205
} else {
183206
Messenger.m(context.getSource(), "r You have no permission to teleport here fake player.You aren't op.");
@@ -192,7 +215,11 @@ private static int teleportHere(CommandContext<ServerCommandSource> context) {
192215
case "true" ->
193216
server.getCommandManager().getDispatcher().execute(server.getCommandManager().getDispatcher().parse("tp " + target + " " + commandSourcePlayerName, server.getCommandSource()));
194217
case "ops" -> {
218+
//#if MC < 12110
195219
if ((server.getPlayerManager().isOperator(context.getSource().getPlayer().getGameProfile()))) {
220+
//#else
221+
//$$ if ((server.getPlayerManager().isOperator(new PlayerConfigEntry(context.getSource().getPlayerOrThrow().getGameProfile())))) {
222+
//#endif
196223
server.getCommandManager().getDispatcher().execute(server.getCommandManager().getDispatcher().parse("tp " + target + " " + commandSourcePlayerName, server.getCommandSource()));
197224
} else {
198225
Messenger.m(context.getSource(), "r You have no permission to teleport here real player.You aren't op.");

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/commandLogger/CommandManager_Mixin.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
import net.minecraft.server.command.CommandManager;
1414
import net.minecraft.server.command.ServerCommandSource;
1515
import net.minecraft.server.network.ServerPlayerEntity;
16+
//#if MC >= 12110
17+
//$$ import net.minecraft.server.PlayerConfigEntry;
18+
//#endif
1619
import org.apache.logging.log4j.LogManager;
1720
import org.apache.logging.log4j.Logger;
1821
import org.spongepowered.asm.mixin.Mixin;
@@ -23,6 +26,7 @@
2326
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
2427
//#endif
2528

29+
2630
@Mixin(CommandManager.class)
2731
public class CommandManager_Mixin {
2832

@@ -93,7 +97,11 @@ private void logCommand(String command, ServerCommandSource commandSource){
9397
));
9498
} else if (OptCarpetSettings.commandLoggerBroadcastToPlayer.equals("ops")) {
9599
for (ServerPlayerEntity serverPlayerEntity : CarpetServer.minecraft_server.getPlayerManager().getPlayerList()) {
100+
//#if MC < 12110
96101
if (!CarpetServer.minecraft_server.getPlayerManager().isOperator(serverPlayerEntity.getGameProfile())) {
102+
//#else
103+
//$$ if (!CarpetServer.minecraft_server.getPlayerManager().isOperator(new PlayerConfigEntry(serverPlayerEntity.getGameProfile()))) {
104+
//#endif
97105
continue;
98106
}
99107
Messenger.m(serverPlayerEntity, Messenger.c(

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/optimizeFakePlayerSpawn/EntityPlayerMPFake_Mixin.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
import io.github.optijava.opt_carpet_addition.OptCarpetSettings;
66
//#if MC >= 11900
77
//$$ import net.minecraft.util.Uuids;
8+
//#endif
9+
//#if MC >= 12110
10+
//$$ import net.minecraft.server.ServerConfigHandler;
11+
//$$ import net.minecraft.server.MinecraftServer;
12+
//$$ import java.util.UUID;
813
//#else
914
import net.minecraft.entity.player.PlayerEntity;
1015
//#endif
@@ -17,7 +22,7 @@
1722

1823
@Mixin(EntityPlayerMPFake.class)
1924
public abstract class EntityPlayerMPFake_Mixin {
20-
25+
//#if MC < 12110
2126
@Redirect(
2227
method = "createFake",
2328
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/UserCache;findByName(Ljava/lang/String;)Ljava/util/Optional;")
@@ -33,4 +38,5 @@ private static Optional<GameProfile> redirectCreateFake(UserCache instance, Stri
3338
return instance.findByName(playerName);
3439
}
3540
}
41+
//#endif
3642
}

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/optimizeFakePlayerSpawn/PlayerCommand_Mixin.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
import io.github.optijava.opt_carpet_addition.OptCarpetSettings;
66
//#if MC >= 11900
77
//$$ import net.minecraft.util.Uuids;
8+
//#endif
9+
//#if MC >= 12110
10+
//$$ import net.minecraft.server.ServerConfigHandler;
11+
//$$ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
12+
//$$ import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
13+
//$$ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
14+
//$$ import io.github.optijava.opt_carpet_addition.OptCarpetSettings;
15+
//$$ import net.minecraft.server.PlayerConfigEntry;
16+
//$$ import net.minecraft.util.NameToIdCache;
17+
//$$ import java.util.UUID;
818
//#else
919
import net.minecraft.entity.player.PlayerEntity;
1020
//#endif
@@ -17,7 +27,7 @@
1727

1828
@Mixin(PlayerCommand.class)
1929
public abstract class PlayerCommand_Mixin {
20-
30+
//#if MC < 12110
2131
@Redirect(
2232
method = "cantSpawn",
2333
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/UserCache;findByName(Ljava/lang/String;)Ljava/util/Optional;")
@@ -33,4 +43,5 @@ private static Optional<GameProfile> redirectFindByName(UserCache instance, Stri
3343
return instance.findByName(playerName);
3444
}
3545
}
46+
//#endif
3647
}

0 commit comments

Comments
 (0)