Skip to content

Commit 0843367

Browse files
committed
Port to 26.1
PlayerRolesApi has had a facade made so it'll compile normally and hopefully plug & play. Diagnostics code has been left in but disabled for ease of debugging, since, I'm sure whoever wants to deal with networking next is going to need it. ForbiddenStackWalker can dump entire stack traces and do deep stack inspection, and can be safely deployed in production for diagnostics. BufDump dumps ByteBufs into a hex format. That's about it. Known broken: - FullStreamCompression - VarInt21 randomly gets 0 frames. Periodic zstd flushes? - io_uring: Causes a race condition with how vanilla does compression. - WorldEditCompat: WorldEdit does not exist yet on 26.1. - Entity timings and masks are still broken. I just haven't fixed it yet. - Will likely be ported to be a SimpleDebugRenderer Subpar: - ReflectionUtil has gained more use, not less. Please get rid of this thing. - ForbiddenStackWalker has been unleashed into the public for real. - Enjoy, it's almost as good as a real debugger! - It's possible mod-specific mixins are broken. Oh well, they'll be fixed when need be.
1 parent 204a34f commit 0843367

134 files changed

Lines changed: 2600 additions & 929 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup jdk
1313
uses: actions/setup-java@v4
1414
with:
15-
java-version: 21
15+
java-version: 25
1616
distribution: 'temurin'
1717

1818
- name: Setup Gradle

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup jdk
1616
uses: actions/setup-java@v4
1717
with:
18-
java-version: 21
18+
java-version: 25
1919
distribution: 'temurin'
2020

2121
- name: Setup Gradle

