diff --git a/build.gradle b/build.gradle index 40e1530c..805df44b 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ dependencies { // Fabric API modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation('com.terraformersmc:modmenu:2.0.14') { + modImplementation('com.terraformersmc:modmenu:3.0.0') { exclude group: 'net.fabricmc.fabric-api' } diff --git a/gradle.properties b/gradle.properties index 3e62193b..c7dff707 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,15 +3,15 @@ org.gradle.jvmargs = -Xmx1G # Fabric Properties loom_version = 0.10-SNAPSHOT - minecraft_version = 1.17.1 - yarn_mappings = 1.17.1+build.61 + minecraft_version = 21w42a + yarn_mappings = 21w42a+build.1 loader_version = 0.11.7 # Mod Properties mod_version = 1.0.2 - mod_minecraft_version = 1.17 + mod_minecraft_version = 1.18 maven_group = me.pepperbell archives_base_name = continuity # Dependencies - fabric_version = 0.41.0+1.17 + fabric_version = 0.41.1+1.18 diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/ChunkRendererRegionMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/ChunkRendererRegionMixin.java index ec033f77..e97a4ce5 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/ChunkRendererRegionMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/ChunkRendererRegionMixin.java @@ -3,9 +3,7 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import me.pepperbell.continuity.client.util.biome.BiomeCaches; import me.pepperbell.continuity.client.util.biome.BiomeView; import net.minecraft.client.render.chunk.ChunkRendererRegion; import net.minecraft.util.math.BlockPos; @@ -14,37 +12,12 @@ @Mixin(ChunkRendererRegion.class) public class ChunkRendererRegionMixin implements BiomeView { - @Shadow - @Final - protected BlockPos offset; - @Shadow - @Final - protected int sizeX; - @Shadow - @Final - protected int sizeZ; @Shadow @Final protected World world; - @Unique - protected Biome[] biomeCache; - @Override public Biome getBiome(BlockPos pos) { - if (biomeCache == null) { - if (sizeX == 20 && sizeZ == 20) { - biomeCache = BiomeCaches.getStandardCache(); - } else { - biomeCache = BiomeCaches.createCache(sizeX, sizeZ); - } - } - int index = BiomeCaches.getBiomeIndex(pos.getX() - offset.getX(), pos.getZ() - offset.getZ(), sizeX); - Biome biome = biomeCache[index]; - if (biome == null) { - biome = world.getBiome(pos); - biomeCache[index] = biome; - } - return biome; + return world.getBiome(pos); } } diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/InputRegionMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/InputRegionMixin.java index 3329a7c4..c33ef021 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/InputRegionMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/InputRegionMixin.java @@ -2,15 +2,9 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import grondag.canvas.terrain.region.input.AbstractInputRegion; import grondag.canvas.terrain.region.input.InputRegion; -import grondag.canvas.terrain.region.input.PackedInputRegion; -import me.pepperbell.continuity.client.util.biome.BiomeCaches; import me.pepperbell.continuity.client.util.biome.BiomeView; import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; @@ -18,22 +12,8 @@ @Pseudo @Mixin(value = InputRegion.class, remap = false) public class InputRegionMixin extends AbstractInputRegion implements BiomeView { - @Unique - protected Biome[] biomeCache = BiomeCaches.createStandardCache(); - - @Inject(method = "prepare(Lgrondag/canvas/terrain/region/input/PackedInputRegion;)V", at = @At("HEAD")) - private void onPrepare(PackedInputRegion packedInputRegion, CallbackInfo ci) { - BiomeCaches.clearStandardCache(biomeCache); - } - @Override public Biome getBiome(BlockPos pos) { - int index = BiomeCaches.getBiomeIndex(pos.getX() - originX + 2, pos.getZ() - originZ + 2, 20); - Biome biome = biomeCache[index]; - if (biome == null) { - biome = world.getBiome(pos); - biomeCache[index] = biome; - } - return biome; + return world.getBiome(pos); } } diff --git a/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java b/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java index 8466e117..ef0005df 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java @@ -8,7 +8,8 @@ import java.util.Set; import java.util.function.Consumer; -import org.apache.http.annotation.NotThreadSafe; +import org.apache.http.annotation.Contract; +import org.apache.http.annotation.ThreadingBehavior; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; @@ -30,7 +31,7 @@ import net.minecraft.resource.ResourceType; import net.minecraft.util.Identifier; -@NotThreadSafe +@Contract(threading = ThreadingBehavior.UNSAFE) public final class CTMPropertiesLoader { private static final List> ALL = new ObjectArrayList<>(); private static final List> AFFECTS_BLOCK = new ObjectArrayList<>(); diff --git a/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeCaches.java b/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeCaches.java deleted file mode 100644 index 2cfc6edc..00000000 --- a/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeCaches.java +++ /dev/null @@ -1,39 +0,0 @@ -package me.pepperbell.continuity.client.util.biome; - -import net.minecraft.world.biome.Biome; - -public final class BiomeCaches { - private static final Biome[] EMPTY = createCache(20); - private static final ThreadLocal CACHES = ThreadLocal.withInitial(BiomeCaches::createStandardCache); - - public static Biome[] createCache(int sizeX, int sizeZ) { - return new Biome[sizeX * sizeZ]; - } - - public static Biome[] createCache(int size) { - return createCache(size, size); - } - - public static Biome[] createStandardCache() { - return createCache(20); - } - - public static void clearStandardCache(Biome[] cache) { - System.arraycopy(EMPTY, 0, cache, 0, EMPTY.length); - } - - /** - * Gets a standard 20x20 biome cache. - * - * @return a Biome array of length 400. - */ - public static Biome[] getStandardCache() { - Biome[] cache = CACHES.get(); - clearStandardCache(cache); - return cache; - } - - public static int getBiomeIndex(int posX, int posZ, int sizeX) { - return posZ * sizeX + posX; - } -} diff --git a/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java b/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java index 88b675fb..b1100330 100644 --- a/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java +++ b/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java @@ -2,7 +2,8 @@ import java.util.Map; -import org.apache.http.annotation.NotThreadSafe; +import org.apache.http.annotation.Contract; +import org.apache.http.annotation.ThreadingBehavior; import org.jetbrains.annotations.ApiStatus; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -11,7 +12,7 @@ import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; -@NotThreadSafe +@Contract(threading = ThreadingBehavior.UNSAFE) public final class BiomeHolderManager { private static final Map HOLDER_CACHE = new Object2ObjectOpenHashMap<>(); private static DynamicRegistryManager registryManager; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9f2ff472..0df48027 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -31,9 +31,9 @@ ], "depends": { - "fabricloader": ">=0.11.3", + "fabricloader": ">=0.11.7", "fabric": "*", - "minecraft": "1.17.x", + "minecraft": "1.18.x", "java": ">=16" }, diff --git a/src/main/resources/resourcepacks/default/pack.mcmeta b/src/main/resources/resourcepacks/default/pack.mcmeta index 3672d0e4..85522deb 100644 --- a/src/main/resources/resourcepacks/default/pack.mcmeta +++ b/src/main/resources/resourcepacks/default/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "pack_format": 7, + "pack_format": 8, "description": "Default connected textures for Continuity" } } diff --git a/src/main/resources/resourcepacks/glass_pane_culling_fix/pack.mcmeta b/src/main/resources/resourcepacks/glass_pane_culling_fix/pack.mcmeta index a1f18843..cc572617 100644 --- a/src/main/resources/resourcepacks/glass_pane_culling_fix/pack.mcmeta +++ b/src/main/resources/resourcepacks/glass_pane_culling_fix/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "pack_format": 7, + "pack_format": 8, "description": "Glass pane culling fix" } }