Skip to content

Commit

Permalink
Update to 1.18 (#4)
Browse files Browse the repository at this point in the history
* Update to 1.18

* fabric crong???

* Update to 21w42a

* Remove biome caching

- 1.18 changed how biomes work, so the old method of biome caching no longer works
- Fixed formatting

Co-authored-by: PepperBell <[email protected]>
  • Loading branch information
IMS and PepperCode1 authored Oct 22, 2021
1 parent af05590 commit aa30a8c
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 101 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,18 @@

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;

@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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<CTMLoadingContainer<?>> ALL = new ObjectArrayList<>();
private static final List<CTMLoadingContainer<?>> AFFECTS_BLOCK = new ObjectArrayList<>();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Identifier, BiomeHolder> HOLDER_CACHE = new Object2ObjectOpenHashMap<>();
private static DynamicRegistryManager registryManager;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
],

"depends": {
"fabricloader": ">=0.11.3",
"fabricloader": ">=0.11.7",
"fabric": "*",
"minecraft": "1.17.x",
"minecraft": "1.18.x",
"java": ">=16"
},

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/resourcepacks/default/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 7,
"pack_format": 8,
"description": "Default connected textures for Continuity"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 7,
"pack_format": 8,
"description": "Glass pane culling fix"
}
}

0 comments on commit aa30a8c

Please sign in to comment.