build.gradle

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,34 @@ configurations {
2626

2727
dependencies {
2828
minecraft libs.mc
29-
mappings loom.officialMojangMappings()
30-
modImplementation libs.fl
31-
modImplementation libs.fapi
29+
implementation libs.fl
30+
implementation libs.fapi
3231

3332
//modImplementation libs.sodium
3433
//modImplementation libs.flywheel
3534
//modImplementation libs.vanillin
3635

37-
modImplementation libs.nettyIoUringClasses
38-
modImplementation variantOf(libs.nettyIoUringNative) { classifier "linux-x86_64" }
39-
modImplementation libs.zstd
36+
implementation libs.nettyIoUringClasses
37+
implementation variantOf(libs.nettyIoUringNative) { classifier "linux-x86_64" }
38+
implementation libs.zstd
4039

41-
modImplementation(libs.worldeditCore) {
42-
exclude group: "it.unimi.dsi"
43-
exclude group: "com.google.code.gson"
44-
exclude group: "com.google.guava"
45-
exclude group: "org.apache.logging.log4j"
46-
}
47-
modImplementation(libs.worldeditFabric) {
40+
// This will *not* boot and you know it
41+
compileOnly(libs.bundles.worldedit) {
4842
exclude group: "it.unimi.dsi"
4943
exclude group: "com.google.code.gson"
5044
exclude group: "com.google.guava"
5145
exclude group: "org.apache.logging.log4j"
5246
}
5347

54-
modImplementation "dev.gegy:player-roles-api:1.6.15"
48+
// TODO: update this when it's actually released
49+
// The API is currently mimicked in the meantime.
50+
// implementation "dev.gegy:player-roles-api:1.6.15"
5551

5652
shade(libs.nettyIoUringClasses) { transitive = false }
5753
shade(variantOf(libs.nettyIoUringNative) { classifier "linux-x86_64" }) { transitive = false }
5854
shade(libs.zstd) { transitive = false }
5955

60-
include(implementation(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-fabric:0.3.2-beta.3")))
56+
include(implementation(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-fabric:0.3.3")))
6157
}
6258

6359
processResources {
@@ -84,7 +80,8 @@ processResources {
8480

8581
tasks.withType(JavaCompile).configureEach {
8682
it.options.encoding = "UTF-8"
87-
it.options.release = 21
83+
it.options.release = 25
84+
it.options.compilerArgs += "-Xlint:deprecation,unchecked,rawtypes"
8885
}
8986

9087
loom {
@@ -102,20 +99,23 @@ sourceSets {
10299

103100
java {
104101
withSourcesJar()
105-
sourceCompatibility = JavaVersion.VERSION_21
106-
targetCompatibility = JavaVersion.VERSION_21
102+
sourceCompatibility = JavaVersion.VERSION_25
103+
targetCompatibility = JavaVersion.VERSION_25
107104
}
108105

109106
jar {
110107
from("LICENSE") {
111-
rename { "${it}_${archivesBaseName}" }
108+
rename { "${it}_${base.archivesName}" }
112109
}
113110

114111
configurations.shade.resolve().each {
115112
from(zipTree(it)) {
116113
exclude 'META-INF/MANIFEST.MF'
117114
exclude 'META-INF/INDEX.LIST'
118115
exclude 'META-INF/maven/**'
116+
// Unnecessary module-info.class
117+
exclude 'META-INF/versions/**'
118+
exclude 'META-INF/io.netty.versions.properties'
119119
}
120120
}
121121
}

libs.versions.toml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
[versions]
2-
loom = "1.14.+"
2+
loom = "1.15.+"
33

4-
mc = "1.21.8"
5-
fl = "0.16.14"
6-
fapi = "0.129.0+1.21.8"
4+
mc = "26.1-pre-3"
5+
fl = "0.18.4"
6+
fapi = "0.143.14+26.1"
77

8-
nettyIoUring = "0.0.15.Final"
8+
nettyIoUring = "4.2.7.Final"
99
zstd = "1.5.5-5"
1010

1111
sodium = "mc1.21-0.5.9"
1212
flywheel = "1.0.4-27"
1313
vanillin = "1.1.3-27"
14-
worldeditCore = "7.3.16"
15-
worldeditFabric = "7.3.16"
14+
worldeditCore = "7.4.0"
15+
worldeditFabric = "7.4.0"
1616

1717
[plugins]
18-
loom = { id = "fabric-loom", version.ref = "loom" }
18+
loom = { id = "net.fabricmc.fabric-loom", version.ref = "loom" }
1919

2020
[libraries]
2121
mc = { group = "mojang", name = "minecraft", version.ref = "mc" }
2222
fl = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fl" }
2323
fapi = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fapi" }
2424

25-
nettyIoUringClasses = { group = "io.netty.incubator", name = "netty-incubator-transport-classes-io_uring", version.ref = "nettyIoUring" }
26-
nettyIoUringNative = { group = "io.netty.incubator", name = "netty-incubator-transport-native-io_uring", version.ref = "nettyIoUring" }
25+
nettyIoUringClasses = { group = "io.netty", name = "netty-transport-classes-io_uring", version.ref = "nettyIoUring" }
26+
nettyIoUringNative = { group = "io.netty", name = "netty-transport-native-io_uring", version.ref = "nettyIoUring" }
2727
zstd = { group = "com.github.luben", name = "zstd-jni", version.ref = "zstd" }
2828

2929
sodium = { group = "maven.modrinth", name = "sodium", version.ref = "sodium" }
3030
flywheel = { group = "dev.engine-room.flywheel", name = "flywheel-fabric-1.21.1", version.ref = "flywheel" }
3131
vanillin = { group = "dev.engine-room.vanillin", name = "vanillin-fabric-1.21.1", version.ref = "vanillin" }
3232
worldeditCore = { group = "com.sk89q.worldedit", name = "worldedit-core", version.ref = "worldeditCore" }
33-
worldeditFabric = { group = "com.sk89q.worldedit", name = "worldedit-fabric-mc1.21.7", version.ref = "worldeditFabric" }
33+
worldeditFabric = { group = "com.sk89q.worldedit", name = "worldedit-fabric-mc1.21.11", version.ref = "worldeditFabric" }
34+
35+
[bundles]
36+
worldedit = ['worldeditCore', 'worldeditFabric']
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package dev.gegy.roles.api;
2+
3+
/**
4+
* @author Ampflower
5+
**/
6+
@Deprecated
7+
public class PlayerRolesApi {
8+
public static RoleLookup lookup() {
9+
return null;
10+
}
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package dev.gegy.roles.api;
2+
3+
/**
4+
* @author Ampflower
5+
**/
6+
@Deprecated
7+
public interface Role {
8+
String getId();
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package dev.gegy.roles.api;
2+
3+
import net.minecraft.world.entity.player.Player;
4+
5+
/**
6+
* @author Ampflower
7+
**/
8+
@Deprecated
9+
public class RoleLookup {
10+
public RoleReader byPlayer(Player player) {
11+
throw new AssertionError();
12+
}
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package dev.gegy.roles.api;
2+
3+
import java.util.stream.Stream;
4+
5+
/**
6+
* @author Ampflower
7+
**/
8+
@Deprecated
9+
public interface RoleReader extends Iterable<Role> {
10+
Stream<Role> stream();
11+
}

src/main/java/net/modfest/fireblanket/Fireblanket.java

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
import net.fabricmc.api.EnvType;
88
import net.fabricmc.api.ModInitializer;
99
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
10-
import net.fabricmc.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents;
10+
import net.fabricmc.fabric.api.entity.event.v1.ServerEntityLevelChangeEvents;
1111
import net.fabricmc.fabric.api.event.Event;
12-
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
12+
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLevelEvents;
1313
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
14-
import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory;
15-
import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry;
16-
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
14+
import net.fabricmc.fabric.api.gamerule.v1.GameRuleBuilder;
15+
import net.fabricmc.fabric.api.networking.v1.FriendlyByteBufs;
1716
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
1817
import net.fabricmc.fabric.api.networking.v1.ServerLoginConnectionEvents;
1918
import net.fabricmc.fabric.api.networking.v1.ServerLoginNetworking;
@@ -26,14 +25,15 @@
2625
import net.minecraft.core.registries.BuiltInRegistries;
2726
import net.minecraft.network.Connection;
2827
import net.minecraft.network.protocol.Packet;
29-
import net.minecraft.resources.ResourceLocation;
28+
import net.minecraft.resources.Identifier;
3029
import net.minecraft.server.level.ServerLevel;
3130
import net.minecraft.server.level.Ticket;
3231
import net.minecraft.server.level.TicketType;
3332
import net.minecraft.world.level.ChunkPos;
34-
import net.minecraft.world.level.GameRules;
3533
import net.minecraft.world.level.TicketStorage;
3634
import net.minecraft.world.level.block.Block;
35+
import net.minecraft.world.level.gamerules.GameRule;
36+
import net.minecraft.world.level.gamerules.GameRuleCategory;
3737
import net.modfest.fireblanket.command.CmdFindReplaceCommand;
3838
import net.modfest.fireblanket.command.DumpCommand;
3939
import net.modfest.fireblanket.command.ItemBanCommand;
@@ -65,24 +65,29 @@
6565
import java.util.function.Consumer;
6666

6767
public class Fireblanket implements ModInitializer {
68-
public static final ResourceLocation BATCHED_BE_UPDATE = ResourceLocation.fromNamespaceAndPath("fireblanket", "batched_be_sync");
69-
public static final ResourceLocation BATCHED_VELOCITY_SYNC = ResourceLocation.fromNamespaceAndPath("fireblanket", "batched_velocity_sync");
70-
public static final ResourceLocation FULL_STREAM_COMPRESSION = ResourceLocation.fromNamespaceAndPath("fireblanket", "full_stream_compression");
71-
public static final ResourceLocation REGIONS_UPDATE = ResourceLocation.fromNamespaceAndPath("fireblanket", "regions_update");
68+
public static final Identifier BATCHED_BE_UPDATE = FireblanketConstants.id("batched_be_sync");
69+
public static final Identifier BATCHED_VELOCITY_SYNC = FireblanketConstants.id("batched_velocity_sync");
70+
public static final Identifier FULL_STREAM_COMPRESSION = FireblanketConstants.id("full_stream_compression");
71+
public static final Identifier REGIONS_UPDATE = FireblanketConstants.id("regions_update");
7272

7373
/**
7474
* Whether new entities will be fixed.
7575
*
7676
* @see net.modfest.fireblanket.mixin.entity_immutability
7777
*/
78-
public static final GameRules.Key<GameRules.BooleanValue> NEW_ENTITIES_IMMUTABLE =
79-
GameRuleRegistry.register("newEntitiesImmutable", GameRules.Category.MOBS, GameRuleFactory.createBooleanRule(true));
78+
public static final GameRule<Boolean> NEW_ENTITIES_IMMUTABLE =
79+
GameRuleBuilder.forBoolean(true)
80+
.category(GameRuleCategory.MOBS)
81+
.buildAndRegister(FireblanketConstants.id("new_entities_immutable"));
8082

8183
/**
8284
* How far lightning may be observed. Setting this to 0 disables lightning outright.
8385
*/
84-
public static final GameRules.Key<GameRules.IntegerValue> LIGHTNING_BROADCAST_RADIUS =
85-
GameRuleRegistry.register("fireblanket:lightningBroadcastRadius", GameRules.Category.UPDATES, GameRuleFactory.createIntRule(-1, -1));
86+
public static final GameRule<Integer> LIGHTNING_BROADCAST_RADIUS =
87+
GameRuleBuilder.forInteger(-1)
88+
.range(-1, Integer.MAX_VALUE)
89+
.category(GameRuleCategory.UPDATES)
90+
.buildAndRegister(FireblanketConstants.id("lightning_broadcast_radius"));
8691

8792
public static final Logger LOGGER = LoggerFactory.getLogger("Fireblanket");
8893

@@ -97,7 +102,7 @@ public record QueuedPacket(Connection conn, Packet<?> packet, ChannelFutureListe
97102
public static boolean CAN_USE_ZSTD = false;
98103
public static boolean IS_FIREBLANKET_SERVER = false;
99104

100-
public static final TicketType KEEP_LOADED = Registry.register(BuiltInRegistries.TICKET_TYPE, "fireblanket:keep_loaded", new TicketType(0L, true, TicketType.TicketUse.LOADING));
105+
public static final TicketType KEEP_LOADED = Registry.register(BuiltInRegistries.TICKET_TYPE, "fireblanket:keep_loaded", new TicketType(0L, TicketType.FLAG_LOADING));
101106

102107
@Override
103108
public void onInitialize() {
@@ -175,17 +180,17 @@ public void onInitialize() {
175180
}
176181

177182
// Networking
178-
PayloadTypeRegistry.playS2C().register(BatchedBEUpdatePayload.ID, BatchedBEUpdatePayload.CODEC);
179-
PayloadTypeRegistry.playS2C().register(BatchedEntityVelocityUpdatePacket.ID, BatchedEntityVelocityUpdatePacket.CODEC);
180-
PayloadTypeRegistry.playS2C().register(CommandBlockPacket.ID, CommandBlockPacket.CODEC);
181-
PayloadTypeRegistry.playS2C().register(RegionSyncRequest.ID, RegionSyncRequest.CODEC);
183+
PayloadTypeRegistry.clientboundPlay().register(BatchedBEUpdatePayload.ID, BatchedBEUpdatePayload.CODEC);
184+
PayloadTypeRegistry.clientboundPlay().register(BatchedEntityVelocityUpdatePacket.ID, BatchedEntityVelocityUpdatePacket.CODEC);
185+
PayloadTypeRegistry.clientboundPlay().register(CommandBlockPacket.ID, CommandBlockPacket.CODEC);
186+
PayloadTypeRegistry.clientboundPlay().register(RegionSyncRequest.ID, RegionSyncRequest.CODEC);
182187

183188
if (CAN_USE_ZSTD) {
184189
LOGGER.info("Enabling full-stream compression");
185-
ServerLoginConnectionEvents.QUERY_START.addPhaseOrdering(ResourceLocation.parse("fireblanket:pre"), Event.DEFAULT_PHASE);
186-
ServerLoginConnectionEvents.QUERY_START.register(ResourceLocation.parse("fireblanket:pre"), (handler, server, sender, synchronizer) -> {
190+
ServerLoginConnectionEvents.QUERY_START.addPhaseOrdering(Identifier.parse("fireblanket:pre"), Event.DEFAULT_PHASE);
191+
ServerLoginConnectionEvents.QUERY_START.register(Identifier.parse("fireblanket:pre"), (handler, server, sender, synchronizer) -> {
187192
if (!server.isSingleplayer()) {
188-
sender.sendPacket(FULL_STREAM_COMPRESSION, PacketByteBufs.empty());
193+
sender.sendPacket(FULL_STREAM_COMPRESSION, FriendlyByteBufs.empty());
189194
}
190195
});
191196
}
@@ -202,9 +207,9 @@ public void onInitialize() {
202207

203208
PlayerRolesCompat.init();
204209

205-
ServerWorldEvents.LOAD.register((server, world) -> {
210+
ServerLevelEvents.LOAD.register((server, world) -> {
206211
if (FireblanketConfig.get(ConfigSpecs.FORCED_LOAD_RADIUS) > 0) {
207-
if (!world.dimension().location().toString().equals("minecraft:overworld")) return;
212+
if (!world.dimension().identifier().toString().equals("minecraft:overworld")) return;
208213
int radius = FireblanketConfig.get(ConfigSpecs.FORCED_LOAD_RADIUS);
209214
int min = (int) Math.floor(-radius / 16);
210215
int max = (int) Math.ceil(radius / 16);
@@ -236,7 +241,7 @@ public void onInitialize() {
236241
fullRegionSync(handler.player.level(), sender::sendPacket);
237242
});
238243

239-
ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register((player, origin, destination) -> {
244+
ServerEntityLevelChangeEvents.AFTER_PLAYER_CHANGE_LEVEL.register((player, origin, destination) -> {
240245
fullRegionSync(player.level(), player.connection::send);
241246
});
242247
}
@@ -249,7 +254,7 @@ public static void fullRegionSync(ServerLevel world, Consumer<Packet<?>> sender)
249254
} else {
250255
req = regions.toPacket();
251256
}
252-
sender.accept(ServerPlayNetworking.createS2CPacket(req));
257+
sender.accept(ServerPlayNetworking.createClientboundPacket(req));
253258
}
254259

255260
public static LinkedBlocQueue<QueuedPacket> getNextQueue() {

0 commit comments

Comments
 (0)