mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-04 14:56:28 +00:00
fabric pass 1
This commit is contained in:
@@ -6,6 +6,7 @@ import com.dfsek.terra.api.registry.CheckedRegistry;
|
||||
import com.dfsek.terra.api.world.TerraWorld;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ConfigPack extends LoaderRegistrar {
|
||||
@@ -25,4 +26,16 @@ public interface ConfigPack extends LoaderRegistrar {
|
||||
String getAuthor();
|
||||
|
||||
String getVersion();
|
||||
|
||||
boolean vanillaMobs();
|
||||
|
||||
boolean vanillaStructures();
|
||||
|
||||
boolean vanillaCaves();
|
||||
|
||||
boolean disableStructures();
|
||||
|
||||
Map<String, String> getLocatable();
|
||||
|
||||
boolean doBetaCarvers();
|
||||
}
|
||||
|
||||
@@ -28,4 +28,10 @@ public interface WorldConfig {
|
||||
boolean disableFlora();
|
||||
|
||||
boolean disableStructures();
|
||||
|
||||
String getID();
|
||||
|
||||
String getAuthor();
|
||||
|
||||
String getVersion();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.dfsek.terra.api.util.logging;
|
||||
|
||||
import com.dfsek.terra.api.Logger;
|
||||
|
||||
public class DebugLogger {
|
||||
public class DebugLogger implements Logger {
|
||||
private final Logger logger;
|
||||
private boolean debug = false;
|
||||
|
||||
@@ -22,15 +22,15 @@ public class DebugLogger {
|
||||
if(debug) logger.info(message);
|
||||
}
|
||||
|
||||
public void warn(String message) {
|
||||
public void warning(String message) {
|
||||
if(debug) logger.warning(message);
|
||||
}
|
||||
|
||||
public void error(String message) {
|
||||
public void severe(String message) {
|
||||
if(debug) logger.severe(message);
|
||||
}
|
||||
|
||||
public void stack(Exception e) {
|
||||
public void stack(Throwable e) {
|
||||
if(debug) e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,4 +338,34 @@ public class ConfigPackImpl implements ConfigPack {
|
||||
public String getVersion() {
|
||||
return template.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean vanillaMobs() {
|
||||
return template.vanillaMobs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean vanillaStructures() {
|
||||
return template.vanillaStructures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean vanillaCaves() {
|
||||
return template.vanillaCaves();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disableStructures() {
|
||||
return template.disableStructures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getLocatable() {
|
||||
return template.getLocatable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doBetaCarvers() {
|
||||
return template.doBetaCarvers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,21 @@ public class WorldConfigImpl implements WorldConfig {
|
||||
return pack.getTemplate().disableStructures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return pack.getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return pack.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return pack.getVersion();
|
||||
}
|
||||
|
||||
public Set<TerraStructure> getStructures() {
|
||||
return new HashSet<>(getRegistry(TerraStructure.class).entries());
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.dfsek.terra.registry.master;
|
||||
|
||||
import com.dfsek.tectonic.exception.ConfigException;
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.config.pack.ConfigPackImpl;
|
||||
import com.dfsek.terra.registry.OpenRegistryImpl;
|
||||
|
||||
@@ -12,10 +13,10 @@ import java.util.zip.ZipFile;
|
||||
/**
|
||||
* Class to hold config packs
|
||||
*/
|
||||
public class ConfigRegistry extends OpenRegistryImpl<ConfigPackImpl> {
|
||||
public class ConfigRegistry extends OpenRegistryImpl<ConfigPack> {
|
||||
public void load(File folder, TerraPlugin main) throws ConfigException {
|
||||
ConfigPackImpl pack = new ConfigPackImpl(folder, main);
|
||||
add(pack.getTemplate().getID(), pack);
|
||||
ConfigPack pack = new ConfigPackImpl(folder, main);
|
||||
add(pack.getID(), pack);
|
||||
}
|
||||
|
||||
public boolean loadAll(TerraPlugin main) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.world;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.event.events.world.TerraWorldLoadEvent;
|
||||
import com.dfsek.terra.api.vector.Location;
|
||||
import com.dfsek.terra.api.world.TerraWorld;
|
||||
@@ -24,10 +25,10 @@ public class TerraWorldImpl implements TerraWorld {
|
||||
private final BlockData air;
|
||||
|
||||
|
||||
public TerraWorldImpl(World w, ConfigPackImpl c, TerraPlugin main) {
|
||||
public TerraWorldImpl(World w, ConfigPack c, TerraPlugin main) {
|
||||
if(!w.isTerraWorld()) throw new IllegalArgumentException("World " + w + " is not a Terra World!");
|
||||
this.world = w;
|
||||
config = c.toWorldConfig(this);
|
||||
config = (WorldConfigImpl) c.toWorldConfig(this);
|
||||
this.provider = config.getProvider();
|
||||
air = main.getWorldHandle().createBlockData("minecraft:air");
|
||||
main.getEventManager().callEvent(new TerraWorldLoadEvent(this, c));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.world.generation.generators;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.math.range.ConstantRange;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.TerraWorld;
|
||||
@@ -43,7 +44,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
private final ConfigPackImpl configPack;
|
||||
private final ConfigPack configPack;
|
||||
private final TerraPlugin main;
|
||||
private final BlockType water;
|
||||
private final PaletteImpl.Singleton blank;
|
||||
@@ -51,7 +52,7 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
|
||||
private final Carver carver;
|
||||
|
||||
public DefaultChunkGenerator3D(ConfigPackImpl c, TerraPlugin main) {
|
||||
public DefaultChunkGenerator3D(ConfigPack c, TerraPlugin main) {
|
||||
this.configPack = c;
|
||||
this.main = main;
|
||||
|
||||
@@ -67,7 +68,7 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigPackImpl getConfigPack() {
|
||||
public ConfigPack getConfigPack() {
|
||||
return configPack;
|
||||
}
|
||||
|
||||
@@ -131,7 +132,7 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(configPack.getTemplate().doBetaCarvers()) {
|
||||
if(configPack.doBetaCarvers()) {
|
||||
carver.carve(world, chunkX, chunkZ, chunk);
|
||||
}
|
||||
return chunk;
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.dfsek.terra.api.world.TerraWorld;
|
||||
import com.dfsek.terra.api.world.Tree;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
import com.dfsek.terra.api.registry.CheckedRegistry;
|
||||
import com.dfsek.terra.api.registry.LockedRegistry;
|
||||
import com.dfsek.terra.api.transform.TransformerImpl;
|
||||
import com.dfsek.terra.api.transform.Validator;
|
||||
import com.dfsek.terra.api.util.generic.pair.Pair;
|
||||
@@ -53,6 +52,8 @@ import com.dfsek.terra.fabric.util.ProtoBiome;
|
||||
import com.dfsek.terra.api.profiler.Profiler;
|
||||
import com.dfsek.terra.profiler.ProfilerImpl;
|
||||
import com.dfsek.terra.api.registry.DuplicateEntryException;
|
||||
import com.dfsek.terra.registry.CheckedRegistryImpl;
|
||||
import com.dfsek.terra.registry.LockedRegistryImpl;
|
||||
import com.dfsek.terra.registry.master.AddonRegistry;
|
||||
import com.dfsek.terra.registry.master.ConfigRegistry;
|
||||
import com.dfsek.terra.world.TerraWorldImpl;
|
||||
@@ -119,11 +120,11 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
private final ItemHandle itemHandle = new FabricItemHandle();
|
||||
private final WorldHandle worldHandle = new FabricWorldHandle();
|
||||
private final ConfigRegistry configRegistry = new ConfigRegistry();
|
||||
private final CheckedRegistry<ConfigPack> checkedRegistry = new CheckedRegistry<>(configRegistry);
|
||||
private final CheckedRegistry<ConfigPack> checkedRegistry = new CheckedRegistryImpl<>(configRegistry);
|
||||
|
||||
private final FabricAddon fabricAddon = new FabricAddon();
|
||||
private final AddonRegistry addonRegistry = new AddonRegistry(fabricAddon, this);
|
||||
private final LockedRegistry<TerraAddon> addonLockedRegistry = new LockedRegistry<>(addonRegistry);
|
||||
private final com.dfsek.terra.api.registry.Registry<TerraAddon> addonLockedRegistry = new LockedRegistryImpl<>(addonRegistry);
|
||||
|
||||
private final PluginConfig config = new PluginConfigImpl();
|
||||
|
||||
@@ -194,7 +195,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockedRegistry<TerraAddon> getAddons() {
|
||||
public com.dfsek.terra.api.registry.Registry<TerraAddon> getAddons() {
|
||||
return addonLockedRegistry;
|
||||
}
|
||||
|
||||
@@ -205,7 +206,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
boolean succeed = configRegistry.loadAll(this);
|
||||
worldMap.forEach((seed, pair) -> {
|
||||
pair.getRight().getConfig().getSamplerCache().clear();
|
||||
String packID = pair.getRight().getConfig().getTemplate().getID();
|
||||
String packID = pair.getRight().getConfig().getID();
|
||||
pair.setRight(new TerraWorldImpl(pair.getRight().getWorld(), configRegistry.get(packID), this));
|
||||
});
|
||||
return succeed;
|
||||
@@ -232,7 +233,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DebugLogger getDebugLogger() {
|
||||
public Logger getDebugLogger() {
|
||||
return debugLogger;
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
genericLoaders.register(registry);
|
||||
registry
|
||||
.registerLoader(BlockData.class, (t, o, l) -> worldHandle.createBlockData((String) o))
|
||||
.registerLoader(com.dfsek.terra.api.world.Biome.class, (t, o, l) -> biomeFixer.translate((String) o))
|
||||
.registerLoader(com.dfsek.terra.api.world.biome.Biome.class, (t, o, l) -> biomeFixer.translate((String) o))
|
||||
.registerLoader(Identifier.class, (t, o, l) -> {
|
||||
Identifier identifier = Identifier.tryParse((String) o);
|
||||
if(identifier == null) throw new LoadException("Invalid identifier: " + o);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.fabric.block;
|
||||
|
||||
import com.dfsek.terra.api.vector.Location;
|
||||
import com.dfsek.terra.vector.LocationImpl;
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
@@ -49,7 +50,7 @@ public class FabricBlock implements Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationImpl getLocation() {
|
||||
public Location getLocation() {
|
||||
return FabricAdapter.adapt(delegate.position).toLocation((World) delegate.worldAccess);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
public static final Codec<ConfigPack> PACK_CODEC = RecordCodecBuilder.create(
|
||||
config -> config.group(
|
||||
Codec.STRING.fieldOf("pack")
|
||||
.forGetter(pack -> pack.getTemplate().getID())
|
||||
.forGetter(pack -> pack.getID())
|
||||
).apply(config, config.stable(TerraFabricPlugin.getInstance().getConfigRegistry()::get)));
|
||||
|
||||
public static final Codec<FabricChunkGeneratorWrapper> CODEC = RecordCodecBuilder.create(
|
||||
@@ -72,15 +72,15 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
private final DefaultChunkGenerator3D delegate;
|
||||
private final TerraBiomeSource biomeSource;
|
||||
|
||||
private final ConfigPackImpl pack;
|
||||
private final ConfigPack pack;
|
||||
private DimensionType dimensionType;
|
||||
|
||||
public FabricChunkGeneratorWrapper(TerraBiomeSource biomeSource, long seed, ConfigPackImpl configPack) {
|
||||
public FabricChunkGeneratorWrapper(TerraBiomeSource biomeSource, long seed, ConfigPack configPack) {
|
||||
super(biomeSource, new StructuresConfig(false));
|
||||
this.pack = configPack;
|
||||
|
||||
this.delegate = new DefaultChunkGenerator3D(pack, TerraFabricPlugin.getInstance());
|
||||
delegate.getMain().logger().info("Loading world with config pack " + pack.getTemplate().getID());
|
||||
delegate.getMain().logger().info("Loading world with config pack " + pack.getID());
|
||||
this.biomeSource = biomeSource;
|
||||
|
||||
this.seed = seed;
|
||||
@@ -97,7 +97,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
return new FabricChunkGeneratorWrapper((TerraBiomeSource) this.biomeSource.withSeed(seed), seed, pack);
|
||||
}
|
||||
|
||||
public ConfigPackImpl getPack() {
|
||||
public ConfigPack getPack() {
|
||||
return pack;
|
||||
}
|
||||
|
||||
@@ -113,10 +113,10 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockPos locateStructure(ServerWorld world, StructureFeature<?> feature, BlockPos center, int radius, boolean skipExistingChunks) {
|
||||
if(!pack.getTemplate().disableStructures()) {
|
||||
if(!pack.disableStructures()) {
|
||||
String name = Objects.requireNonNull(Registry.STRUCTURE_FEATURE.getId(feature)).toString();
|
||||
TerraWorld terraWorld = TerraFabricPlugin.getInstance().getWorld((World) world);
|
||||
TerraStructure located = pack.getRegistry(TerraStructure.class).get(pack.getTemplate().getLocatable().get(name));
|
||||
TerraStructure located = pack.getRegistry(TerraStructure.class).get(pack.getLocatable().get(name));
|
||||
if(located != null) {
|
||||
CompletableFuture<BlockPos> result = new CompletableFuture<>();
|
||||
AsyncStructureFinder finder = new AsyncStructureFinder(terraWorld.getBiomeProvider(), located, FabricAdapter.adapt(center).toLocation((World) world), 0, 500, location -> {
|
||||
@@ -135,14 +135,14 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
|
||||
@Override
|
||||
public void carve(long seed, BiomeAccess access, Chunk chunk, GenerationStep.Carver carver) {
|
||||
if(pack.getTemplate().vanillaCaves()) {
|
||||
if(pack.vanillaCaves()) {
|
||||
super.carve(seed, access, chunk, carver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStructureStarts(DynamicRegistryManager dynamicRegistryManager, StructureAccessor structureAccessor, Chunk chunk, StructureManager structureManager, long worldSeed) {
|
||||
if(pack.getTemplate().vanillaStructures()) {
|
||||
if(pack.vanillaStructures()) {
|
||||
super.setStructureStarts(dynamicRegistryManager, structureAccessor, chunk, structureManager, worldSeed);
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
|
||||
@Override
|
||||
public boolean isStrongholdStartingChunk(ChunkPos chunkPos) {
|
||||
if(pack.getTemplate().vanillaStructures()) {
|
||||
if(pack.vanillaStructures()) {
|
||||
return super.isStrongholdStartingChunk(chunkPos);
|
||||
}
|
||||
return false;
|
||||
@@ -196,7 +196,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
|
||||
@Override
|
||||
public void populateEntities(ChunkRegion region) {
|
||||
if(pack.getTemplate().vanillaMobs()) {
|
||||
if(pack.vanillaMobs()) {
|
||||
int cx = region.getCenterPos().x;
|
||||
int cy = region.getCenterPos().z;
|
||||
Biome biome = region.getBiome((new ChunkPos(cx, cy)).getStartPos());
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class TerraBiomeSource extends BiomeSource {
|
||||
public static final Codec<ConfigPack> PACK_CODEC = (RecordCodecBuilder.create(config -> config.group(
|
||||
Codec.STRING.fieldOf("pack").forGetter(pack -> pack.getTemplate().getID())
|
||||
Codec.STRING.fieldOf("pack").forGetter(ConfigPack::getID)
|
||||
).apply(config, config.stable(TerraFabricPlugin.getInstance().getConfigRegistry()::get))));
|
||||
public static final Codec<TerraBiomeSource> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||
RegistryLookupCodec.of(Registry.BIOME_KEY).forGetter(source -> source.biomeRegistry),
|
||||
@@ -30,9 +30,9 @@ public class TerraBiomeSource extends BiomeSource {
|
||||
private final Registry<Biome> biomeRegistry;
|
||||
private final long seed;
|
||||
private final BiomeProvider grid;
|
||||
private final ConfigPackImpl pack;
|
||||
private final ConfigPack pack;
|
||||
|
||||
public TerraBiomeSource(Registry<Biome> biomes, long seed, ConfigPackImpl pack) {
|
||||
public TerraBiomeSource(Registry<Biome> biomes, long seed, ConfigPack pack) {
|
||||
super(biomes.stream()
|
||||
.filter(biome -> Objects.requireNonNull(biomes.getId(biome)).getNamespace().equals("terra")) // Filter out non-Terra biomes.
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.fabric.generation;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.config.pack.ConfigPackImpl;
|
||||
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||
import com.dfsek.terra.fabric.event.BiomeRegistrationEvent;
|
||||
@@ -15,10 +16,10 @@ import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class TerraGeneratorType extends GeneratorType {
|
||||
private final ConfigPackImpl pack;
|
||||
private final ConfigPack pack;
|
||||
|
||||
public TerraGeneratorType(ConfigPackImpl pack) {
|
||||
super("terra." + pack.getTemplate().getID());
|
||||
public TerraGeneratorType(ConfigPack pack) {
|
||||
super("terra." + pack.getID());
|
||||
this.pack = pack;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.fabric.handle;
|
||||
|
||||
import com.dfsek.terra.api.vector.Location;
|
||||
import com.dfsek.terra.vector.LocationImpl;
|
||||
import com.dfsek.terra.api.entity.EntityType;
|
||||
import com.dfsek.terra.api.entity.Player;
|
||||
@@ -39,7 +40,7 @@ public class FabricWorldHandle implements WorldHandle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<LocationImpl, LocationImpl> getSelectedLocation(Player player) {
|
||||
public Pair<Location, Location> getSelectedLocation(Player player) {
|
||||
try {
|
||||
Class.forName("com.sk89q.worldedit.WorldEdit");
|
||||
} catch(ClassNotFoundException e) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.Intrinsic;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(Biome.class)
|
||||
@Implements(@Interface(iface = com.dfsek.terra.api.world.Biome.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||
@Implements(@Interface(iface = com.dfsek.terra.api.world.biome.Biome.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||
public abstract class BiomeMixin {
|
||||
@Intrinsic
|
||||
public Object terra$getHandle() {
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MinecraftClientMixin {
|
||||
TerraFabricPlugin.getInstance().getConfigRegistry().forEach(pack -> {
|
||||
final GeneratorType generatorType = new TerraGeneratorType(pack);
|
||||
//noinspection ConstantConditions
|
||||
((GeneratorTypeAccessor) generatorType).setTranslationKey(new LiteralText("Terra:" + pack.getTemplate().getID()));
|
||||
((GeneratorTypeAccessor) generatorType).setTranslationKey(new LiteralText("Terra:" + pack.getID()));
|
||||
GeneratorTypeAccessor.getValues().add(1, generatorType);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.fabric.mixin.lifecycle.server;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.config.pack.ConfigPackImpl;
|
||||
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||
import com.dfsek.terra.fabric.event.BiomeRegistrationEvent;
|
||||
@@ -56,7 +57,7 @@ public abstract class GeneratorOptionsMixin {
|
||||
|
||||
prop = prop.substring(prop.indexOf(":") + 1);
|
||||
|
||||
ConfigPackImpl config = main.getConfigRegistry().get(prop);
|
||||
ConfigPack config = main.getConfigRegistry().get(prop);
|
||||
|
||||
if(config == null) throw new IllegalArgumentException("No such pack " + prop);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.fabric.util;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.util.generic.pair.Pair;
|
||||
import com.dfsek.terra.config.builder.BiomeBuilder;
|
||||
import com.dfsek.terra.config.pack.ConfigPackImpl;
|
||||
@@ -29,8 +30,8 @@ import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class FabricUtil {
|
||||
public static String createBiomeID(ConfigPackImpl pack, String biomeID) {
|
||||
return pack.getTemplate().getID().toLowerCase() + "/" + biomeID.toLowerCase(Locale.ROOT);
|
||||
public static String createBiomeID(ConfigPack pack, String biomeID) {
|
||||
return pack.getID().toLowerCase() + "/" + biomeID.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +41,7 @@ public final class FabricUtil {
|
||||
* @param pack The ConfigPack this biome belongs to.
|
||||
* @return The Minecraft delegate biome.
|
||||
*/
|
||||
public static Biome createBiome(BiomeBuilder biome, ConfigPackImpl pack, DynamicRegistryManager registryManager) {
|
||||
public static Biome createBiome(BiomeBuilder biome, ConfigPack pack, DynamicRegistryManager registryManager) {
|
||||
BiomeTemplate template = biome.getTemplate();
|
||||
Map<String, Integer> colors = template.getColors();
|
||||
|
||||
@@ -55,7 +56,7 @@ public final class FabricUtil {
|
||||
|
||||
generationSettings.feature(GenerationStep.Feature.VEGETAL_DECORATION, TerraFabricPlugin.POPULATOR_CONFIGURED_FEATURE);
|
||||
|
||||
if(pack.getTemplate().vanillaCaves()) {
|
||||
if(pack.vanillaCaves()) {
|
||||
for(GenerationStep.Carver carver : GenerationStep.Carver.values()) {
|
||||
for(Supplier<ConfiguredCarver<?>> configuredCarverSupplier : vanilla.getGenerationSettings().getCarversForStep(carver)) {
|
||||
generationSettings.carver(carver, configuredCarverSupplier.get());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.fabric.util;
|
||||
|
||||
import com.dfsek.terra.api.vector.Location;
|
||||
import com.dfsek.terra.vector.LocationImpl;
|
||||
import com.dfsek.terra.api.entity.Player;
|
||||
import com.dfsek.terra.api.util.generic.pair.Pair;
|
||||
@@ -11,7 +12,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public final class WorldEditUtil {
|
||||
public static Pair<LocationImpl, LocationImpl> getSelection(Player player) {
|
||||
public static Pair<Location, Location> getSelection(Player player) {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
try {
|
||||
Region selection = worldEdit.getSessionManager()
|
||||
|
||||
Reference in New Issue
Block a user