mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-04 23:06:05 +00:00
Reformat
This commit is contained in:
@@ -8,7 +8,6 @@ import java.nio.file.StandardCopyOption
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.BasePluginExtension
|
||||
import org.gradle.kotlin.dsl.TaskContainerScope
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
@@ -88,7 +87,8 @@ fun Project.configureDistribution() {
|
||||
val jar = getJarTask().archiveFileName.get()
|
||||
resources.computeIfAbsent(
|
||||
if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "addons/bootstrap"
|
||||
else "addons") { ArrayList() }.add(jar)
|
||||
else "addons"
|
||||
) { ArrayList() }.add(jar)
|
||||
}
|
||||
|
||||
val options = DumperOptions()
|
||||
@@ -109,7 +109,7 @@ fun Project.configureDistribution() {
|
||||
FileWriter(manifest).use {
|
||||
yaml.dump(resources, it)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,16 +29,16 @@ object Versions {
|
||||
|
||||
object Mod {
|
||||
const val mixin = "0.11.2+mixin.0.8.5"
|
||||
|
||||
|
||||
const val minecraft = "1.19"
|
||||
const val yarn = "$minecraft+build.1"
|
||||
const val fabricLoader = "0.14.2"
|
||||
|
||||
|
||||
const val architecuryLoom = "0.12.0.290"
|
||||
const val architecturyPlugin = "3.4-SNAPSHOT"
|
||||
|
||||
|
||||
const val loomQuiltflower = "1.7.1"
|
||||
|
||||
|
||||
const val lazyDfu = "0.1.2"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
package com.dfsek.terra.addons.biome;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -21,14 +19,12 @@ import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
* Class representing a config-defined biome
|
||||
*/
|
||||
public class UserDefinedBiome implements Biome {
|
||||
private PlatformBiome platformBiome;
|
||||
|
||||
private final String id;
|
||||
private final BiomeTemplate config;
|
||||
private final int color;
|
||||
private final Set<String> tags;
|
||||
|
||||
private final Context context = new Context();
|
||||
private PlatformBiome platformBiome;
|
||||
|
||||
public UserDefinedBiome(BiomeTemplate config) {
|
||||
this.id = config.getID();
|
||||
@@ -49,20 +45,20 @@ public class UserDefinedBiome implements Biome {
|
||||
return Optional.ofNullable(platformBiome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlatformBiome(PlatformBiome biome) {
|
||||
if(platformBiome != null) {
|
||||
throw new IllegalStateException("Platform biome already set");
|
||||
}
|
||||
|
||||
|
||||
this.platformBiome = biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return tags;
|
||||
|
||||
@@ -12,6 +12,6 @@ public class StructureGenerationStage implements GenerationStage {
|
||||
|
||||
@Override
|
||||
public void populate(ProtoWorld world) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
package com.dfsek.terra.api.world.biome;
|
||||
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -29,6 +27,11 @@ public interface Biome extends PropertyHolder, StringIdentifiable {
|
||||
*/
|
||||
Optional<PlatformBiome> getPlatformBiome();
|
||||
|
||||
/**
|
||||
* Sets the platform biome this custom biome delegates to.
|
||||
*/
|
||||
void setPlatformBiome(PlatformBiome biome);
|
||||
|
||||
/**
|
||||
* Get the color of this biome.
|
||||
*
|
||||
@@ -42,9 +45,4 @@ public interface Biome extends PropertyHolder, StringIdentifiable {
|
||||
* @return A {@link Set} of String tags this biome holds.
|
||||
*/
|
||||
Set<String> getTags();
|
||||
|
||||
/**
|
||||
* Sets the platform biome this custom biome delegates to.
|
||||
*/
|
||||
void setPlatformBiome(PlatformBiome biome);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class InternalAddon implements BaseAddon {
|
||||
private static final Version VERSION = Versions.getVersion(1, 0, 0);
|
||||
|
||||
public InternalAddon() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -84,7 +84,7 @@ public class BootstrapAddonLoader implements BootstrapBaseAddon<BootstrapBaseAdd
|
||||
Path bootstrapFolder = addonsFolder.resolve("bootstrap");
|
||||
Files.createDirectories(bootstrapFolder);
|
||||
logger.debug("Loading bootstrap addons from {}", bootstrapFolder);
|
||||
|
||||
|
||||
try(Stream<Path> bootstrapAddons = Files.walk(bootstrapFolder, 1, FileVisitOption.FOLLOW_LINKS)) {
|
||||
return bootstrapAddons.filter(path -> path.toFile().isFile())
|
||||
.filter(path -> path.toFile().canRead())
|
||||
@@ -96,7 +96,7 @@ public class BootstrapAddonLoader implements BootstrapBaseAddon<BootstrapBaseAdd
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "BOOTSTRAP";
|
||||
|
||||
@@ -4,7 +4,6 @@ terra.source=https://github.com/PolyhedralDev/Terra
|
||||
terra.issues=https://github.com/PolyhedralDev/Terra/issues
|
||||
terra.wiki=https://github.com/PolyhedralDev/Terra/wiki
|
||||
terra.license=MIT
|
||||
|
||||
# Gradle options
|
||||
org.gradle.jvmargs=-Xmx4096M -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC
|
||||
org.gradle.warning.mode=all
|
||||
|
||||
@@ -4,9 +4,6 @@ import ca.solostudios.strata.Versions;
|
||||
import ca.solostudios.strata.version.Version;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.event.events.config.ConfigurationLoadEvent;
|
||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||
import com.dfsek.terra.api.world.biome.Biome;
|
||||
|
||||
|
||||
public class BukkitAddon implements BaseAddon {
|
||||
@@ -18,7 +15,7 @@ public class BukkitAddon implements BaseAddon {
|
||||
this.terraBukkitPlugin = terraBukkitPlugin;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Version getVersion() {
|
||||
return VERSION;
|
||||
|
||||
@@ -45,9 +45,8 @@ import com.dfsek.terra.bukkit.world.BukkitAdapter;
|
||||
|
||||
public class TerraBukkitPlugin extends JavaPlugin {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TerraBukkitPlugin.class);
|
||||
|
||||
private PlatformImpl platform;
|
||||
private final Map<String, com.dfsek.terra.api.world.chunk.generation.ChunkGenerator> generatorMap = new HashMap<>();
|
||||
private PlatformImpl platform;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.dfsek.terra.bukkit.generator;
|
||||
|
||||
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
|
||||
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -12,6 +10,7 @@ import java.util.stream.StreamSupport;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.world.biome.Biome;
|
||||
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
|
||||
|
||||
|
||||
public class BukkitBiomeProvider extends BiomeProvider implements Handle {
|
||||
@@ -22,13 +21,13 @@ public class BukkitBiomeProvider extends BiomeProvider implements Handle {
|
||||
@Override
|
||||
public @NotNull org.bukkit.block.Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
|
||||
Biome biome = delegate.getBiome(x, y, z, worldInfo.getSeed());
|
||||
return ((BukkitPlatformBiome)biome.getPlatformBiome().get()).getBukkitBiome();
|
||||
return ((BukkitPlatformBiome) biome.getPlatformBiome().get()).getBukkitBiome();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<org.bukkit.block.Biome> getBiomes(@NotNull WorldInfo worldInfo) {
|
||||
return StreamSupport.stream(delegate.getBiomes().spliterator(), false)
|
||||
.map(terraBiome -> ((BukkitPlatformBiome)terraBiome.getPlatformBiome().get()).getBukkitBiome())
|
||||
.map(terraBiome -> ((BukkitPlatformBiome) terraBiome.getPlatformBiome().get()).getBukkitBiome())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
|
||||
private ChunkGenerator delegate;
|
||||
private ConfigPack pack;
|
||||
|
||||
|
||||
|
||||
public BukkitChunkGeneratorWrapper(ChunkGenerator delegate, ConfigPack pack, BlockState air) {
|
||||
this.delegate = delegate;
|
||||
this.pack = pack;
|
||||
@@ -97,7 +97,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
|
||||
public boolean shouldGenerateMobs() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateStructures() {
|
||||
return true;
|
||||
@@ -117,7 +117,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private record SeededVector(int x, int z, WorldProperties worldProperties) {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
@@ -126,7 +126,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int code = x;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.dfsek.terra.bukkit.nms;
|
||||
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
|
||||
|
||||
public interface Initializer {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.dfsek.terra.bukkit.world;
|
||||
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
|
||||
|
||||
public interface BukkitPlatformBiome extends PlatformBiome {
|
||||
Biome getBukkitBiome();
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_19_R1;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.BiomeUtil;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.TagUtil;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.core.WritableRegistry;
|
||||
@@ -19,17 +15,18 @@ import java.util.Map;
|
||||
|
||||
import com.dfsek.terra.api.structure.configured.ConfiguredStructure;
|
||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.BiomeUtil;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.TagUtil;
|
||||
import com.dfsek.terra.registry.master.ConfigRegistry;
|
||||
|
||||
|
||||
public class AwfulBukkitHacks {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AwfulBukkitHacks.class);
|
||||
|
||||
public static final Map<Holder<net.minecraft.world.level.biome.Biome>, Map<ResourceLocation,
|
||||
ProbabilityCollection<ConfiguredStructure>>>
|
||||
TERRA_BIOME_FERTILIZABLE_MAP = new HashMap<>();
|
||||
public static final Map<TagKey<Biome>, List<ResourceLocation>>
|
||||
TERRA_BIOME_TAG_MAP = new HashMap<>();
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AwfulBukkitHacks.class);
|
||||
|
||||
public static void registerBiomes(ConfigRegistry configRegistry) {
|
||||
try {
|
||||
@@ -43,7 +40,7 @@ public class AwfulBukkitHacks {
|
||||
}));
|
||||
|
||||
Reflection.MAPPED_REGISTRY.setFrozen((MappedRegistry<?>) biomeRegistry, true); // freeze registry again :)
|
||||
|
||||
|
||||
TagUtil.registerBiomeTags(biomeRegistry);
|
||||
|
||||
} catch(SecurityException | IllegalArgumentException exception) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_19_R1;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.VanillaBiomeProperties;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -15,10 +13,11 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.VanillaBiomeProperties;
|
||||
|
||||
|
||||
public class NMSBiomeInjector {
|
||||
|
||||
|
||||
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, ResourceLocation identifier) {
|
||||
return registry.getOptional(identifier)
|
||||
.flatMap(registry::getResourceKey)
|
||||
@@ -27,58 +26,58 @@ public class NMSBiomeInjector {
|
||||
|
||||
public static Biome createBiome(VanillaBiomeProperties vanillaBiomeProperties)
|
||||
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||
|
||||
|
||||
BiomeGenerationSettings.Builder generationSettings = new BiomeGenerationSettings.Builder();
|
||||
|
||||
|
||||
BiomeSpecialEffects.Builder effects = new BiomeSpecialEffects.Builder();
|
||||
|
||||
|
||||
net.minecraft.world.level.biome.Biome.BiomeBuilder builder = new BiomeBuilder();
|
||||
|
||||
|
||||
effects.waterColor(Objects.requireNonNull(vanillaBiomeProperties.getWaterColor()))
|
||||
.waterFogColor(Objects.requireNonNull(vanillaBiomeProperties.getWaterFogColor()))
|
||||
.fogColor(Objects.requireNonNull(vanillaBiomeProperties.getFogColor()))
|
||||
.skyColor(Objects.requireNonNull(vanillaBiomeProperties.getSkyColor()))
|
||||
.grassColorModifier(
|
||||
Objects.requireNonNull(vanillaBiomeProperties.getGrassColorModifier()));
|
||||
|
||||
|
||||
if(vanillaBiomeProperties.getFoliageColor() != null) {
|
||||
effects.foliageColorOverride(vanillaBiomeProperties.getFoliageColor());
|
||||
}
|
||||
|
||||
|
||||
if(vanillaBiomeProperties.getGrassColor() != null) {
|
||||
effects.grassColorOverride(vanillaBiomeProperties.getGrassColor());
|
||||
}
|
||||
|
||||
|
||||
if(vanillaBiomeProperties.getParticleConfig() != null) {
|
||||
effects.ambientParticle(vanillaBiomeProperties.getParticleConfig());
|
||||
}
|
||||
|
||||
|
||||
if(vanillaBiomeProperties.getLoopSound() != null) {
|
||||
effects.ambientLoopSound(vanillaBiomeProperties.getLoopSound());
|
||||
}
|
||||
|
||||
|
||||
if(vanillaBiomeProperties.getMoodSound() != null) {
|
||||
effects.ambientMoodSound(vanillaBiomeProperties.getMoodSound());
|
||||
}
|
||||
|
||||
|
||||
if(vanillaBiomeProperties.getAdditionsSound() != null) {
|
||||
effects.ambientAdditionsSound(vanillaBiomeProperties.getAdditionsSound());
|
||||
}
|
||||
|
||||
|
||||
if(vanillaBiomeProperties.getMusic() != null) {
|
||||
effects.backgroundMusic(vanillaBiomeProperties.getMusic());
|
||||
}
|
||||
|
||||
|
||||
builder.precipitation(Objects.requireNonNull(vanillaBiomeProperties.getPrecipitation()));
|
||||
|
||||
|
||||
builder.temperature(Objects.requireNonNull(vanillaBiomeProperties.getTemperature()));
|
||||
|
||||
|
||||
builder.downfall(Objects.requireNonNull(vanillaBiomeProperties.getDownfall()));
|
||||
|
||||
|
||||
builder.temperatureAdjustment(Objects.requireNonNull(vanillaBiomeProperties.getTemperatureModifier()));
|
||||
|
||||
|
||||
builder.mobSpawnSettings(Objects.requireNonNull(vanillaBiomeProperties.getSpawnSettings()));
|
||||
|
||||
|
||||
return builder
|
||||
.specialEffects(effects.build())
|
||||
.generationSettings(generationSettings.build())
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_19_R1;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.ProtoPlatformBiome;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -11,6 +9,7 @@ import net.minecraft.world.level.biome.Climate.Sampler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.ProtoPlatformBiome;
|
||||
|
||||
|
||||
public class NMSBiomeProvider extends BiomeSource {
|
||||
@@ -34,6 +33,6 @@ public class NMSBiomeProvider extends BiomeSource {
|
||||
@Override
|
||||
public @NotNull Holder<Biome> getNoiseBiome(int x, int y, int z, @NotNull Sampler sampler) {
|
||||
return biomeRegistry.getHolderOrThrow(((ProtoPlatformBiome) delegate.getBiome(x << 2, y << 2, z << 2, seed)
|
||||
.getPlatformBiome()).getBiome());
|
||||
.getPlatformBiome()).getBiome());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,10 +143,10 @@ public class NMSChunkGeneratorDelegate extends ChunkGenerator {
|
||||
*/
|
||||
return vanilla.getBaseColumn(x, z, world, noiseConfig);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addDebugScreenInfo(@NotNull List<String> text, @NotNull RandomState noiseConfig, @NotNull BlockPos pos) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,7 +187,7 @@ public class NMSChunkGeneratorDelegate extends ChunkGenerator {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private List<ChunkPos> generateRingPositions(StructureSet holder, RandomState randomstate,
|
||||
ConcentricRingsStructurePlacement concentricringsstructureplacement) { // Spigot
|
||||
if(concentricringsstructureplacement.count() == 0) {
|
||||
|
||||
@@ -38,13 +38,13 @@ public class NMSInjectListener implements Listener {
|
||||
ChunkGenerator vanilla = serverWorld.getChunkSource().getGenerator();
|
||||
NMSBiomeProvider provider = new NMSBiomeProvider(pack.getBiomeProvider(), craftWorld.getSeed());
|
||||
NMSChunkGeneratorDelegate custom = new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed());
|
||||
|
||||
|
||||
custom.conf = vanilla.conf; // world config from Spigot
|
||||
|
||||
|
||||
serverWorld.getChunkSource().chunkMap.generator = custom;
|
||||
|
||||
|
||||
LOGGER.info("Successfully injected into world.");
|
||||
|
||||
|
||||
INJECT_LOCK.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,32 +3,6 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1;
|
||||
import com.dfsek.tectonic.api.TypeRegistry;
|
||||
import com.dfsek.tectonic.api.depth.DepthTracker;
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.BiomeAdditionsSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.BiomeMoodSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.BiomeParticleConfigTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.EntityTypeTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.FertilizableConfig;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.MusicSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.ProtoPlatformBiome;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SoundEventTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SpawnCostConfig;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SpawnEntryTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SpawnSettingsTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SpawnTypeConfig;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.VillagerTypeTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.BiomeUtil;
|
||||
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -48,11 +22,28 @@ import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.BiomeAdditionsSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.BiomeMoodSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.BiomeParticleConfigTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.EntityTypeTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.FertilizableConfig;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.MusicSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.ProtoPlatformBiome;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SoundEventTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SpawnCostConfig;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SpawnEntryTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SpawnSettingsTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.SpawnTypeConfig;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.VillagerTypeTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.BiomeUtil;
|
||||
|
||||
|
||||
public class NMSPlatform extends PlatformImpl {
|
||||
|
||||
@@ -84,7 +75,7 @@ public class NMSPlatform extends PlatformImpl {
|
||||
.registerLoader(GrassColorModifier.class,
|
||||
(type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.registerLoader(MobCategory.class,(type, o, loader, depthTracker) -> MobCategory.valueOf((String) o))
|
||||
.registerLoader(MobCategory.class, (type, o, loader, depthTracker) -> MobCategory.valueOf((String) o))
|
||||
.registerLoader(AmbientParticleSettings.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
|
||||
.registerLoader(AmbientMoodSettings.class, BiomeMoodSoundTemplate::new)
|
||||
|
||||
@@ -35,6 +35,7 @@ public class Reflection {
|
||||
void setFrozen(MappedRegistry<?> instance, boolean frozen);
|
||||
}
|
||||
|
||||
|
||||
@Proxies(VillagerTypeProxy.class)
|
||||
public interface VillagerTypeProxy {
|
||||
@Static
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import java.util.Map;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.dfsek.terra.api.structure.configured.ConfiguredStructure;
|
||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
|
||||
|
||||
public class MusicSoundTemplate implements ObjectTemplate<Music> {
|
||||
@Value("sound")
|
||||
@@ -17,7 +17,7 @@ public class MusicSoundTemplate implements ObjectTemplate<Music> {
|
||||
@Value("delay")
|
||||
@Default
|
||||
private Range delay = null;
|
||||
|
||||
|
||||
|
||||
@Value("replace-current-music")
|
||||
@Default
|
||||
|
||||
@@ -17,24 +17,21 @@
|
||||
|
||||
package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
|
||||
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.MinecraftUtil;
|
||||
|
||||
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock;
|
||||
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.util.MinecraftUtil;
|
||||
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
|
||||
|
||||
|
||||
public class ProtoPlatformBiome implements PlatformBiome, BukkitPlatformBiome {
|
||||
private final ResourceLocation identifier;
|
||||
|
||||
private final ResourceKey<Biome> biome;
|
||||
|
||||
|
||||
public ProtoPlatformBiome(ResourceLocation identifier, ResourceKey<Biome> biome) {
|
||||
this.identifier = identifier;
|
||||
this.biome = biome;
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
|
||||
|
||||
public class SpawnEntryTemplate implements ObjectTemplate<SpawnerData> {
|
||||
@Value("type")
|
||||
|
||||
@@ -3,11 +3,12 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import java.util.List;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SpawnSettingsTemplate implements ObjectTemplate<MobSpawnSettings> {
|
||||
@Value("spawns")
|
||||
@@ -27,7 +28,7 @@ public class SpawnSettingsTemplate implements ObjectTemplate<MobSpawnSettings> {
|
||||
MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder();
|
||||
for(SpawnTypeConfig spawn : spawns) {
|
||||
MobCategory group = spawn.getGroup();
|
||||
for (SpawnerData entry : spawn.getEntry()) {
|
||||
for(SpawnerData entry : spawn.getEntry()) {
|
||||
builder.addSpawn(group, entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import java.util.List;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
|
||||
@Value("group")
|
||||
|
||||
@@ -3,10 +3,6 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
|
||||
import com.dfsek.tectonic.api.config.template.ConfigTemplate;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
@@ -18,6 +14,11 @@ import net.minecraft.world.level.biome.Biome.Precipitation;
|
||||
import net.minecraft.world.level.biome.Biome.TemperatureModifier;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_19_R1.util;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.Reflection;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.FertilizableConfig;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.ProtoPlatformBiome;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.VanillaBiomeProperties;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -13,27 +15,24 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.world.biome.Biome;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.Reflection;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.FertilizableConfig;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.ProtoPlatformBiome;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.VanillaBiomeProperties;
|
||||
|
||||
|
||||
public class BiomeUtil {
|
||||
private static final Logger logger = LoggerFactory.getLogger(BiomeUtil.class);
|
||||
|
||||
public static final Map<Holder<net.minecraft.world.level.biome.Biome>, Map<ResourceLocation, FertilizableConfig>>
|
||||
TERRA_BIOME_FERTILIZABLE_MAP = new HashMap<>();
|
||||
|
||||
public static final Map<TagKey<net.minecraft.world.level.biome.Biome>, List<ResourceLocation>>
|
||||
TERRA_BIOME_TAG_MAP = new HashMap<>();
|
||||
private static final Logger logger = LoggerFactory.getLogger(BiomeUtil.class);
|
||||
|
||||
protected static ResourceKey<net.minecraft.world.level.biome.Biome> registerBiome(ResourceLocation identifier,
|
||||
net.minecraft.world.level.biome.Biome biome) {
|
||||
net.minecraft.world.level.biome.Biome biome) {
|
||||
BuiltinRegistries.register(BuiltinRegistries.BIOME,
|
||||
MinecraftUtil.registerKey(identifier)
|
||||
.location(),
|
||||
@@ -52,22 +51,22 @@ public class BiomeUtil {
|
||||
* @param pack The ConfigPack this biome belongs to.
|
||||
*/
|
||||
public static void registerBiome(Biome biome, ConfigPack pack,
|
||||
com.dfsek.terra.api.registry.key.RegistryKey id) {
|
||||
com.dfsek.terra.api.registry.key.RegistryKey id) {
|
||||
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
|
||||
|
||||
|
||||
net.minecraft.world.level.biome.Biome minecraftBiome = MinecraftUtil.createBiome(vanillaBiomeProperties);
|
||||
|
||||
|
||||
ResourceLocation identifier = new ResourceLocation("terra", MinecraftUtil.createBiomeID(pack, id));
|
||||
|
||||
|
||||
biome.setPlatformBiome(new ProtoPlatformBiome(identifier, registerBiome(identifier, minecraftBiome)));
|
||||
|
||||
|
||||
Map villagerMap = Reflection.VILLAGER_TYPE.getByBiome();
|
||||
|
||||
|
||||
villagerMap.put(ResourceKey.create(Registry.BIOME_REGISTRY, identifier),
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(), VillagerType.PLAINS));
|
||||
|
||||
|
||||
TERRA_BIOME_FERTILIZABLE_MAP.put(Holder.direct(minecraftBiome), vanillaBiomeProperties.getFertilizables());
|
||||
|
||||
|
||||
for(ResourceLocation tag : vanillaBiomeProperties.getTags()) {
|
||||
TERRA_BIOME_TAG_MAP.getOrDefault(TagKey.create(Registry.BIOME_REGISTRY, tag), new ArrayList<>()).add(identifier);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
|
||||
package com.dfsek.terra.bukkit.nms.v1_19_R1.util;
|
||||
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||
|
||||
|
||||
public final class MinecraftAdapter {
|
||||
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_19_R1.util;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.VanillaBiomeProperties;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -21,11 +13,19 @@ import net.minecraft.world.level.biome.BiomeSpecialEffects;
|
||||
import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.SignBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||
import com.dfsek.terra.api.block.entity.Container;
|
||||
import com.dfsek.terra.api.block.entity.MobSpawner;
|
||||
import com.dfsek.terra.api.block.entity.Sign;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.bukkit.nms.v1_19_R1.config.VanillaBiomeProperties;
|
||||
|
||||
|
||||
public final class MinecraftUtil {
|
||||
@@ -110,7 +110,7 @@ public final class MinecraftUtil {
|
||||
builder.temperatureAdjustment(Objects.requireNonNull(vanillaBiomeProperties.getTemperatureModifier()));
|
||||
|
||||
builder.mobSpawnSettings(Objects.requireNonNull(vanillaBiomeProperties.getSpawnSettings()));
|
||||
|
||||
|
||||
return builder
|
||||
.specialEffects(effects.build())
|
||||
.generationSettings(generationSettings.build())
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class TagUtil {
|
||||
logger.info("Doing data-driven biome tag garbage....");
|
||||
logger.info("who let this data drive?");
|
||||
Map<TagKey<Biome>, List<Holder<Biome>>> collect = tagsToMutableMap(registry);
|
||||
|
||||
|
||||
BiomeUtil.TERRA_BIOME_TAG_MAP.forEach((tag, biomeList) -> {
|
||||
collect.getOrDefault(tag, new ArrayList<>())
|
||||
.addAll(biomeList.stream()
|
||||
@@ -46,10 +46,10 @@ public final class TagUtil {
|
||||
.map(Holder::direct)
|
||||
.toList());
|
||||
});
|
||||
|
||||
|
||||
registry.resetTags();
|
||||
registry.bindTags(ImmutableMap.copyOf(collect));
|
||||
|
||||
|
||||
if(logger.isDebugEnabled()) {
|
||||
registry.holders()
|
||||
.map(e -> e.key().location() + ": " +
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
.registerLoader(GrassColorModifier.class,
|
||||
(type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.registerLoader(SpawnGroup.class,(type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o))
|
||||
.registerLoader(SpawnGroup.class, (type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o))
|
||||
.registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
|
||||
.registerLoader(BiomeMoodSound.class, BiomeMoodSoundTemplate::new)
|
||||
|
||||
@@ -3,12 +3,11 @@ package com.dfsek.terra.mod.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
|
||||
import net.minecraft.sound.MusicSound;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
|
||||
|
||||
public class MusicSoundTemplate implements ObjectTemplate<MusicSound> {
|
||||
@Value("sound")
|
||||
|
||||
@@ -3,12 +3,11 @@ package com.dfsek.terra.mod.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
|
||||
|
||||
public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
|
||||
@Value("type")
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SpawnSettingsTemplate implements ObjectTemplate<SpawnSettings> {
|
||||
SpawnSettings.Builder builder = new SpawnSettings.Builder();
|
||||
for(SpawnTypeConfig spawn : spawns) {
|
||||
SpawnGroup group = spawn.getGroup();
|
||||
for (SpawnEntry entry : spawn.getEntry()) {
|
||||
for(SpawnEntry entry : spawn.getEntry()) {
|
||||
builder.spawn(group, entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setDelay(int delay) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getMinSpawnDelay() {
|
||||
@@ -70,7 +70,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setMinSpawnDelay(int delay) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getMaxSpawnDelay() {
|
||||
@@ -78,7 +78,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setMaxSpawnDelay(int delay) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getSpawnCount() {
|
||||
@@ -86,7 +86,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setSpawnCount(int spawnCount) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getMaxNearbyEntities() {
|
||||
@@ -94,7 +94,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setMaxNearbyEntities(int maxNearbyEntities) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getRequiredPlayerRange() {
|
||||
@@ -102,7 +102,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setRequiredPlayerRange(int requiredPlayerRange) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int terra$getSpawnRange() {
|
||||
@@ -110,7 +110,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
}
|
||||
|
||||
public void terra$setSpawnRange(int spawnRange) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void terra$applyState(String state) {
|
||||
|
||||
@@ -26,13 +26,11 @@ import com.dfsek.terra.mod.mixin.access.VillagerTypeAccessor;
|
||||
|
||||
|
||||
public class BiomeUtil {
|
||||
private static final Logger logger = LoggerFactory.getLogger(BiomeUtil.class);
|
||||
|
||||
public static final Map<RegistryEntry<net.minecraft.world.biome.Biome>, Map<Identifier, FertilizableConfig>>
|
||||
TERRA_BIOME_FERTILIZABLE_MAP = new HashMap<>();
|
||||
|
||||
public static final Map<TagKey<net.minecraft.world.biome.Biome>, List<Identifier>>
|
||||
TERRA_BIOME_TAG_MAP = new HashMap<>();
|
||||
private static final Logger logger = LoggerFactory.getLogger(BiomeUtil.class);
|
||||
|
||||
public static void registerBiomes() {
|
||||
logger.info("Registering biomes...");
|
||||
@@ -65,20 +63,20 @@ public class BiomeUtil {
|
||||
protected static void registerBiome(Biome biome, ConfigPack pack,
|
||||
com.dfsek.terra.api.registry.key.RegistryKey id) {
|
||||
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
|
||||
|
||||
|
||||
net.minecraft.world.biome.Biome minecraftBiome = MinecraftUtil.createBiome(vanillaBiomeProperties);
|
||||
|
||||
|
||||
Identifier identifier = new Identifier("terra", MinecraftUtil.createBiomeID(pack, id));
|
||||
|
||||
|
||||
biome.setPlatformBiome(new ProtoPlatformBiome(identifier, registerBiome(identifier, minecraftBiome)));
|
||||
|
||||
|
||||
Map villagerMap = VillagerTypeAccessor.getBiomeTypeToIdMap();
|
||||
|
||||
|
||||
villagerMap.put(RegistryKey.of(Registry.BIOME_KEY, identifier),
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(), VillagerType.PLAINS));
|
||||
|
||||
|
||||
TERRA_BIOME_FERTILIZABLE_MAP.put(RegistryEntry.of(minecraftBiome), vanillaBiomeProperties.getFertilizables());
|
||||
|
||||
|
||||
for(Identifier tag : vanillaBiomeProperties.getTags()) {
|
||||
TERRA_BIOME_TAG_MAP.getOrDefault(TagKey.of(Registry.BIOME_KEY, tag), new ArrayList<>()).add(identifier);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public final class MinecraftUtil {
|
||||
builder.temperatureModifier(Objects.requireNonNull(vanillaBiomeProperties.getTemperatureModifier()));
|
||||
|
||||
builder.spawnSettings(Objects.requireNonNull(vanillaBiomeProperties.getSpawnSettings()));
|
||||
|
||||
|
||||
return builder
|
||||
.effects(effects.build())
|
||||
.generationSettings(generationSettings.build())
|
||||
|
||||
@@ -55,7 +55,7 @@ public final class TagUtil {
|
||||
logger.info("Doing data-driven biome tag garbage....");
|
||||
logger.info("who let this data drive?");
|
||||
Map<TagKey<Biome>, List<RegistryEntry<Biome>>> collect = tagsToMutableMap(registry);
|
||||
|
||||
|
||||
BiomeUtil.TERRA_BIOME_TAG_MAP.forEach((tag, biomeList) -> {
|
||||
collect.getOrDefault(tag, new ArrayList<>())
|
||||
.addAll(biomeList.stream()
|
||||
@@ -65,10 +65,10 @@ public final class TagUtil {
|
||||
.map(RegistryEntry::of)
|
||||
.toList());
|
||||
});
|
||||
|
||||
|
||||
registry.clearTags();
|
||||
registry.populateTags(ImmutableMap.copyOf(collect));
|
||||
|
||||
|
||||
if(logger.isDebugEnabled()) {
|
||||
registry.streamEntries()
|
||||
.map(e -> e.registryKey().getValue() + ": " +
|
||||
|
||||
@@ -1,34 +1,30 @@
|
||||
package com.dfsek.terra.lifecycle;
|
||||
|
||||
import cloud.commandframework.execution.CommandExecutionCoordinator;
|
||||
|
||||
import cloud.commandframework.fabric.FabricServerCommandManager;
|
||||
|
||||
import com.dfsek.terra.api.command.CommandSender;
|
||||
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||
|
||||
import com.dfsek.terra.mod.MinecraftAddon;
|
||||
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.dfsek.terra.api.command.CommandSender;
|
||||
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||
|
||||
|
||||
public class LifecycleEntryPoint {
|
||||
private static final Logger logger = LoggerFactory.getLogger(LifecycleEntryPoint.class);
|
||||
|
||||
protected static void initialize(String modName, LifecyclePlatform platform) {
|
||||
logger.info("Initializing Terra {} mod...", modName);
|
||||
|
||||
|
||||
FabricServerCommandManager<CommandSender> manager = new FabricServerCommandManager<>(
|
||||
CommandExecutionCoordinator.simpleCoordinator(),
|
||||
serverCommandSource -> (CommandSender) serverCommandSource,
|
||||
commandSender -> (ServerCommandSource) commandSender
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
manager.brigadierManager().setNativeNumberSuggestions(false);
|
||||
|
||||
|
||||
platform.getEventManager().callEvent(new CommandRegistrationEvent(manager));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ public abstract class LifecyclePlatform extends ModPlatform {
|
||||
LOGGER.warn("Failed to parse Minecraft version", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
addons.addAll(getPlatformMods());
|
||||
|
||||
|
||||
return addons;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.dfsek.terra.mod.util.BiomeUtil;
|
||||
|
||||
public final class LifecycleUtil {
|
||||
private LifecycleUtil() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
|
||||
@@ -23,12 +23,12 @@ public final class AwfulQuiltHacks {
|
||||
} catch(ReflectiveOperationException e) {
|
||||
throw new RuntimeException("Failed to load Classloader fields", e);
|
||||
}
|
||||
|
||||
|
||||
ADD_URL_METHOD = tempAddUrlMethod;
|
||||
}
|
||||
|
||||
|
||||
private AwfulQuiltHacks() { }
|
||||
|
||||
|
||||
/**
|
||||
* Hackily load the package which a mixin may exist within.
|
||||
* <p>
|
||||
|
||||
@@ -5,11 +5,11 @@ import com.dfsek.terra.mod.ModPlatform;
|
||||
|
||||
|
||||
public class QuiltAddon extends MinecraftAddon {
|
||||
|
||||
|
||||
public QuiltAddon(ModPlatform modPlatform) {
|
||||
super(modPlatform);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "terra-quilt";
|
||||
|
||||
Reference in New Issue
Block a user