[Fix] DataFixerUpper does not recognize the BCLChunkGenerator
(#113)
This commit is contained in:
parent
0ca3359434
commit
3dcc615e78
4 changed files with 83 additions and 1 deletions
|
@ -12,6 +12,8 @@ import org.betterx.worlds.together.chunkgenerator.InjectableSurfaceRules;
|
|||
import org.betterx.worlds.together.chunkgenerator.RestorableBiomeSource;
|
||||
import org.betterx.worlds.together.world.BiomeSourceWithNoiseRelatedSettings;
|
||||
|
||||
import com.mojang.datafixers.DSL;
|
||||
import com.mojang.datafixers.types.templates.TypeTemplate;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.Holder;
|
||||
|
@ -34,8 +36,11 @@ import net.minecraft.world.level.levelgen.*;
|
|||
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class BCLChunkGenerator extends NoiseBasedChunkGenerator implements RestorableBiomeSource<BCLChunkGenerator>, InjectableSurfaceRules<BCLChunkGenerator>, EnforceableChunkGenerator<BCLChunkGenerator> {
|
||||
|
||||
|
@ -168,7 +173,6 @@ public class BCLChunkGenerator extends NoiseBasedChunkGenerator implements Resto
|
|||
dimensionRegistry,
|
||||
referenceGenerator
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -192,4 +196,13 @@ public class BCLChunkGenerator extends NoiseBasedChunkGenerator implements Resto
|
|||
true
|
||||
);
|
||||
}
|
||||
|
||||
public static Map<String, Supplier<TypeTemplate>> addGeneratorDSL(Map<String, Supplier<TypeTemplate>> map) {
|
||||
if (map.containsKey("minecraft:flat")) {
|
||||
Map<String, Supplier<TypeTemplate>> nMap = new HashMap<>(map);
|
||||
nMap.put("bclib:betterx", DSL::remainder);
|
||||
return nMap;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package org.betterx.bclib.mixin.common;
|
||||
|
||||
import com.mojang.datafixers.DSL;
|
||||
import net.minecraft.util.datafix.fixes.MissingDimensionFix;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(MissingDimensionFix.class)
|
||||
public class MissingDimensionFixMixin {
|
||||
@ModifyArg(method = "makeRule", at = @At(value = "INVOKE", target = "Lcom/mojang/datafixers/DSL;taggedChoiceType(Ljava/lang/String;Lcom/mojang/datafixers/types/Type;Ljava/util/Map;)Lcom/mojang/datafixers/types/Type;"))
|
||||
Map<String, Object> bcl_addGenerator(Map<String, Object> map) {
|
||||
|
||||
if (map.containsKey("minecraft:flat")) {
|
||||
Map<String, Object> nMap = new HashMap<>(map);
|
||||
nMap.put("bclib:betterx", DSL.remainderType());
|
||||
return nMap;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
23
src/main/java/org/betterx/bclib/mixin/common/V2551Mixin.java
Normal file
23
src/main/java/org/betterx/bclib/mixin/common/V2551Mixin.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package org.betterx.bclib.mixin.common;
|
||||
|
||||
|
||||
import org.betterx.bclib.api.v2.generator.BCLChunkGenerator;
|
||||
|
||||
import com.mojang.datafixers.types.templates.TypeTemplate;
|
||||
import net.minecraft.util.datafix.schemas.V2551;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(V2551.class)
|
||||
public class V2551Mixin {
|
||||
@ModifyArg(method = "method_28297", at = @At(value = "INVOKE", target = "Lcom/mojang/datafixers/DSL;taggedChoiceLazy(Ljava/lang/String;Lcom/mojang/datafixers/types/Type;Ljava/util/Map;)Lcom/mojang/datafixers/types/templates/TaggedChoice;"))
|
||||
private static Map<String, Supplier<TypeTemplate>> bcl_addGenerator(Map<String, Supplier<TypeTemplate>> map) {
|
||||
return BCLChunkGenerator.addGeneratorDSL(map);
|
||||
}
|
||||
}
|
||||
|
21
src/main/java/org/betterx/bclib/mixin/common/V2832Mixin.java
Normal file
21
src/main/java/org/betterx/bclib/mixin/common/V2832Mixin.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package org.betterx.bclib.mixin.common;
|
||||
|
||||
import org.betterx.bclib.api.v2.generator.BCLChunkGenerator;
|
||||
|
||||
import com.mojang.datafixers.types.templates.TypeTemplate;
|
||||
import net.minecraft.util.datafix.schemas.V2832;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(V2832.class)
|
||||
public class V2832Mixin {
|
||||
@ModifyArg(method = "method_38837", at = @At(value = "INVOKE", target = "Lcom/mojang/datafixers/DSL;taggedChoiceLazy(Ljava/lang/String;Lcom/mojang/datafixers/types/Type;Ljava/util/Map;)Lcom/mojang/datafixers/types/templates/TaggedChoice;"))
|
||||
private static Map<String, Supplier<TypeTemplate>> bcl_addGenerator(Map<String, Supplier<TypeTemplate>> map) {
|
||||
return BCLChunkGenerator.addGeneratorDSL(map);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue