Skip to content

Commit

Permalink
Remove nether param. range list caching
Browse files Browse the repository at this point in the history
This looks to be a fix to #332; for whatever reason caching those values made the nether preset override not work (likely bc they weren't being cleared properly on new world load?)
Either way this is a bandaid fix but it at least works as expected now
  • Loading branch information
cocona20xx committed Jul 29, 2023
1 parent 0ddf030 commit 550b0c2
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
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.CallbackInfoReturnable;
Expand All @@ -35,9 +34,6 @@

@Mixin(MultiNoiseBiomeSource.class)
public abstract class MultiNoiseBiomeSourceMixin {
@Unique
private static MultiNoiseUtil.ParameterRangeList<Holder<Biome>> quilt$CACHED_PARAMETER_RANGE_LIST = null;

@Dynamic
@Inject(
method = "method_49505(Lnet/minecraft/registry/Holder;)Lnet/minecraft/world/biome/source/util/MultiNoiseUtil$ParameterRangeList;",
Expand All @@ -49,14 +45,12 @@ public abstract class MultiNoiseBiomeSourceMixin {
CallbackInfoReturnable<MultiNoiseUtil.ParameterRangeList<Holder<Biome>>> cir
) {
if (MultiNoiseBiomeSourceParameterLists.NETHER.equals(holder.getKey().orElseThrow())) {
if (quilt$CACHED_PARAMETER_RANGE_LIST == null) {
MultiNoiseBiomeSourceMixin.quilt$CACHED_PARAMETER_RANGE_LIST = NetherBiomeData.withModdedBiomeEntries(
MultiNoiseUtil.ParameterRangeList<Holder<Biome>> quilt$nether_parameter_range_list = NetherBiomeData.withModdedBiomeEntries(
holder.value().getRangeList(),
((MultiNoiseBiomeSourceParameterListHook) holder.value()).getHolderProvider()::getHolderOrThrow
);
}

cir.setReturnValue(MultiNoiseBiomeSourceMixin.quilt$CACHED_PARAMETER_RANGE_LIST);
cir.setReturnValue(quilt$nether_parameter_range_list);
}
}
}

0 comments on commit 550b0c2

Please sign in to comment.