From 59c4563dd469c7847e08d5245b63bff91c1f474a Mon Sep 17 00:00:00 2001 From: tr7zw Date: Fri, 14 Jun 2024 17:14:20 +0200 Subject: [PATCH] Update to 1.21 --- .github/workflows/tag.yml | 56 +++++++++++++++++++ settings.json | 5 +- .../dev/tr7zw/entityculling/CullTask.java | 6 +- .../tr7zw/entityculling/EntityCullingMod.java | 7 +-- .../entityculling/EntityCullingModBase.java | 7 ++- versions/mainProject | 2 +- 6 files changed, 69 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 9c0d01b..0ff5a30 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -225,3 +225,59 @@ jobs: name: ${{github.ref_name}}-1.20.6 - Fabric files: 'versions/1.20.6-fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar' game-versions: 1.20.6 + - name: Publish-1.21-forge-Curseforge + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + curseforge-id: 448233 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + loaders: forge + name: ${{github.ref_name}}-1.21 - Forge + version-type: beta + files: 'versions/1.21-forge/build/libs/!(*-@(dev|sources|javadoc|all)).jar' + game-versions: 1.21 + - name: Publish-1.21-forge-Modrinth + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + modrinth-id: NNAgCjsB + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + loaders: forge + name: ${{github.ref_name}}-1.21 - Forge + files: 'versions/1.21-forge/build/libs/!(*-@(dev|sources|javadoc|all)).jar' + game-versions: 1.21 + - name: Publish-1.21-neoforge-Curseforge + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + curseforge-id: 448233 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + loaders: neoforge + name: ${{github.ref_name}}-1.21 - NeoForge + version-type: beta + files: 'versions/1.21-neoforge/build/libs/!(*-@(dev|sources|javadoc|all)).jar' + game-versions: 1.21 + - name: Publish-1.21-neoforge-Modrinth + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + modrinth-id: NNAgCjsB + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + loaders: neoforge + name: ${{github.ref_name}}-1.21 - NeoForge + files: 'versions/1.21-neoforge/build/libs/!(*-@(dev|sources|javadoc|all)).jar' + game-versions: 1.21 + - name: Publish-1.21-fabric-Curseforge + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + curseforge-id: 448233 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + loaders: fabric + name: ${{github.ref_name}}-1.21 - Fabric + files: 'versions/1.21-fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar' + game-versions: 1.21 + - name: Publish-1.21-fabric-Modrinth + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + modrinth-id: NNAgCjsB + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + loaders: fabric + name: ${{github.ref_name}}-1.21 - Fabric + files: 'versions/1.21-fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar' + game-versions: 1.21 diff --git a/settings.json b/settings.json index af9e6a0..983472a 100644 --- a/settings.json +++ b/settings.json @@ -10,6 +10,9 @@ "1.20.4-fabric", "1.20.6-forge", "1.20.6-neoforge", - "1.20.6-fabric" + "1.20.6-fabric", + "1.21-forge", + "1.21-neoforge", + "1.21-fabric" ] } diff --git a/src/main/java/dev/tr7zw/entityculling/CullTask.java b/src/main/java/dev/tr7zw/entityculling/CullTask.java index c8cf4bf..48e42e1 100644 --- a/src/main/java/dev/tr7zw/entityculling/CullTask.java +++ b/src/main/java/dev/tr7zw/entityculling/CullTask.java @@ -55,8 +55,8 @@ public void run() { Thread.sleep(sleepDelay); if (EntityCullingVersionlessBase.enabled && client.level != null && client.player != null && client.player.tickCount > 10) { - Vec3 cameraMC = EntityCullingModBase.instance.config.debugMode - ? client.player.getEyePosition(client.getDeltaFrameTime()) + // getEyePosition can use a fixed delta as its debug only anyway + Vec3 cameraMC = EntityCullingModBase.instance.config.debugMode ? client.player.getEyePosition(0) : client.gameRenderer.getMainCamera().getPosition(); if (requestCull @@ -143,7 +143,7 @@ private void cullBlockEntities(Vec3 cameraMC, Vec3d camera) { } catch (NullPointerException | ConcurrentModificationException ex) { break; // We are not synced to the main thread, so NPE's/CME are allowed here and way // less - // overhead probably than trying to sync stuff up for no really good reason + // overhead probably than trying to sync stuff up for no really good reason } if (blockEntityWhitelist.contains(entry.getValue().getType())) { continue; diff --git a/src/main/java/dev/tr7zw/entityculling/EntityCullingMod.java b/src/main/java/dev/tr7zw/entityculling/EntityCullingMod.java index 093840a..bc9899f 100644 --- a/src/main/java/dev/tr7zw/entityculling/EntityCullingMod.java +++ b/src/main/java/dev/tr7zw/entityculling/EntityCullingMod.java @@ -19,7 +19,6 @@ //$$ import net.neoforged.fml.IExtensionPoint; //$$ import net.neoforged.fml.ModLoadingContext; //$$ import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -//$$ import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext; //$$ import net.neoforged.neoforge.common.NeoForge; //#else //$$ import net.minecraftforge.common.MinecraftForge; @@ -57,13 +56,9 @@ public void initModloader() { //$$ public class EntityCullingMod extends EntityCullingModBase { //$$ //$$ public EntityCullingMod() { - //$$ FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); + //$$ ModLoaderUtil.registerClientSetupListener(this::onInitialize); //$$ } //$$ - //$$ private void setup(final FMLCommonSetupEvent event) { - //$$ onInitialize(); - //$$ } - //$$ //$$ @Override //$$ public void initModloader() { //$$ ModLoaderUtil.registerKeybind(keybind); diff --git a/src/main/java/dev/tr7zw/entityculling/EntityCullingModBase.java b/src/main/java/dev/tr7zw/entityculling/EntityCullingModBase.java index 00c9931..fbdb050 100644 --- a/src/main/java/dev/tr7zw/entityculling/EntityCullingModBase.java +++ b/src/main/java/dev/tr7zw/entityculling/EntityCullingModBase.java @@ -8,6 +8,7 @@ import com.logisticscraft.occlusionculling.OcclusionCullingInstance; import dev.tr7zw.entityculling.versionless.EntityCullingVersionlessBase; +import dev.tr7zw.util.NMSHelper; import net.minecraft.ChatFormatting; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; @@ -58,21 +59,21 @@ public void clientTick() { cullThread.start(); for (String blockId : config.blockEntityWhitelist) { Optional> block = BuiltInRegistries.BLOCK_ENTITY_TYPE - .getOptional(new ResourceLocation(blockId)); + .getOptional(NMSHelper.getResourceLocation(blockId)); block.ifPresent(b -> { blockEntityWhitelist.add(b); }); } for (String entityType : config.tickCullingWhitelist) { Optional> entity = BuiltInRegistries.ENTITY_TYPE - .getOptional(new ResourceLocation(entityType)); + .getOptional(NMSHelper.getResourceLocation(entityType)); entity.ifPresent(e -> { entityWhistelist.add(e); }); } for (String entityType : config.entityWhitelist) { Optional> entity = BuiltInRegistries.ENTITY_TYPE - .getOptional(new ResourceLocation(entityType)); + .getOptional(NMSHelper.getResourceLocation(entityType)); entity.ifPresent(e -> { entityWhistelist.add(e); }); diff --git a/versions/mainProject b/versions/mainProject index 304eaac..dfdd511 100644 --- a/versions/mainProject +++ b/versions/mainProject @@ -1 +1 @@ -1.20.6-fabric \ No newline at end of file +1.21-fabric \ No newline at end of file