From 4dfa1476a59ae7ee7d1087b44aad7d1f62663052 Mon Sep 17 00:00:00 2001 From: ayabusa Date: Sun, 4 Aug 2024 13:11:18 +0200 Subject: [PATCH] Updated to 1.21 --- gradle.properties | 9 +- .../ModernChunkDetector.java | 22 +++++ .../mixin/ExampleMixin.java | 15 ++++ .../ModernChunkDetectorClient.java | 85 ++++++++++--------- src/main/resources/fabric.mod.json | 2 +- 5 files changed, 88 insertions(+), 45 deletions(-) create mode 100644 remappedSrc/modern_chunk_detector/ModernChunkDetector.java create mode 100644 remappedSrc/modern_chunk_detector/mixin/ExampleMixin.java diff --git a/gradle.properties b/gradle.properties index ef24c15..7ed1242 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,17 +4,18 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.6 -yarn_mappings=1.20.6+build.3 +minecraft_version=1.21 +yarn_mappings=1.21+build.9 loader_version=0.15.11 + # Mod Properties -mod_version=1.1 +mod_version=1.1+1.21 maven_group=modern_chunk_detector archives_base_name=modern_chunk_detector # Dependencies -fabric_version=0.100.4+1.20.6 +fabric_version=0.100.8+1.21 # Java org.gradle.java.home=C:\\Users\\Leon\\.jdks\\corretto-21.0.3 \ No newline at end of file diff --git a/remappedSrc/modern_chunk_detector/ModernChunkDetector.java b/remappedSrc/modern_chunk_detector/ModernChunkDetector.java new file mode 100644 index 0000000..dd9c713 --- /dev/null +++ b/remappedSrc/modern_chunk_detector/ModernChunkDetector.java @@ -0,0 +1,22 @@ +package modern_chunk_detector; + +import net.fabricmc.api.ModInitializer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ModernChunkDetector implements ModInitializer { + // This logger is used to write text to the console and the log file. + // It is considered best practice to use your mod id as the logger's name. + // That way, it's clear which mod wrote info, warnings, and errors. + public static final Logger LOGGER = LoggerFactory.getLogger("modern_chunk_detector"); + + @Override + public void onInitialize() { + // This code runs as soon as Minecraft is in a mod-load-ready state. + // However, some things (like resources) may still be uninitialized. + // Proceed with mild caution. + + LOGGER.info("Hello Fabric world!"); + } +} \ No newline at end of file diff --git a/remappedSrc/modern_chunk_detector/mixin/ExampleMixin.java b/remappedSrc/modern_chunk_detector/mixin/ExampleMixin.java new file mode 100644 index 0000000..bb2712a --- /dev/null +++ b/remappedSrc/modern_chunk_detector/mixin/ExampleMixin.java @@ -0,0 +1,15 @@ +package modern_chunk_detector.mixin; + +import net.minecraft.server.MinecraftServer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MinecraftServer.class) +public class ExampleMixin { + @Inject(at = @At("HEAD"), method = "loadWorld") + private void init(CallbackInfo info) { + // This code is injected into the start of MinecraftServer.loadWorld()V + } +} \ No newline at end of file diff --git a/src/client/java/modern_chunk_detector/ModernChunkDetectorClient.java b/src/client/java/modern_chunk_detector/ModernChunkDetectorClient.java index 7379a5d..1543466 100644 --- a/src/client/java/modern_chunk_detector/ModernChunkDetectorClient.java +++ b/src/client/java/modern_chunk_detector/ModernChunkDetectorClient.java @@ -124,70 +124,75 @@ public class ModernChunkDetectorClient implements ClientModInitializer { int k; for(j = -16; j <= 32; j += 16) { for(k = -16; k <= 32; k += 16) { - /*vertexConsumer.vertex(matrix4f, h + (float)j, f, i + (float)k).color(1.0F, 0.0F, 0.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, f, i + (float)k).color(1.0F, 0.0F, 0.0F, 0.5F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, g, i + (float)k).color(1.0F, 0.0F, 0.0F, 0.5F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, g, i + (float)k).color(1.0F, 0.0F, 0.0F, 0.0F).next();*/ + /* + vertexConsumer.vertex(matrix4f, h + (float)j, f, i + (float)k).color(1.0F, 0.0F, 0.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h + (float)j, f, i + (float)k).color(1.0F, 0.0F, 0.0F, 0.5F); + vertexConsumer.vertex(matrix4f, h + (float)j, g, i + (float)k).color(1.0F, 0.0F, 0.0F, 0.5F); + vertexConsumer.vertex(matrix4f, h + (float)j, g, i + (float)k).color(1.0F, 0.0F, 0.0F, 0.0F); + */ } } for(j = 2; j < 16; j += 2) { + /* k = j % 4 == 0 ? DARK_CYAN : YELLOW; - /*vertexConsumer.vertex(matrix4f, h + (float)j, f, i).color(1.0F, 1.0F, 0.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, f, i).color(k).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, g, i).color(k).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, g, i).color(1.0F, 1.0F, 0.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, f, i + 16.0F).color(1.0F, 1.0F, 0.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, f, i + 16.0F).color(k).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, g, i + 16.0F).color(k).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, g, i + 16.0F).color(1.0F, 1.0F, 0.0F, 0.0F).next();*/ + vertexConsumer.vertex(matrix4f, h + (float)j, f, i).color(1.0F, 1.0F, 0.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h + (float)j, f, i).color(k); + vertexConsumer.vertex(matrix4f, h + (float)j, g, i).color(k); + vertexConsumer.vertex(matrix4f, h + (float)j, g, i).color(1.0F, 1.0F, 0.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h + (float)j, f, i + 16.0F).color(1.0F, 1.0F, 0.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h + (float)j, f, i + 16.0F).color(k); + vertexConsumer.vertex(matrix4f, h + (float)j, g, i + 16.0F).color(k); + vertexConsumer.vertex(matrix4f, h + (float)j, g, i + 16.0F).color(1.0F, 1.0F, 0.0F, 0.0F);*/ } for(j = 2; j < 16; j += 2) { + /* k = j % 4 == 0 ? DARK_CYAN : YELLOW; - /*vertexConsumer.vertex(matrix4f, h, f, i + (float)j).color(1.0F, 1.0F, 0.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h, f, i + (float)j).color(k).next(); - vertexConsumer.vertex(matrix4f, h, g, i + (float)j).color(k).next(); - vertexConsumer.vertex(matrix4f, h, g, i + (float)j).color(1.0F, 1.0F, 0.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h + 16.0F, f, i + (float)j).color(1.0F, 1.0F, 0.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h + 16.0F, f, i + (float)j).color(k).next(); - vertexConsumer.vertex(matrix4f, h + 16.0F, g, i + (float)j).color(k).next(); - vertexConsumer.vertex(matrix4f, h + 16.0F, g, i + (float)j).color(1.0F, 1.0F, 0.0F, 0.0F).next();*/ + vertexConsumer.vertex(matrix4f, h, f, i + (float)j).color(1.0F, 1.0F, 0.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h, f, i + (float)j).color(k); + vertexConsumer.vertex(matrix4f, h, g, i + (float)j).color(k); + vertexConsumer.vertex(matrix4f, h, g, i + (float)j).color(1.0F, 1.0F, 0.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h + 16.0F, f, i + (float)j).color(1.0F, 1.0F, 0.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h + 16.0F, f, i + (float)j).color(k); + vertexConsumer.vertex(matrix4f, h + 16.0F, g, i + (float)j).color(k); + vertexConsumer.vertex(matrix4f, h + 16.0F, g, i + (float)j).color(1.0F, 1.0F, 0.0F, 0.0F);*/ } float l; for(j = this.client.world.getBottomY(); j <= this.client.world.getTopY(); j += 2) { + l = (float)((double)j - cameraY); - int m = j % 8 == 0 ? DARK_CYAN : YELLOW;/* - vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 1.0F, 0.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h, l, i).color(m).next(); - vertexConsumer.vertex(matrix4f, h, l, i + 16.0F).color(m).next(); - vertexConsumer.vertex(matrix4f, h + 16.0F, l, i + 16.0F).color(m).next(); - vertexConsumer.vertex(matrix4f, h + 16.0F, l, i).color(m).next(); - vertexConsumer.vertex(matrix4f, h, l, i).color(m).next(); - vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 1.0F, 0.0F, 0.0F).next();*/ + int m = j % 8 == 0 ? DARK_CYAN : YELLOW; + vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h, l, i + 16.0F).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h + 16.0F, l, i + 16.0F).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h + 16.0F, l, i).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 0.0F); } vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getDebugLineStrip(2.0)); for(j = 0; j <= 16; j += 16) { for(k = 0; k <= 16; k += 16) { - vertexConsumer.vertex(matrix4f, h + (float)j, f, i + (float)k).color(1.0F, 0F, 1.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, f, i + (float)k).color(1.0F, 0F, 1.0F, 1.0F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, g, i + (float)k).color(1.0F, 0F, 1.0F, 1.0F).next(); - vertexConsumer.vertex(matrix4f, h + (float)j, g, i + (float)k).color(1.0F, 0F, 1.0F, 0.0F).next(); + vertexConsumer.vertex(matrix4f, h + (float)j, f, i + (float)k).color(1.0F, 0F, 1.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h + (float)j, f, i + (float)k).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h + (float)j, g, i + (float)k).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h + (float)j, g, i + (float)k).color(1.0F, 0F, 1.0F, 0.0F); } } - for(j = this.client.world.getBottomY(); j <= this.client.world.getTopY(); j += 2) { + for(j = this.client.world.getBottomY(); j <= this.client.world.getTopY(); j += 16) { l = (float)((double)j - cameraY); - vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 0.0F).next(); - vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 1.0F).next(); - vertexConsumer.vertex(matrix4f, h, l, i + 16.0F).color(1.0F, 0F, 1.0F, 1.0F).next(); - vertexConsumer.vertex(matrix4f, h + 16.0F, l, i + 16.0F).color(1.0F, 0F, 1.0F, 1.0F).next(); - vertexConsumer.vertex(matrix4f, h + 16.0F, l, i).color(1.0F, 0F, 1.0F, 1.0F).next(); - vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 1.0F).next(); - vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 0.0F).next(); + vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 0.0F); + vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h, l, i + 16.0F).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h + 16.0F, l, i + 16.0F).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h + 16.0F, l, i).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 1.0F); + vertexConsumer.vertex(matrix4f, h, l, i).color(1.0F, 0F, 1.0F, 0.0F); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 759d5f5..c59a012 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -31,7 +31,7 @@ ], "depends": { "fabricloader": ">=0.15.11", - "minecraft": "~1.20.6", + "minecraft": ">=1.21", "java": ">=21", "fabric-api": "*" },