This commit is contained in:
Zoë Gidiere
2025-07-10 21:52:39 -06:00
parent af1e9de474
commit f38fcd03b0
24 changed files with 74 additions and 95 deletions

View File

@@ -20,7 +20,6 @@ package com.dfsek.terra.bukkit;
import com.dfsek.tectonic.api.TypeRegistry;
import com.dfsek.tectonic.api.depth.DepthTracker;
import com.dfsek.tectonic.api.exception.LoadException;
import io.papermc.paper.registry.RegistryAccess;
import io.papermc.paper.registry.RegistryKey;
import org.bukkit.Bukkit;

View File

@@ -50,10 +50,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;
private AsyncScheduler asyncScheduler = this.getServer().getAsyncScheduler();
private GlobalRegionScheduler globalRegionScheduler = this.getServer().getGlobalRegionScheduler();

View File

@@ -19,6 +19,11 @@ public final class MultiverseGeneratorPluginHook implements GeneratorPlugin {
this.platform = platform;
}
public static void register(Platform platform) {
MultiverseCoreApi.get().getGeneratorProvider()
.registerGeneratorPlugin(new MultiverseGeneratorPluginHook(platform));
}
@Override
public @NotNull Collection<String> suggestIds(@Nullable String s) {
return platform.getConfigRegistry().entries().stream()
@@ -46,9 +51,4 @@ public final class MultiverseGeneratorPluginHook implements GeneratorPlugin {
public @NotNull String getPluginName() {
return "Terra";
}
public static void register(Platform platform) {
MultiverseCoreApi.get().getGeneratorProvider()
.registerGeneratorPlugin(new MultiverseGeneratorPluginHook(platform));
}
}

View File

@@ -69,26 +69,26 @@ public class CommonListener implements Listener {
@EventHandler
public void onWolfSpawn(CreatureSpawnEvent event) {
if (!(event.getEntity() instanceof Wolf wolf)) {
if(!(event.getEntity() instanceof Wolf wolf)) {
return;
}
// Doesn't apply if variant has already been applied
if (wolf.getVariant() != Variant.PALE) {
if(wolf.getVariant() != Variant.PALE) {
return;
}
if (!WOLF_VARIANT_SPAWN_REASONS.contains(event.getSpawnReason())) {
if(!WOLF_VARIANT_SPAWN_REASONS.contains(event.getSpawnReason())) {
return;
}
World world = wolf.getWorld();
if (!(world.getGenerator() instanceof BukkitChunkGeneratorWrapper wrapper)) {
if(!(world.getGenerator() instanceof BukkitChunkGeneratorWrapper wrapper)) {
return;
}
ConfigPack pack = platform.getConfigRegistry().get(wrapper.getPack().getRegistryKey()).orElse(null);
if (pack == null) {
if(pack == null) {
return;
}

View File

@@ -1,12 +1,10 @@
package com.dfsek.terra.bukkit.nms;
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.dfsek.terra.bukkit.BukkitAddon;
import com.dfsek.terra.bukkit.PlatformImpl;
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
import com.dfsek.terra.bukkit.util.VersionUtil;
@@ -18,7 +16,7 @@ public interface Initializer {
Logger logger = LoggerFactory.getLogger(Initializer.class);
PlatformImpl platform = constructPlatform(plugin);
if (platform == null) {
if(platform == null) {
logger.error("NMS bindings for version {} do not exist. Support for this version is limited.", NMS);
logger.error("This is usually due to running Terra on an unsupported Minecraft version.");
String bypassKey = "IKnowThereAreNoNMSBindingsFor" + NMS + "ButIWillProceedAnyway";
@@ -48,7 +46,7 @@ public interface Initializer {
private static PlatformImpl constructPlatform(TerraBukkitPlugin plugin) {
try {
String packageVersion = NMS;
if (NMS.equals("v1_21_5") || NMS.equals("v1_21_6")) {
if(NMS.equals("v1_21_5") || NMS.equals("v1_21_6")) {
packageVersion = "v1_21_7";
}

View File

@@ -5,4 +5,5 @@ import org.bukkit.NamespacedKey;
import com.dfsek.terra.api.properties.Properties;
public record BukkitBiomeInfo(NamespacedKey biomeKey) implements Properties {}
public record BukkitBiomeInfo(NamespacedKey biomeKey) implements Properties {
}