mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
push changes
This commit is contained in:
parent
27a967f3a6
commit
50ba1c6eab
@ -5,6 +5,7 @@ import com.dfsek.tectonic.api.depth.DepthTracker;
|
|||||||
import com.dfsek.tectonic.api.exception.LoadException;
|
import com.dfsek.tectonic.api.exception.LoadException;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.SpawnGroup;
|
import net.minecraft.entity.SpawnGroup;
|
||||||
|
import net.minecraft.entity.boss.dragon.EnderDragonFight;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.sound.BiomeAdditionsSound;
|
import net.minecraft.sound.BiomeAdditionsSound;
|
||||||
|
@ -82,7 +82,11 @@ public class VanillaWorldProperties implements ConfigTemplate, Properties {
|
|||||||
|
|
||||||
@Value("minecraft.sealevel")
|
@Value("minecraft.sealevel")
|
||||||
@Default
|
@Default
|
||||||
private Integer sealevel = 62; //TODO AUTO PULL DEFAULT
|
private Integer sealevel = null;
|
||||||
|
|
||||||
|
@Value("minecraft.spawn-height")
|
||||||
|
@Default
|
||||||
|
private Integer spawnHeight = 64;
|
||||||
|
|
||||||
public String getVanillaDimension() {
|
public String getVanillaDimension() {
|
||||||
return vanillaDimension;
|
return vanillaDimension;
|
||||||
@ -160,4 +164,8 @@ public class VanillaWorldProperties implements ConfigTemplate, Properties {
|
|||||||
public Integer getSealevel() {
|
public Integer getSealevel() {
|
||||||
return sealevel;
|
return sealevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getSpawnHeight() {
|
||||||
|
return spawnHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,9 @@ public final class Codecs {
|
|||||||
public static final Codec<GenerationSettings> TERRA_GENERATION_SETTINGS = RecordCodecBuilder
|
public static final Codec<GenerationSettings> TERRA_GENERATION_SETTINGS = RecordCodecBuilder
|
||||||
.create(instance -> instance.group(
|
.create(instance -> instance.group(
|
||||||
TERRA_CONSTANT_RANGE.fieldOf("height").stable().forGetter(GenerationSettings::height),
|
TERRA_CONSTANT_RANGE.fieldOf("height").stable().forGetter(GenerationSettings::height),
|
||||||
Codec.INT.fieldOf("sealevel").forGetter(GenerationSettings::sealevel),
|
Codec.INT.fieldOf("sea_level").forGetter(GenerationSettings::sealevel),
|
||||||
Codec.BOOL.fieldOf("mob_generation").forGetter(GenerationSettings::mobGeneration))
|
Codec.BOOL.fieldOf("mob_generation").forGetter(GenerationSettings::mobGeneration),
|
||||||
|
Codec.INT.fieldOf("spawn_height").forGetter(GenerationSettings::sealevel))
|
||||||
.apply(instance, instance.stable(GenerationSettings::new)));
|
.apply(instance, instance.stable(GenerationSettings::new)));
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,5 +3,5 @@ package com.dfsek.terra.mod.generation;
|
|||||||
import com.dfsek.terra.api.util.ConstantRange;
|
import com.dfsek.terra.api.util.ConstantRange;
|
||||||
|
|
||||||
|
|
||||||
public record GenerationSettings(ConstantRange height, Integer sealevel, Boolean mobGeneration) {
|
public record GenerationSettings(ConstantRange height, Integer sealevel, Boolean mobGeneration, Integer spawnHeight) {
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import net.minecraft.world.StructureWorldAccess;
|
|||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.source.BiomeAccess;
|
import net.minecraft.world.biome.source.BiomeAccess;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.dimension.NetherPortal;
|
||||||
import net.minecraft.world.gen.GenerationStep.Carver;
|
import net.minecraft.world.gen.GenerationStep.Carver;
|
||||||
import net.minecraft.world.gen.StructureAccessor;
|
import net.minecraft.world.gen.StructureAccessor;
|
||||||
import net.minecraft.world.gen.StructureWeightSampler;
|
import net.minecraft.world.gen.StructureWeightSampler;
|
||||||
@ -105,12 +106,6 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWorldHeight() {
|
|
||||||
return settings.height().getRange();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig,
|
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig,
|
||||||
StructureAccessor structureAccessor, Chunk chunk) {
|
StructureAccessor structureAccessor, Chunk chunk) {
|
||||||
@ -165,6 +160,11 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWorldHeight() {
|
||||||
|
return settings.height().getRange();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSeaLevel() {
|
public int getSeaLevel() {
|
||||||
return settings.sealevel();
|
return settings.sealevel();
|
||||||
@ -175,6 +175,11 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
|||||||
return settings.height().getMin();
|
return settings.height().getMin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSpawnHeight(HeightLimitView world) {
|
||||||
|
return settings.spawnHeight();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHeight(int x, int z, Type heightmap, HeightLimitView height, NoiseConfig noiseConfig) {
|
public int getHeight(int x, int z, Type heightmap, HeightLimitView height, NoiseConfig noiseConfig) {
|
||||||
WorldProperties properties = MinecraftAdapter.adapt(height, SeedHack.getSeed(noiseConfig.getMultiNoiseSampler()));
|
WorldProperties properties = MinecraftAdapter.adapt(height, SeedHack.getSeed(noiseConfig.getMultiNoiseSampler()));
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.dfsek.terra.mod.mixin.generalize;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.block.entity.SignText;
|
||||||
|
import net.minecraft.client.render.DimensionEffects;
|
||||||
|
import net.minecraft.registry.DynamicRegistryManager;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.WorldGenerationProgressListener;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.random.RandomSequencesState;
|
||||||
|
import net.minecraft.util.profiler.Profiler;
|
||||||
|
import net.minecraft.village.raid.RaidManager;
|
||||||
|
import net.minecraft.world.MutableWorldProperties;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.dimension.DimensionOptions;
|
||||||
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
|
import net.minecraft.world.dimension.DimensionTypes;
|
||||||
|
import net.minecraft.world.level.ServerWorldProperties;
|
||||||
|
import net.minecraft.world.level.storage.LevelStorage;
|
||||||
|
import net.minecraft.world.level.storage.LevelStorage.Session;
|
||||||
|
import net.minecraft.world.spawner.SpecialSpawner;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
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.Redirect;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(ServerWorld.class)
|
||||||
|
public abstract class ServerWorldMixin extends World {
|
||||||
|
protected ServerWorldMixin(MutableWorldProperties properties, RegistryKey<World> registryRef, DynamicRegistryManager registryManager,
|
||||||
|
RegistryEntry<DimensionType> dimensionEntry, Supplier<Profiler> profiler, boolean isClient,
|
||||||
|
boolean debugWorld, long biomeAccess, int maxChainedNeighborUpdates) {
|
||||||
|
super(properties, registryRef, registryManager, dimensionEntry, profiler, isClient, debugWorld, biomeAccess,
|
||||||
|
maxChainedNeighborUpdates);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/registry/entry/RegistryEntry;matchesKey(Lnet/minecraft/registry/RegistryKey;)Z"))
|
||||||
|
public <T> boolean matchesKeyProxy(RegistryEntry<T> instance, RegistryKey<T> tRegistryKey) {
|
||||||
|
if (tRegistryKey == DimensionTypes.THE_END) {
|
||||||
|
return (this.getRegistryKey() == World.END);
|
||||||
|
}
|
||||||
|
return instance.matchesKey(tRegistryKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/village/raid/RaidManager;nameFor(Lnet/minecraft/registry/entry/RegistryEntry;)Ljava/lang/String;"))
|
||||||
|
public String nameForProxy(RegistryEntry<DimensionType> dimensionTypeEntry) {
|
||||||
|
RegistryEntry<DimensionType> entry = dimensionTypeEntry;
|
||||||
|
if (this.getRegistryKey() == World.END) {
|
||||||
|
entry = getRegistryManager().get(RegistryKeys.DIMENSION_TYPE).getEntry(DimensionTypes.THE_NETHER).orElseThrow();
|
||||||
|
}
|
||||||
|
return RaidManager.nameFor(entry);
|
||||||
|
}
|
||||||
|
}
|
@ -130,7 +130,8 @@ public class PresetUtil {
|
|||||||
: vanillaWorldProperties.getSealevel(),
|
: vanillaWorldProperties.getSealevel(),
|
||||||
vanillaWorldProperties.getMobGeneration() == null
|
vanillaWorldProperties.getMobGeneration() == null
|
||||||
? !defaultGeneratorSettings.value().mobGenerationDisabled()
|
? !defaultGeneratorSettings.value().mobGenerationDisabled()
|
||||||
: vanillaWorldProperties.getMobGeneration());
|
: vanillaWorldProperties.getMobGeneration(),
|
||||||
|
vanillaWorldProperties.getSpawnHeight());
|
||||||
|
|
||||||
ChunkGenerator generator = new MinecraftChunkGeneratorWrapper(biomeSource, pack, generatorSettings);
|
ChunkGenerator generator = new MinecraftChunkGeneratorWrapper(biomeSource, pack, generatorSettings);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public final class TagUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void registerWorldPresetTags(Registry<WorldPreset> registry) {
|
public static void registerWorldPresetTags(Registry<WorldPreset> registry) {
|
||||||
logger.info("Doing preset tag garbage....");
|
logger.info("Registering Preset Tags.");
|
||||||
Map<TagKey<WorldPreset>, List<RegistryEntry<WorldPreset>>> collect = tagsToMutableMap(registry);
|
Map<TagKey<WorldPreset>, List<RegistryEntry<WorldPreset>>> collect = tagsToMutableMap(registry);
|
||||||
|
|
||||||
PresetUtil
|
PresetUtil
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"access.StructureAccessorAccessor",
|
"access.StructureAccessorAccessor",
|
||||||
"access.VillagerTypeAccessor",
|
"access.VillagerTypeAccessor",
|
||||||
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
|
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
|
||||||
|
"generalize.ServerWorldMixin",
|
||||||
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
|
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
|
||||||
"implementations.terra.BiomeMixin",
|
"implementations.terra.BiomeMixin",
|
||||||
"implementations.terra.HandleImplementationMixin",
|
"implementations.terra.HandleImplementationMixin",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user