mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 16:35:50 +00:00
still doesnt work but it works more™️
This commit is contained in:
parent
66758859bb
commit
5354cdebf6
@ -70,6 +70,7 @@ import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeEffects;
|
||||
import net.minecraft.world.biome.GenerationSettings;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.GeneratorOptions;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
@ -310,8 +311,13 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
ConfigPack pack = registry.get("DEFAULT");
|
||||
final GeneratorType generatorType = new GeneratorType("terra") {
|
||||
@Override
|
||||
public GeneratorOptions createDefaultOptions(DynamicRegistryManager.Impl registryManager, long seed, boolean generateStructures, boolean bonusChest) {
|
||||
return super.createDefaultOptions(registryManager, seed, generateStructures, bonusChest);
|
||||
public TerraGeneratorOptions createDefaultOptions(DynamicRegistryManager.Impl registryManager, long seed, boolean generateStructures, boolean bonusChest) {
|
||||
Registry<Biome> registry = registryManager.get(Registry.BIOME_KEY);
|
||||
Registry<DimensionType> registry2 = registryManager.get(Registry.DIMENSION_TYPE_KEY);
|
||||
Registry<ChunkGeneratorSettings> registry3 = registryManager.get(Registry.NOISE_SETTINGS_WORLDGEN);
|
||||
|
||||
|
||||
return new TerraGeneratorOptions(seed, generateStructures, bonusChest, GeneratorOptions.method_28608(registry2, DimensionType.createDefaultDimensionOptions(registry2, registry, registry3, seed), this.getChunkGenerator(registry, registry3, seed)), registry, registry3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -321,7 +327,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
};
|
||||
Map<Optional<GeneratorType>, GeneratorType.ScreenProvider> screenProviderMap = new HashMap<>(GeneratorTypeAccessor.getScreenProviders());
|
||||
|
||||
screenProviderMap.put(Optional.of(generatorType), (screen, generatorOptions) -> new TerraOptionsScreen(screen));
|
||||
screenProviderMap.put(Optional.of(generatorType), (screen, generatorOptions) -> new TerraOptionsScreen(screen, (TerraGeneratorOptions) generatorOptions));
|
||||
|
||||
GeneratorTypeAccessor.setScreenProviders(ImmutableMap.copyOf(screenProviderMap)); // jumping through hoops because ImmutableMap
|
||||
|
||||
|
@ -0,0 +1,159 @@
|
||||
package com.dfsek.terra.fabric;
|
||||
|
||||
import com.dfsek.terra.api.util.generic.pair.ImmutablePair;
|
||||
import com.dfsek.terra.fabric.mixin.access.SimpleRegistryAccessor;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import net.minecraft.client.world.GeneratorType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.util.registry.SimpleRegistry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.dimension.DimensionOptions;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.GeneratorOptions;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.OptionalLong;
|
||||
import java.util.Random;
|
||||
|
||||
public class TerraGeneratorOptions extends GeneratorOptions {
|
||||
private final Map<DimensionType, ImmutablePair<GeneratorType, ChunkGenerator>> override = new HashMap<>();
|
||||
private final Registry<Biome> biomeRegistry;
|
||||
private final Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry;
|
||||
|
||||
public TerraGeneratorOptions(long seed, boolean generateStructures, boolean bonusChest, SimpleRegistry<DimensionOptions> simpleRegistry,
|
||||
Registry<Biome> registry2, Registry<ChunkGeneratorSettings> registry3) {
|
||||
super(seed, generateStructures, bonusChest, simpleRegistry);
|
||||
System.out.println("Creating Terra options");
|
||||
Thread.dumpStack();
|
||||
this.biomeRegistry = registry2;
|
||||
this.chunkGeneratorSettingsRegistry = registry3;
|
||||
}
|
||||
|
||||
public Registry<ChunkGeneratorSettings> getChunkGeneratorSettingsRegistry() {
|
||||
return chunkGeneratorSettingsRegistry;
|
||||
}
|
||||
|
||||
public Registry<Biome> getBiomeRegistry() {
|
||||
return biomeRegistry;
|
||||
}
|
||||
|
||||
public void overrideChunkGenerator(DimensionType dimensionType, GeneratorType identifier, ChunkGenerator newGenerator) {
|
||||
override.put(dimensionType, ImmutablePair.of(identifier, newGenerator));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerraGeneratorOptions toggleGenerateStructures() {
|
||||
return new TerraGeneratorOptions(getSeed(), !shouldGenerateStructures(), hasBonusChest(), getDimensions(), biomeRegistry, chunkGeneratorSettingsRegistry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerraGeneratorOptions toggleBonusChest() {
|
||||
return new TerraGeneratorOptions(getSeed(), shouldGenerateStructures(), !hasBonusChest(), getDimensions(), biomeRegistry, chunkGeneratorSettingsRegistry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorOptions withHardcore(boolean hardcore, OptionalLong seed) {
|
||||
long l = seed.orElse(this.getSeed());
|
||||
SimpleRegistry<DimensionOptions> simpleRegistry2;
|
||||
if(seed.isPresent()) {
|
||||
simpleRegistry2 = new SimpleRegistry<>(Registry.DIMENSION_OPTIONS, Lifecycle.experimental());
|
||||
long longSeed = seed.getAsLong();
|
||||
|
||||
for(Map.Entry<RegistryKey<DimensionOptions>, DimensionOptions> registryKeyDimensionOptionsEntry : getDimensions().getEntries()) {
|
||||
RegistryKey<DimensionOptions> registryKey = registryKeyDimensionOptionsEntry.getKey();
|
||||
simpleRegistry2.add(registryKey, new DimensionOptions(registryKeyDimensionOptionsEntry.getValue().getDimensionTypeSupplier(), registryKeyDimensionOptionsEntry.getValue().getChunkGenerator().withSeed(longSeed)), getDimensions().getEntryLifecycle(registryKeyDimensionOptionsEntry.getValue()));
|
||||
}
|
||||
} else {
|
||||
simpleRegistry2 = getDimensions();
|
||||
}
|
||||
|
||||
GeneratorOptions generatorOptions2;
|
||||
|
||||
if(this.isDebugWorld()) {
|
||||
generatorOptions2 = new TerraGeneratorOptions(l, false, false, simpleRegistry2, biomeRegistry, chunkGeneratorSettingsRegistry);
|
||||
} else {
|
||||
generatorOptions2 = new TerraGeneratorOptions(l, this.shouldGenerateStructures(), hasBonusChest() && !hardcore, simpleRegistry2, biomeRegistry, chunkGeneratorSettingsRegistry);
|
||||
}
|
||||
|
||||
return generatorOptions2;
|
||||
}
|
||||
|
||||
public Map<DimensionType, ImmutablePair<GeneratorType, ChunkGenerator>> getOverrides() {
|
||||
return override;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator getChunkGenerator() {
|
||||
System.out.println("Getting chunk generator");
|
||||
Thread.dumpStack();
|
||||
return super.getChunkGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleRegistry<DimensionOptions> getDimensions() {
|
||||
new SimpleRegistry<DimensionOptions>(Registry.DIMENSION_OPTIONS, Lifecycle.stable()) {
|
||||
@Nullable
|
||||
@Override
|
||||
public DimensionOptions get(int index) {
|
||||
DimensionOptions options = super.get(index);
|
||||
if(options == null) return null;
|
||||
return new DimensionOptionsOverride(options);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DimensionOptions get(@Nullable RegistryKey<DimensionOptions> key) {
|
||||
DimensionOptions options = super.get(key);
|
||||
if(options == null) return null;
|
||||
return new DimensionOptionsOverride(options);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DimensionOptions get(@Nullable Identifier id) {
|
||||
DimensionOptions options = super.get(id);
|
||||
if(options == null) return null;
|
||||
return new DimensionOptionsOverride(options);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DimensionOptions getRandom(Random random) {
|
||||
DimensionOptions options = super.getRandom(random);
|
||||
if(options == null) return null;
|
||||
return new DimensionOptionsOverride(options);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "ConstantConditions"})
|
||||
@Override
|
||||
public Iterator<DimensionOptions> iterator() {
|
||||
return Iterators.filter(((SimpleRegistryAccessor<DimensionOptions>) (Object) this).getRawIdToEntry().stream().map(DimensionOptionsOverride::new).map(dimensionOptionsOverride -> (DimensionOptions) dimensionOptionsOverride).iterator(), Objects::nonNull);
|
||||
}
|
||||
};
|
||||
return super.getDimensions();
|
||||
}
|
||||
|
||||
public final class DimensionOptionsOverride extends DimensionOptions {
|
||||
|
||||
public DimensionOptionsOverride(DimensionOptions options) {
|
||||
super(options.getDimensionTypeSupplier(), options.getChunkGenerator());
|
||||
System.out.println("Overriding " + getDimensionType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator getChunkGenerator() {
|
||||
ChunkGenerator overridden = override.get(getDimensionType()).getRight();
|
||||
if(overridden != null) return overridden;
|
||||
return super.getChunkGenerator();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.dfsek.terra.fabric;
|
||||
|
||||
import com.dfsek.terra.api.util.generic.pair.ImmutablePair;
|
||||
import com.dfsek.terra.api.util.mutable.MutableInteger;
|
||||
import com.dfsek.terra.config.pack.ConfigPack;
|
||||
import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.fabric.generation.TerraBiomeSource;
|
||||
import com.dfsek.terra.fabric.mixin.access.GeneratorTypeAccessor;
|
||||
@ -16,7 +18,7 @@ import net.minecraft.text.BaseText;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
@ -29,25 +31,16 @@ import java.util.List;
|
||||
public class TerraOptionsScreen extends Screen {
|
||||
private final Screen parent;
|
||||
private final List<GeneratorType> generatorList = new ArrayList<>();
|
||||
private final TerraGeneratorOptions terraGeneratorOptions;
|
||||
private ButtonListWidget buttonListWidget;
|
||||
|
||||
public TerraOptionsScreen(Screen parent) {
|
||||
public TerraOptionsScreen(Screen parent, TerraGeneratorOptions terraGeneratorOptions) {
|
||||
super(new LiteralText("Terra Options"));
|
||||
this.parent = parent;
|
||||
this.terraGeneratorOptions = terraGeneratorOptions;
|
||||
generatorList.add(GeneratorType.DEFAULT);
|
||||
generatorList.add(GeneratorType.AMPLIFIED);
|
||||
|
||||
TerraFabricPlugin.getInstance().getConfigRegistry().forEach(pack -> generatorList.add(new GeneratorType("terra." + pack.getTemplate().getID()) {
|
||||
{
|
||||
//noinspection ConstantConditions
|
||||
((GeneratorTypeAccessor) (Object) this).setTranslationKey(new LiteralText("Terra:" + pack.getTemplate().getID()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChunkGenerator getChunkGenerator(Registry<Biome> biomeRegistry, Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry, long seed) {
|
||||
return new FabricChunkGeneratorWrapper(new TerraBiomeSource(biomeRegistry, seed, pack), seed, pack);
|
||||
}
|
||||
}));
|
||||
TerraFabricPlugin.getInstance().getConfigRegistry().forEach(pack -> generatorList.add(new TempGeneratorType(pack)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -57,13 +50,7 @@ public class TerraOptionsScreen extends Screen {
|
||||
|
||||
buttonListWidget.setLeftPos(10);
|
||||
|
||||
Registry<DimensionType> dimensionTypes = new DynamicRegistryManager.Impl().getDimensionTypes();
|
||||
|
||||
dimensionTypes.forEach(System.out::println);
|
||||
|
||||
buttonListWidget.addSingleOptionEntry(new GeneratorCycler("Overworld"));
|
||||
buttonListWidget.addSingleOptionEntry(new GeneratorCycler("Nether"));
|
||||
buttonListWidget.addSingleOptionEntry(new GeneratorCycler("End"));
|
||||
terraGeneratorOptions.getDimensions().getEntries().forEach((entry) -> buttonListWidget.addSingleOptionEntry(new GeneratorCycler(entry.getKey().getValue(), entry.getValue().getDimensionType())));
|
||||
|
||||
addChild(buttonListWidget);
|
||||
}
|
||||
@ -76,12 +63,45 @@ public class TerraOptionsScreen extends Screen {
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
private static final class TempGeneratorType extends GeneratorType {
|
||||
private final ConfigPack pack;
|
||||
|
||||
protected TempGeneratorType(ConfigPack pack) {
|
||||
super("terra:" + pack.getTemplate().getID());
|
||||
this.pack = pack;
|
||||
//noinspection ConstantConditions
|
||||
((GeneratorTypeAccessor) (Object) this).setTranslationKey(new LiteralText("Terra:" + this.pack.getTemplate().getID()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChunkGenerator getChunkGenerator(Registry<Biome> biomeRegistry, Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry, long seed) {
|
||||
return new FabricChunkGeneratorWrapper(new TerraBiomeSource(biomeRegistry, seed, pack), seed, pack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return pack.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof TempGeneratorType)) return false;
|
||||
return ((TempGeneratorType) obj).pack.equals(this.pack);
|
||||
}
|
||||
}
|
||||
|
||||
private final class GeneratorCycler extends CyclingOption {
|
||||
private final MutableInteger amount = new MutableInteger(0);
|
||||
private final DimensionType value;
|
||||
|
||||
public GeneratorCycler(String key) {
|
||||
super(key, null, null);
|
||||
public GeneratorCycler(Identifier key, DimensionType value) {
|
||||
super(key.toString(), null, null);
|
||||
this.value = value;
|
||||
ImmutablePair<GeneratorType, ChunkGenerator> generatorTypeChunkGeneratorImmutablePair = terraGeneratorOptions.getOverrides().get(value);
|
||||
|
||||
if(generatorTypeChunkGeneratorImmutablePair != null) {
|
||||
this.amount.set(generatorList.indexOf(generatorTypeChunkGeneratorImmutablePair.getLeft()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,7 +112,11 @@ public class TerraOptionsScreen extends Screen {
|
||||
@Override
|
||||
public void cycle(GameOptions options, int amount) {
|
||||
this.amount.addMod(amount, generatorList.size());
|
||||
terraGeneratorOptions.overrideChunkGenerator(value, generatorList.get(this.amount.get()),
|
||||
((GeneratorTypeAccessor) generatorList.get(this.amount.get()))
|
||||
.callGetChunkGenerator(terraGeneratorOptions.getBiomeRegistry(),
|
||||
terraGeneratorOptions.getChunkGeneratorSettingsRegistry(),
|
||||
terraGeneratorOptions.getSeed()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,9 @@ package com.dfsek.terra.fabric.mixin;
|
||||
|
||||
import com.dfsek.terra.config.pack.ConfigPack;
|
||||
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||
import com.dfsek.terra.fabric.generation.TerraBiomeSource;
|
||||
import com.dfsek.terra.fabric.TerraGeneratorOptions;
|
||||
import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.fabric.generation.TerraBiomeSource;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
@ -13,7 +14,9 @@ import net.minecraft.world.dimension.DimensionOptions;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.GeneratorOptions;
|
||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
import net.minecraft.world.gen.chunk.NoiseChunkGenerator;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@ -21,8 +24,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
|
||||
import static net.minecraft.world.gen.GeneratorOptions.method_28608;
|
||||
|
||||
@Mixin(GeneratorOptions.class)
|
||||
public abstract class GeneratorOptionsMixin {
|
||||
@Shadow
|
||||
public static NoiseChunkGenerator createOverworldGenerator(Registry<Biome> biomeRegistry, Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry, long seed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Inject(method = "fromProperties(Lnet/minecraft/util/registry/DynamicRegistryManager;Ljava/util/Properties;)Lnet/minecraft/world/gen/GeneratorOptions;", at = @At("HEAD"), cancellable = true)
|
||||
private static void fromProperties(DynamicRegistryManager dynamicRegistryManager, Properties properties, CallbackInfoReturnable<GeneratorOptions> cir) {
|
||||
if(properties.get("level-type") == null) {
|
||||
@ -51,13 +61,20 @@ public abstract class GeneratorOptionsMixin {
|
||||
Registry<ChunkGeneratorSettings> chunkGeneratorSettings = dynamicRegistryManager.get(Registry.NOISE_SETTINGS_WORLDGEN);
|
||||
SimpleRegistry<DimensionOptions> dimensionOptions = DimensionType.createDefaultDimensionOptions(dimensionTypes, biomes, chunkGeneratorSettings, l);
|
||||
|
||||
|
||||
prop = prop.substring(prop.indexOf(":") + 1);
|
||||
|
||||
ConfigPack pack = TerraFabricPlugin.getInstance().getConfigRegistry().get(prop);
|
||||
|
||||
if(pack == null) throw new IllegalArgumentException("No such pack " + prop);
|
||||
|
||||
cir.setReturnValue(new GeneratorOptions(l, generateStructures, false, GeneratorOptions.method_28608(dimensionTypes, dimensionOptions, new FabricChunkGeneratorWrapper(new TerraBiomeSource(biomes, l, pack), l, pack))));
|
||||
cir.setReturnValue(new TerraGeneratorOptions(l, generateStructures, false, method_28608(dimensionTypes, dimensionOptions, new FabricChunkGeneratorWrapper(new TerraBiomeSource(biomes, l, pack), l, pack)), biomes, chunkGeneratorSettings));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getDefaultOptions(Lnet/minecraft/util/registry/Registry;Lnet/minecraft/util/registry/Registry;Lnet/minecraft/util/registry/Registry;)Lnet/minecraft/world/gen/GeneratorOptions;", at = @At("HEAD"), cancellable = true)
|
||||
private static void injectDefaultOptions(Registry<DimensionType> registry, Registry<Biome> registry2, Registry<ChunkGeneratorSettings> registry3, CallbackInfoReturnable<GeneratorOptions> cir) {
|
||||
long l = (new Random()).nextLong();
|
||||
cir.setReturnValue(new TerraGeneratorOptions(l, true, false, method_28608(registry, DimensionType.createDefaultDimensionOptions(registry, registry2, registry3, l), createOverworldGenerator(registry2, registry3, l)), registry2, registry3));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.dfsek.terra.fabric.mixin;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.WorldGenerationProgressListener;
|
||||
import net.minecraft.world.SaveProperties;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
public abstract class MinecraftServerMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
protected SaveProperties saveProperties;
|
||||
|
||||
|
||||
@Inject(method = "createWorlds(Lnet/minecraft/server/WorldGenerationProgressListener;)V", at = @At("HEAD"))
|
||||
public void injectCreateWorlds(WorldGenerationProgressListener worldGenerationProgressListener, CallbackInfo ci) {
|
||||
System.out.println("Generator: " + this.saveProperties.getGeneratorOptions());
|
||||
Thread.dumpStack();
|
||||
}
|
||||
}
|
@ -2,9 +2,14 @@ package com.dfsek.terra.fabric.mixin.access;
|
||||
|
||||
import net.minecraft.client.world.GeneratorType;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -31,4 +36,7 @@ public interface GeneratorTypeAccessor {
|
||||
@Mutable
|
||||
@Accessor("translationKey")
|
||||
void setTranslationKey(Text translationKey);
|
||||
|
||||
@Invoker("getChunkGenerator")
|
||||
ChunkGenerator callGetChunkGenerator(Registry<Biome> biomeRegistry, Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry, long seed);
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.dfsek.terra.fabric.mixin.access;
|
||||
|
||||
import net.minecraft.world.gen.GeneratorOptions;
|
||||
import net.minecraft.world.level.LevelProperties;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(LevelProperties.class)
|
||||
public interface LevelPropertiesAccessor {
|
||||
@Accessor("generatorOptions")
|
||||
void setGeneratorOptions(GeneratorOptions generatorOptions);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.dfsek.terra.fabric.mixin.access;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectList;
|
||||
import net.minecraft.util.registry.SimpleRegistry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(SimpleRegistry.class)
|
||||
public interface SimpleRegistryAccessor<T> {
|
||||
@Accessor("rawIdToEntry")
|
||||
ObjectList<T> getRawIdToEntry();
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
accessWidener v1 named
|
||||
|
||||
extendable method net/minecraft/client/world/GeneratorType <init> (Ljava/lang/String;)V
|
||||
|
||||
extendable class net/minecraft/world/dimension/DimensionOptions
|
@ -5,8 +5,11 @@
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [
|
||||
"GeneratorOptionsMixin",
|
||||
"MinecraftServerMixin",
|
||||
"access.BiomeEffectsAccessor",
|
||||
"access.LevelPropertiesAccessor",
|
||||
"access.MobSpawnerLogicAccessor",
|
||||
"access.SimpleRegistryAccessor",
|
||||
"access.StateAccessor",
|
||||
"implementations.BiomeMixin",
|
||||
"implementations.ChunkGeneratorMixin",
|
||||
|
Loading…
x
Reference in New Issue
Block a user