mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-05-20 00:30:20 +00:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 428bf341ef | |||
| 8a61571ceb | |||
| b669f87b79 | |||
| e507675ef6 | |||
| 3322a16f09 | |||
| c658d1a81b | |||
| 56a7234494 | |||
| 217b708177 | |||
| 7d86a41f65 | |||
| 753574fc9b | |||
| 95f89ed2b6 | |||
| cb8aefe8d2 | |||
| 79f9488380 | |||
| 4c2ce65cdc | |||
| 70c448dd0d | |||
| 060bda2ec1 | |||
| 6b60246694 | |||
| 1a1f461550 | |||
| da20e282ce | |||
| 9b14b0ee96 | |||
| 118aeb872f | |||
| 5446b729f9 | |||
| d71c6bb25f | |||
| d8524603c6 | |||
| 85234ddc39 | |||
| 78162eaafe | |||
| 7a041d8a63 | |||
| 8cfa2e1467 | |||
| 5f367c0f2c | |||
| f4db7fc507 | |||
| ad9d16f48c | |||
| 85b6dcc891 | |||
| 29691dfb4d | |||
| 81eab13ce1 | |||
| 68d5b22ca4 | |||
| 40b8c85c75 | |||
| 63367e5f03 | |||
| 1d95e7a87d | |||
| b2e21d8b70 | |||
| 95172bfa7e | |||
| 124dbc8836 | |||
| 4fee8cdb24 | |||
| 70de38ffcb | |||
| 6722d22f72 | |||
| c5526c86a2 |
+3
-3
@@ -1,8 +1,8 @@
|
||||
preRelease(true)
|
||||
|
||||
versionProjects(":common:api", version("6.6.3"))
|
||||
versionProjects(":common:implementation", version("6.6.3"))
|
||||
versionProjects(":platforms", version("6.6.3"))
|
||||
versionProjects(":common:api", version("6.6.5"))
|
||||
versionProjects(":common:implementation", version("6.6.5"))
|
||||
versionProjects(":platforms", version("6.6.5"))
|
||||
|
||||
|
||||
allprojects {
|
||||
|
||||
@@ -66,6 +66,9 @@ fun Project.configureDependencies() {
|
||||
maven("https://storehouse.okaeri.eu/repository/maven-public/") {
|
||||
name = "Okaeri"
|
||||
}
|
||||
maven("https://repo.onarandombox.com/multiverse-releases") {
|
||||
name = "onarandombox"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
object Versions {
|
||||
object Terra {
|
||||
const val overworldConfig = "v1.5.1"
|
||||
const val overworldConfig = "v1.5.2"
|
||||
}
|
||||
|
||||
object Libraries {
|
||||
@@ -28,8 +28,8 @@ object Versions {
|
||||
}
|
||||
|
||||
object Fabric {
|
||||
const val fabricAPI = "0.127.0+${Mod.minecraft}"
|
||||
const val cloud = "2.0.0-beta.10"
|
||||
const val fabricAPI = "0.128.1+${Mod.minecraft}"
|
||||
const val cloud = "2.0.0-beta.11"
|
||||
}
|
||||
//
|
||||
// object Quilt {
|
||||
@@ -41,7 +41,7 @@ object Versions {
|
||||
const val mixin = "0.15.5+mixin.0.8.7"
|
||||
const val mixinExtras = "0.4.1"
|
||||
|
||||
const val minecraft = "1.21.6"
|
||||
const val minecraft = "1.21.7"
|
||||
const val yarn = "$minecraft+build.1"
|
||||
const val fabricLoader = "0.16.14"
|
||||
|
||||
@@ -56,8 +56,8 @@ object Versions {
|
||||
// }
|
||||
|
||||
object Bukkit {
|
||||
const val minecraft = "1.21.6-R0.1"
|
||||
const val paperBuild = "$minecraft-20250617.170821-8"
|
||||
const val minecraft = "1.21.7-R0.1"
|
||||
const val paperBuild = "$minecraft-20250630.144242-1"
|
||||
const val paper = paperBuild
|
||||
const val paperLib = "1.0.8"
|
||||
const val reflectionRemapper = "0.1.2"
|
||||
@@ -65,6 +65,7 @@ object Versions {
|
||||
const val runPaper = "2.3.1"
|
||||
const val paperWeight = "2.0.0-beta.17"
|
||||
const val cloud = "2.0.0-beta.10"
|
||||
const val multiverse = "5.0.2"
|
||||
}
|
||||
|
||||
//
|
||||
@@ -87,6 +88,6 @@ object Versions {
|
||||
}
|
||||
|
||||
object Minestom {
|
||||
const val minestom = "187931e50b"
|
||||
const val minestom = "1_21_6-c3ccee696b"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
bool thing1 = 2 > (2+2) || false;
|
||||
bool thing1 = 2 > (2 + 2) || false;
|
||||
|
||||
if(2 > 2 || 3 + 4 <= 2 && 4 + 5 > 2 / 3) {
|
||||
if (2 > 2 || 3 + 4 <= 2 && 4 + 5 > 2 / 3) {
|
||||
test("ok", 2);
|
||||
}
|
||||
|
||||
test("minecraft:green_w" + "ool", (2 * (3+1) * (2 * (1+1))));
|
||||
test("minecraft:green_w" + "ool", (2 * (3 + 1) * (2 * (1 + 1))));
|
||||
//
|
||||
|
||||
num testVar = 3.4;
|
||||
@@ -21,7 +21,7 @@ bool iftest = false;
|
||||
bool truetest = false;
|
||||
|
||||
num iterator = 0;
|
||||
num thing = 4 - 2-2+2-2+2;
|
||||
num thing = 4 - 2 - 2 + 2 - 2 + 2;
|
||||
test("4 - 2 = " + thing, 2);
|
||||
|
||||
thing = -2;
|
||||
@@ -31,54 +31,54 @@ test("--2 = " + thing, 2);
|
||||
|
||||
|
||||
|
||||
for(num i = 0; i < 5; i = i + 1) {
|
||||
for (num i = 0; i < 5; i = i + 1) {
|
||||
test("i = " + i, iterator);
|
||||
if(i > 1 + 1) {
|
||||
if (i > 1 + 1) {
|
||||
test("more than 2", iterator);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for(num i = 0; i < 5; i = i + 1) {
|
||||
for (num i = 0; i < 5; i = i + 1) {
|
||||
test("i = " + i, iterator);
|
||||
}
|
||||
|
||||
for(num j = 0; j < 5; j = j + 1) test("single statement j = " + j, iterator);
|
||||
for (num j = 0; j < 5; j = j + 1) test("single statement j = " + j, iterator);
|
||||
|
||||
if(4 + 2 == 2 + 4) {
|
||||
if (4 + 2 == 2 + 4) {
|
||||
test("new thing " + 2, iterator);
|
||||
}
|
||||
|
||||
while(iterator < 5) {
|
||||
while (iterator < 5) {
|
||||
test("always, even after " + 2, iterator);
|
||||
iterator = iterator + 1;
|
||||
if(iterator > 2) {
|
||||
if (iterator > 2) {
|
||||
continue;
|
||||
}
|
||||
test("not after " + 2, iterator);
|
||||
}
|
||||
|
||||
if(true) test("single statement" + 2, iterator);
|
||||
else if(true) test("another single statement" + 2, iterator);
|
||||
if (true) test("single statement" + 2, iterator);
|
||||
else if (true) test("another single statement" + 2, iterator);
|
||||
|
||||
if(true) {
|
||||
test("true!" + 2, iterator);
|
||||
} else {
|
||||
test("false!" + 2, iterator);
|
||||
}
|
||||
|
||||
if(false) {
|
||||
if (true) {
|
||||
test("true!" + 2, iterator);
|
||||
} else {
|
||||
test("false!" + 2, iterator);
|
||||
}
|
||||
|
||||
if(false) {
|
||||
test("true again!" + 2, iterator);
|
||||
} else if(true == true) {
|
||||
test("false again!" + 2, iterator);
|
||||
if (false) {
|
||||
test("true!" + 2, iterator);
|
||||
} else {
|
||||
test("not logged!" + 2, iterator);
|
||||
test("false!" + 2, iterator);
|
||||
}
|
||||
|
||||
if (false) {
|
||||
test("true again!" + 2, iterator);
|
||||
} else if (true == true) {
|
||||
test("false again!" + 2, iterator);
|
||||
} else {
|
||||
test("not logged!" + 2, iterator);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ fsdfsd
|
||||
|
||||
test("fdsgdf" + 2, 1 + testVar);
|
||||
|
||||
if(true && !(boolean && false) && true) {
|
||||
if (true && !(boolean && false) && true) {
|
||||
num scopedVar = 2;
|
||||
test("if statement" + 2 + stringVar, 1 + testVar + scopedVar);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public abstract class AbstractPlatform implements Platform {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
protected void load() {
|
||||
protected InternalAddon load() {
|
||||
if(LOADED.get()) {
|
||||
throw new IllegalStateException(
|
||||
"Someone tried to initialize Terra, but Terra has already initialized. This is most likely due to a broken platform " +
|
||||
@@ -159,6 +159,8 @@ public abstract class AbstractPlatform implements Platform {
|
||||
|
||||
logger.info("Terra addons successfully loaded.");
|
||||
logger.info("Finished initialization.");
|
||||
|
||||
return internalAddon;
|
||||
}
|
||||
|
||||
protected InternalAddon loadAddons() {
|
||||
|
||||
@@ -8,7 +8,7 @@ dependencies {
|
||||
paperweight.paperDevBundle(Versions.Bukkit.paperDevBundle)
|
||||
|
||||
shaded(project(":platforms:bukkit:common"))
|
||||
shaded(project(":platforms:bukkit:nms:v1_21_6"))
|
||||
shaded(project(":platforms:bukkit:nms:v1_21_7"))
|
||||
shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ dependencies {
|
||||
|
||||
compileOnly("io.papermc.paper", "paper-api", Versions.Bukkit.paper)
|
||||
|
||||
compileOnly("org.mvplugins.multiverse.core", "multiverse-core", Versions.Bukkit.multiverse)
|
||||
|
||||
shadedApi("io.papermc", "paperlib", Versions.Bukkit.paperLib)
|
||||
|
||||
shadedApi("com.google.guava", "guava", Versions.Libraries.Internal.guava)
|
||||
|
||||
@@ -21,20 +21,18 @@ import com.dfsek.tectonic.api.TypeRegistry;
|
||||
import com.dfsek.tectonic.api.depth.DepthTracker;
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.Initializer;
|
||||
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.dfsek.terra.AbstractPlatform;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.handle.WorldHandle;
|
||||
@@ -97,11 +95,6 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
plugin.getGlobalRegionScheduler().run(plugin, task -> runnable.run());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<BaseAddon> platformAddon() {
|
||||
return List.of(Initializer.nmsAddon(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull WorldHandle getWorldHandle() {
|
||||
return handle;
|
||||
@@ -131,8 +124,9 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
|
||||
}
|
||||
|
||||
private BukkitPlatformBiome parseBiome(String id, DepthTracker depthTracker) throws LoadException {
|
||||
if(!id.startsWith("minecraft:")) throw new LoadException("Invalid biome identifier " + id, depthTracker);
|
||||
return new BukkitPlatformBiome(org.bukkit.block.Biome.valueOf(id.toUpperCase(Locale.ROOT).substring(10)));
|
||||
protected BukkitPlatformBiome parseBiome(String id, DepthTracker depthTracker) throws LoadException {
|
||||
NamespacedKey key = NamespacedKey.fromString(id);
|
||||
if(key == null || !key.namespace().equals("minecraft")) throw new LoadException("Invalid biome identifier " + id, depthTracker);
|
||||
return new BukkitPlatformBiome(RegistryAccess.registryAccess().getRegistry(RegistryKey.BIOME).getOrThrow(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ import com.dfsek.terra.bukkit.world.BukkitAdapter;
|
||||
public class TerraBukkitPlugin extends JavaPlugin {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TerraBukkitPlugin.class);
|
||||
|
||||
private final PlatformImpl platform = new PlatformImpl(this);
|
||||
private PlatformImpl platform;
|
||||
private final Map<String, com.dfsek.terra.api.world.chunk.generation.ChunkGenerator> generatorMap = new HashMap<>();
|
||||
|
||||
private AsyncScheduler asyncScheduler = this.getServer().getAsyncScheduler();
|
||||
@@ -64,13 +64,14 @@ public class TerraBukkitPlugin extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
platform.getEventManager().callEvent(new PlatformInitializationEvent());
|
||||
|
||||
if(!Initializer.init(platform)) {
|
||||
platform = Initializer.init(this);
|
||||
if(platform == null) {
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
platform.getEventManager().callEvent(new PlatformInitializationEvent());
|
||||
|
||||
try {
|
||||
LegacyPaperCommandManager<CommandSender> commandManager = getCommandSenderPaperCommandManager();
|
||||
|
||||
@@ -87,7 +88,7 @@ public class TerraBukkitPlugin extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new CommonListener(), this); // Register master event listener
|
||||
Bukkit.getPluginManager().registerEvents(new CommonListener(platform), this); // Register master event listener
|
||||
PaperUtil.checkPaper(this);
|
||||
}
|
||||
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.dfsek.terra.bukkit.hooks;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.registry.key.Keyed;
|
||||
|
||||
import org.mvplugins.multiverse.core.MultiverseCoreApi;
|
||||
import org.mvplugins.multiverse.core.world.generators.GeneratorPlugin;
|
||||
import org.mvplugins.multiverse.external.jetbrains.annotations.NotNull;
|
||||
import org.mvplugins.multiverse.external.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public final class MultiverseGeneratorPluginHook implements GeneratorPlugin {
|
||||
|
||||
private final Platform platform;
|
||||
|
||||
public MultiverseGeneratorPluginHook(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Collection<String> suggestIds(@Nullable String s) {
|
||||
return platform.getConfigRegistry().entries().stream()
|
||||
.map(Keyed::getID)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Collection<String> getExampleUsages() {
|
||||
return platform.getConfigRegistry()
|
||||
.entries()
|
||||
.stream()
|
||||
.map(Keyed::getID)
|
||||
.map("/mv create example_world NORMAL -g Terra:%s"::formatted)
|
||||
.limit(5) // reasonable amount
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getInfoLink() {
|
||||
return "https://terra.polydev.org/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getPluginName() {
|
||||
return "Terra";
|
||||
}
|
||||
|
||||
public static void register(Platform platform) {
|
||||
MultiverseCoreApi.get().getGeneratorProvider()
|
||||
.registerGeneratorPlugin(new MultiverseGeneratorPluginHook(platform));
|
||||
}
|
||||
}
|
||||
+88
-1
@@ -17,13 +17,100 @@
|
||||
|
||||
package com.dfsek.terra.bukkit.listeners;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.bukkit.generator.BukkitChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.bukkit.hooks.MultiverseGeneratorPluginHook;
|
||||
|
||||
import com.dfsek.terra.bukkit.world.BukkitBiomeInfo;
|
||||
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.Wolf.Variant;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Listener for events on all implementations.
|
||||
*/
|
||||
public class CommonListener implements Listener {
|
||||
public CommonListener() {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CommonListener.class);
|
||||
private static final List<SpawnReason> WOLF_VARIANT_SPAWN_REASONS = List.of(
|
||||
SpawnReason.SPAWNER, SpawnReason.TRIAL_SPAWNER, SpawnReason.SPAWNER_EGG, SpawnReason.DEFAULT
|
||||
);
|
||||
private final Platform platform;
|
||||
|
||||
public CommonListener(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if(event.getPlugin().getName().equals("Multiverse-Core")) {
|
||||
try {
|
||||
Class.forName("org.mvplugins.multiverse.core.MultiverseCoreApi");
|
||||
MultiverseGeneratorPluginHook.register(platform);
|
||||
} catch(ClassNotFoundException e) {
|
||||
logger.debug("Multiverse v5 is not installed.");
|
||||
} catch(IllegalStateException e) {
|
||||
logger.error("Failed to register Terra generator plugin to multiverse.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWolfSpawn(CreatureSpawnEvent event) {
|
||||
if (!(event.getEntity() instanceof Wolf wolf)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Doesn't apply if variant has already been applied
|
||||
if (wolf.getVariant() != Variant.PALE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WOLF_VARIANT_SPAWN_REASONS.contains(event.getSpawnReason())) {
|
||||
return;
|
||||
}
|
||||
|
||||
World world = wolf.getWorld();
|
||||
if (!(world.getGenerator() instanceof BukkitChunkGeneratorWrapper wrapper)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigPack pack = platform.getConfigRegistry().get(wrapper.getPack().getRegistryKey()).orElse(null);
|
||||
if (pack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NamespacedKey biomeKey = wolf.getWorld().getBiome(wolf.getLocation()).getKey();
|
||||
pack.getBiomeProvider().stream()
|
||||
.filter(biome -> {
|
||||
NamespacedKey key = ((BukkitPlatformBiome) biome.getPlatformBiome()).getContext()
|
||||
.get(BukkitBiomeInfo.class)
|
||||
.biomeKey();
|
||||
return key.equals(biomeKey);
|
||||
})
|
||||
.findFirst()
|
||||
.ifPresent(biome -> {
|
||||
NamespacedKey vanillaBiomeKey = ((BukkitPlatformBiome) biome.getPlatformBiome()).getHandle().getKey();
|
||||
switch(vanillaBiomeKey.toString()) {
|
||||
case "minecraft:snowy_taiga" -> wolf.setVariant(Variant.ASHEN);
|
||||
case "minecraft:old_growth_pine_taiga" -> wolf.setVariant(Variant.BLACK);
|
||||
case "minecraft:old_growth_spruce_taiga" -> wolf.setVariant(Variant.CHESTNUT);
|
||||
case "minecraft:grove" -> wolf.setVariant(Variant.SNOWY);
|
||||
case "minecraft:forest" -> wolf.setVariant(Variant.WOODS);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.bukkit.nms;
|
||||
|
||||
import com.dfsek.terra.bukkit.BukkitAddon;
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -13,13 +13,11 @@ public interface Initializer {
|
||||
String NMS = VersionUtil.getMinecraftVersionInfo().toString().replace(".", "_");
|
||||
String TERRA_PACKAGE = Initializer.class.getPackageName();
|
||||
|
||||
static boolean init(PlatformImpl platform) {
|
||||
static PlatformImpl init(TerraBukkitPlugin plugin) {
|
||||
Logger logger = LoggerFactory.getLogger(Initializer.class);
|
||||
|
||||
Initializer initializer = constructInitializer();
|
||||
if(initializer != null) {
|
||||
initializer.initialize(platform);
|
||||
} else {
|
||||
PlatformImpl platform = constructPlatform(plugin);
|
||||
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";
|
||||
@@ -27,7 +25,7 @@ public interface Initializer {
|
||||
logger.error("Because of this **TERRA HAS BEEN DISABLED**.");
|
||||
logger.error("Do not come ask us why it is not working.");
|
||||
logger.error("If you wish to proceed anyways, you can add the JVM System Property \"{}\" to enable the plugin.", bypassKey);
|
||||
return false;
|
||||
return null;
|
||||
} else {
|
||||
logger.error("");
|
||||
logger.error("");
|
||||
@@ -43,24 +41,21 @@ public interface Initializer {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return platform;
|
||||
}
|
||||
|
||||
static BukkitAddon nmsAddon(PlatformImpl platform) {
|
||||
Initializer initializer = constructInitializer();
|
||||
return initializer != null ? initializer.getNMSAddon(platform) : new BukkitAddon(platform);
|
||||
}
|
||||
|
||||
private static Initializer constructInitializer() {
|
||||
private static PlatformImpl constructPlatform(TerraBukkitPlugin plugin) {
|
||||
try {
|
||||
String packageVersion = NMS;
|
||||
if (NMS.equals("v1_21_5")) {
|
||||
packageVersion = "v1_21_6";
|
||||
if (NMS.equals("v1_21_5") || NMS.equals("v1_21_6")) {
|
||||
packageVersion = "v1_21_7";
|
||||
}
|
||||
|
||||
Class<?> initializerClass = Class.forName(TERRA_PACKAGE + "." + packageVersion + ".NMSInitializer");
|
||||
Class<?> platformClass = Class.forName(TERRA_PACKAGE + "." + packageVersion + ".NMSPlatform");
|
||||
try {
|
||||
return (Initializer) initializerClass.getConstructor().newInstance();
|
||||
return (PlatformImpl) platformClass
|
||||
.getConstructor(TerraBukkitPlugin.class)
|
||||
.newInstance(plugin);
|
||||
} catch(ReflectiveOperationException e) {
|
||||
throw new RuntimeException("Error initializing NMS bindings. Report this to Terra.", e);
|
||||
}
|
||||
@@ -68,8 +63,4 @@ public interface Initializer {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void initialize(PlatformImpl plugin);
|
||||
|
||||
BukkitAddon getNMSAddon(PlatformImpl plugin);
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.dfsek.terra.bukkit.world;
|
||||
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
||||
|
||||
public record BukkitBiomeInfo(NamespacedKey biomeKey) implements Properties {}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import com.dfsek.terra.bukkit.BukkitAddon;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
import com.dfsek.terra.bukkit.nms.Initializer;
|
||||
|
||||
|
||||
public class NMSInitializer implements Initializer {
|
||||
@Override
|
||||
public void initialize(PlatformImpl platform) {
|
||||
AwfulBukkitHacks.registerBiomes(platform.getRawConfigRegistry());
|
||||
Bukkit.getPluginManager().registerEvents(new NMSInjectListener(), platform.getPlugin());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BukkitAddon getNMSAddon(PlatformImpl plugin) {
|
||||
return new NMSAddon(plugin);
|
||||
}
|
||||
}
|
||||
+17
-6
@@ -1,6 +1,8 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.VanillaBiomeProperties;
|
||||
|
||||
import com.dfsek.terra.bukkit.world.BukkitBiomeInfo;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Holder.Reference;
|
||||
@@ -12,6 +14,7 @@ import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.slf4j.Logger;
|
||||
@@ -22,6 +25,7 @@ import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -46,6 +50,7 @@ public class AwfulBukkitHacks {
|
||||
configRegistry.forEach(pack -> pack.getRegistry(com.dfsek.terra.api.world.biome.Biome.class).forEach((key, biome) -> {
|
||||
try {
|
||||
BukkitPlatformBiome platformBiome = (BukkitPlatformBiome) biome.getPlatformBiome();
|
||||
|
||||
NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey();
|
||||
ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
|
||||
vanillaBukkitKey.getKey());
|
||||
@@ -54,16 +59,22 @@ public class AwfulBukkitHacks {
|
||||
|
||||
Biome platform = NMSBiomeInjector.createBiome(biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value(), vanillaBiomeProperties);
|
||||
|
||||
ResourceKey<Biome> delegateKey = ResourceKey.create(
|
||||
Registries.BIOME,
|
||||
ResourceLocation.fromNamespaceAndPath("terra", NMSBiomeInjector.createBiomeID(pack, key))
|
||||
);
|
||||
ResourceLocation delegateMinecraftKey = ResourceLocation.fromNamespaceAndPath("terra", NMSBiomeInjector.createBiomeID(pack, key));
|
||||
NamespacedKey delegateBukkitKey = NamespacedKey.fromString(delegateMinecraftKey.toString());
|
||||
ResourceKey<Biome> delegateKey = ResourceKey.create(Registries.BIOME, delegateMinecraftKey);
|
||||
|
||||
Reference<Biome> holder = biomeRegistry.register(delegateKey, platform, RegistrationInfo.BUILT_IN);
|
||||
Reflection.REFERENCE.invokeBindValue(holder, platform); // IMPORTANT: bind holder.
|
||||
|
||||
platformBiome.getContext().put(new BukkitBiomeInfo(delegateBukkitKey));
|
||||
platformBiome.getContext().put(new NMSBiomeInfo(delegateKey));
|
||||
|
||||
Map<ResourceKey<Biome>, ResourceKey<VillagerType>> villagerMap = Reflection.VILLAGER_TYPE.getByBiome();
|
||||
|
||||
villagerMap.put(delegateKey,
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(),
|
||||
villagerMap.getOrDefault(delegateKey, VillagerType.PLAINS)));
|
||||
|
||||
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.location());
|
||||
|
||||
LOGGER.debug("Registered biome: " + delegateKey);
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
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;
|
||||
import com.dfsek.terra.bukkit.BukkitAddon;
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.VanillaBiomeProperties;
|
||||
|
||||
|
||||
public class NMSAddon extends BukkitAddon {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -12,7 +12,7 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.VanillaBiomeProperties;
|
||||
|
||||
|
||||
public class NMSBiomeInjector {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.Holder;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.BlockPos;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import com.dfsek.tectonic.api.TypeRegistry;
|
||||
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import com.dfsek.terra.addon.InternalAddon;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
|
||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||
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_21_7.config.BiomeAdditionsSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.BiomeMoodSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.BiomeParticleConfigTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.EntityTypeTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.MusicSoundTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.SoundEventTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.SpawnCostConfig;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.SpawnEntryConfig;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.SpawnSettingsTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.SpawnTypeConfig;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_7.config.VillagerTypeTemplate;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.level.biome.AmbientMoodSettings;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
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 org.bukkit.Bukkit;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class NMSPlatform extends PlatformImpl {
|
||||
|
||||
public NMSPlatform(TerraBukkitPlugin plugin) {
|
||||
super(plugin);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new NMSInjectListener(), plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(TypeRegistry registry) {
|
||||
super.register(registry);
|
||||
registry.registerLoader(PlatformBiome.class, (type, o, loader, depthTracker) -> parseBiome((String) o, depthTracker))
|
||||
.registerLoader(ResourceLocation.class, (type, o, loader, depthTracker) -> {
|
||||
ResourceLocation identifier = ResourceLocation.tryParse((String) o);
|
||||
if(identifier == null)
|
||||
throw new LoadException("Invalid identifier: " + o, depthTracker);
|
||||
return identifier;
|
||||
})
|
||||
.registerLoader(Precipitation.class, (type, o, loader, depthTracker) -> Precipitation.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.registerLoader(GrassColorModifier.class,
|
||||
(type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.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(AmbientParticleSettings.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
|
||||
.registerLoader(AmbientMoodSettings.class, BiomeMoodSoundTemplate::new)
|
||||
.registerLoader(AmbientAdditionsSettings.class, BiomeAdditionsSoundTemplate::new)
|
||||
.registerLoader(Music.class, MusicSoundTemplate::new)
|
||||
.registerLoader(EntityType.class, EntityTypeTemplate::new)
|
||||
.registerLoader(SpawnCostConfig.class, SpawnCostConfig::new)
|
||||
.registerLoader(SpawnEntryConfig.class, SpawnEntryConfig::new)
|
||||
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
|
||||
.registerLoader(MobSpawnSettings.class, SpawnSettingsTemplate::new)
|
||||
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InternalAddon load() {
|
||||
InternalAddon internalAddon = super.load();
|
||||
|
||||
this.getEventManager().getHandler(FunctionalEventHandler.class)
|
||||
.register(internalAddon, PlatformInitializationEvent.class)
|
||||
.priority(1)
|
||||
.then(event -> AwfulBukkitHacks.registerBiomes(this.getRawConfigRegistry()))
|
||||
.global();
|
||||
|
||||
return internalAddon;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<BaseAddon> platformAddon() {
|
||||
return List.of(new NMSAddon(this));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
||||
+11
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Holder.Reference;
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
@@ -36,6 +37,7 @@ public class Reflection {
|
||||
public static final HolderReferenceProxy HOLDER_REFERENCE;
|
||||
public static final HolderSetNamedProxy HOLDER_SET;
|
||||
public static final BiomeProxy BIOME;
|
||||
public static final VillagerTypeProxy VILLAGER_TYPE;
|
||||
|
||||
static {
|
||||
ReflectionRemapper reflectionRemapper = ReflectionRemapper.forReobfMappingsInPaperJar();
|
||||
@@ -50,6 +52,7 @@ public class Reflection {
|
||||
HOLDER_REFERENCE = reflectionProxyFactory.reflectionProxy(HolderReferenceProxy.class);
|
||||
HOLDER_SET = reflectionProxyFactory.reflectionProxy(HolderSetNamedProxy.class);
|
||||
BIOME = reflectionProxyFactory.reflectionProxy(BiomeProxy.class);
|
||||
VILLAGER_TYPE = reflectionProxyFactory.reflectionProxy(VillagerTypeProxy.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,4 +124,11 @@ public class Reflection {
|
||||
@MethodName("getGrassColorFromTexture")
|
||||
int invokeGrassColorFromTexture(Biome instance);
|
||||
}
|
||||
|
||||
@Proxies(VillagerType.class)
|
||||
public interface VillagerTypeProxy {
|
||||
@Static
|
||||
@FieldGetter("BY_BIOME")
|
||||
Map<ResourceKey<Biome>, ResourceKey<VillagerType>> getByBiome();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+10
-4
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
@@ -6,10 +6,15 @@ import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.commands.arguments.ParticleArgument;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.HolderLookup.Provider;
|
||||
import net.minecraft.core.HolderLookup.RegistryLookup;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticleSettings> {
|
||||
@Value("particle")
|
||||
@@ -18,17 +23,18 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
|
||||
|
||||
@Value("probability")
|
||||
@Default
|
||||
private Integer probability = null;
|
||||
private Float probability = 0.1f;
|
||||
|
||||
@Override
|
||||
public AmbientParticleSettings get() {
|
||||
if(particle == null || probability == null) {
|
||||
if(particle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
return new AmbientParticleSettings(ParticleArgument.readParticle(new StringReader(particle),
|
||||
(Provider) BuiltInRegistries.PARTICLE_TYPE.asHolderIdMap()), probability);
|
||||
HolderLookup.Provider.create(Stream.of(BuiltInRegistries.PARTICLE_TYPE))), probability);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
@@ -28,7 +28,7 @@ public class SpawnEntryConfig implements ObjectTemplate<SpawnEntryConfig> {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public SpawnerData getSpawnerData() {
|
||||
public SpawnerData getSpawnEntry() {
|
||||
return new SpawnerData(type, minGroupSize, maxGroupSize);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
@@ -33,7 +33,7 @@ public class SpawnSettingsTemplate implements ObjectTemplate<MobSpawnSettings> {
|
||||
for(SpawnTypeConfig spawn : spawns) {
|
||||
MobCategory group = spawn.getGroup();
|
||||
for(SpawnEntryConfig entry : spawn.getEntries()) {
|
||||
builder.addSpawn(group, entry.getWeight(), entry.getSpawnerData());
|
||||
builder.addSpawn(group, entry.getWeight(), entry.getSpawnEntry());
|
||||
}
|
||||
}
|
||||
for(SpawnCostConfig cost : costs) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.ConfigTemplate;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
@@ -6,6 +6,7 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
@@ -96,7 +97,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
|
||||
@Value("villager-type")
|
||||
@Default
|
||||
private VillagerType villagerType = null;
|
||||
private ResourceKey<VillagerType> villagerType = null;
|
||||
|
||||
public Integer getFogColor() {
|
||||
return fogColor;
|
||||
@@ -174,7 +175,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return spawnSettings;
|
||||
}
|
||||
|
||||
public VillagerType getVillagerType() {
|
||||
public ResourceKey<VillagerType> getVillagerType() {
|
||||
return villagerType;
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -1,20 +1,21 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_7.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 net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
|
||||
|
||||
public class VillagerTypeTemplate implements ObjectTemplate<VillagerType> {
|
||||
public class VillagerTypeTemplate implements ObjectTemplate<ResourceKey<VillagerType>> {
|
||||
@Value("id")
|
||||
@Default
|
||||
private ResourceLocation id = null;
|
||||
|
||||
@Override
|
||||
public VillagerType get() {
|
||||
return BuiltInRegistries.VILLAGER_TYPE.get(id).orElseThrow().value();
|
||||
public ResourceKey<VillagerType> get() {
|
||||
return ResourceKey.create(BuiltInRegistries.VILLAGER_TYPE.key(), id);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.16.10",
|
||||
"java": ">=21",
|
||||
"minecraft": ">=1.21.5",
|
||||
"minecraft": "1.21.7",
|
||||
"fabric": "*"
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public final class MinestomPlatform extends AbstractPlatform {
|
||||
if(world.generator() instanceof MinestomChunkGeneratorWrapper wrapper) {
|
||||
getConfigRegistry().get(wrapper.getPack().getRegistryKey()).ifPresent(pack -> {
|
||||
wrapper.setPack(pack);
|
||||
LOGGER.info("Replaced pack in chunk generator for instance {}", world.getUniqueId());
|
||||
LOGGER.info("Replaced pack in chunk generator for instance {}", world.getUuid());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -7,9 +7,9 @@ import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
||||
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.registry.DynamicRegistry;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import net.minestom.server.world.biome.Biome;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MinestomBiomeLoader implements TypeLoader<PlatformBiome> {
|
||||
public PlatformBiome load(@NotNull AnnotatedType annotatedType, @NotNull Object o, @NotNull ConfigLoader configLoader,
|
||||
DepthTracker depthTracker) throws LoadException {
|
||||
String id = (String) o;
|
||||
NamespaceID biomeID = NamespaceID.from(id);
|
||||
Key biomeID = Key.key(id);
|
||||
Biome biome = biomeRegistry.get(biomeID);
|
||||
if(biome == null) throw new LoadException("Biome %s does not exist in registry".formatted(id), depthTracker);
|
||||
return new MinestomBiome(biome);
|
||||
|
||||
+7
-1
@@ -4,11 +4,17 @@ import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||
import com.dfsek.terra.minestom.api.BlockEntityFactory;
|
||||
|
||||
import net.minestom.server.coordinate.BlockVec;
|
||||
import net.minestom.server.instance.Instance;
|
||||
|
||||
|
||||
public class DefaultBlockEntityFactory implements BlockEntityFactory {
|
||||
private final Instance instance;
|
||||
public DefaultBlockEntityFactory(Instance instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockVec position) {
|
||||
return null;
|
||||
return new MinestomBlockEntity(instance, position);
|
||||
}
|
||||
}
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.dfsek.terra.minestom.block;
|
||||
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
import net.minestom.server.coordinate.BlockVec;
|
||||
import net.minestom.server.instance.Instance;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
|
||||
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
|
||||
public class MinestomBlockEntity implements BlockEntity {
|
||||
private final Instance instance;
|
||||
private final BlockVec position;
|
||||
private final Vector3 positionVec;
|
||||
|
||||
public MinestomBlockEntity(Instance instance, BlockVec position) {
|
||||
this.instance = instance;
|
||||
this.position = position;
|
||||
this.positionVec = Vector3.of(position.blockX(), position.blockY(), position.blockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean applyPhysics) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3 getPosition() {
|
||||
return positionVec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return position.blockX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY() {
|
||||
return position.blockY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
return position.blockZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState() {
|
||||
return new MinestomBlockState(instance.getBlock(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getHandle() {
|
||||
return instance.getBlock(position);
|
||||
}
|
||||
}
|
||||
+9
-24
@@ -1,15 +1,14 @@
|
||||
package com.dfsek.terra.minestom.block;
|
||||
|
||||
import net.minestom.server.instance.block.Block;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockType;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.block.state.properties.Property;
|
||||
|
||||
import net.minestom.server.instance.block.Block;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class MinestomBlockState implements BlockState {
|
||||
private final Block block;
|
||||
@@ -23,24 +22,10 @@ public class MinestomBlockState implements BlockState {
|
||||
}
|
||||
|
||||
public MinestomBlockState(String data) {
|
||||
if(!data.contains("[")) {
|
||||
block = Block.fromNamespaceId(data);
|
||||
return;
|
||||
block = Block.fromState(data);
|
||||
if (block == null) {
|
||||
throw new IllegalArgumentException("Invalid block state: " + data);
|
||||
}
|
||||
|
||||
String[] split = data.split("\\[");
|
||||
String namespaceId = split[0];
|
||||
String properties = split[1].substring(0, split[1].length() - 1);
|
||||
Block block = Block.fromNamespaceId(namespaceId);
|
||||
HashMap<String, String> propertiesMap = new HashMap<>();
|
||||
|
||||
for(String property : properties.split(",")) {
|
||||
String[] kv = property.split("=");
|
||||
propertiesMap.put(kv[0].strip(), kv[1].strip());
|
||||
}
|
||||
|
||||
assert block != null;
|
||||
this.block = block.withProperties(propertiesMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +55,7 @@ public class MinestomBlockState implements BlockState {
|
||||
|
||||
@Override
|
||||
public String getAsString(boolean properties) {
|
||||
String name = block.namespace().asString();
|
||||
String name = block.key().asString();
|
||||
if(!properties || block.properties().isEmpty()) {
|
||||
return name;
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ public class MinestomEntityType implements com.dfsek.terra.api.entity.EntityType
|
||||
private final EntityType delegate;
|
||||
|
||||
public MinestomEntityType(String id) {
|
||||
delegate = EntityType.fromNamespaceId(id);
|
||||
delegate = EntityType.fromKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+15
-15
@@ -5,47 +5,47 @@ import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.item.Material;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
|
||||
import java.util.Objects;
|
||||
import net.minestom.server.registry.DynamicRegistry;
|
||||
import net.minestom.server.registry.RegistryKey;
|
||||
|
||||
|
||||
public class MinestomEnchantment implements Enchantment {
|
||||
private final net.minestom.server.item.enchant.Enchantment delegate;
|
||||
private final String id;
|
||||
private final net.minestom.server.item.enchant.Enchantment registryItem;
|
||||
private final RegistryKey<net.minestom.server.item.enchant.Enchantment> id;
|
||||
private static final DynamicRegistry<net.minestom.server.item.enchant.Enchantment> enchantmentRegistry =
|
||||
MinecraftServer.getEnchantmentRegistry();
|
||||
|
||||
public MinestomEnchantment(net.minestom.server.item.enchant.Enchantment delegate) {
|
||||
this.delegate = delegate;
|
||||
id = Objects.requireNonNull(delegate.registry()).raw();
|
||||
public MinestomEnchantment(RegistryKey<net.minestom.server.item.enchant.Enchantment> id) {
|
||||
this.id = id;
|
||||
this.registryItem = enchantmentRegistry.get(id);
|
||||
}
|
||||
|
||||
public MinestomEnchantment(String id) {
|
||||
this.delegate = MinecraftServer.getEnchantmentRegistry().get(NamespaceID.from(id));
|
||||
this.id = id;
|
||||
this(RegistryKey.unsafeOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEnchantItem(ItemStack itemStack) {
|
||||
return delegate.supportedItems().contains((Material) itemStack.getType().getHandle());
|
||||
return registryItem.supportedItems().contains((Material) itemStack.getType().getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean conflictsWith(Enchantment other) {
|
||||
return delegate.exclusiveSet().contains(NamespaceID.from(((MinestomEnchantment) other).id));
|
||||
return registryItem.exclusiveSet().contains(((MinestomEnchantment) other).id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return id;
|
||||
return id.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLevel() {
|
||||
return delegate.maxLevel();
|
||||
return registryItem.maxLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.minestom.server.item.enchant.Enchantment getHandle() {
|
||||
return delegate;
|
||||
return registryItem;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,6 +23,6 @@ public class MinestomItemHandle implements ItemHandle {
|
||||
|
||||
@Override
|
||||
public Set<Enchantment> getEnchantments() {
|
||||
return MinecraftServer.getEnchantmentRegistry().values().stream().map(MinestomEnchantment::new).collect(Collectors.toSet());
|
||||
return MinecraftServer.getEnchantmentRegistry().keys().stream().map(MinestomEnchantment::new).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -6,11 +6,11 @@ import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.item.ItemComponent;
|
||||
import net.minestom.server.component.DataComponents;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.component.EnchantmentList;
|
||||
import net.minestom.server.registry.DynamicRegistry;
|
||||
import net.minestom.server.registry.DynamicRegistry.Key;
|
||||
import net.minestom.server.registry.RegistryKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -47,11 +47,10 @@ public class MinestomItemStack implements com.dfsek.terra.api.inventory.ItemStac
|
||||
@Override
|
||||
public ItemMeta getItemMeta() {
|
||||
HashMap<Enchantment, Integer> enchantments = new HashMap<>();
|
||||
EnchantmentList enchantmentList = base.get(ItemComponent.ENCHANTMENTS);
|
||||
EnchantmentList enchantmentList = base.get(DataComponents.ENCHANTMENTS);
|
||||
if(enchantmentList != null) {
|
||||
enchantmentList.enchantments().forEach((enchantmentKey, integer) -> {
|
||||
enchantments.put(
|
||||
new MinestomEnchantment(Objects.requireNonNull(MinecraftServer.getEnchantmentRegistry().get(enchantmentKey))), integer);
|
||||
enchantments.put(new MinestomEnchantment(enchantmentKey), integer);
|
||||
});
|
||||
}
|
||||
return new MinestomItemMeta(enchantments);
|
||||
@@ -59,7 +58,7 @@ public class MinestomItemStack implements com.dfsek.terra.api.inventory.ItemStac
|
||||
|
||||
@Override
|
||||
public void setItemMeta(ItemMeta meta) {
|
||||
HashMap<Key<net.minestom.server.item.enchant.Enchantment>, Integer> enchantments = new HashMap<>();
|
||||
HashMap<RegistryKey<net.minestom.server.item.enchant.Enchantment>, Integer> enchantments = new HashMap<>();
|
||||
DynamicRegistry<net.minestom.server.item.enchant.Enchantment> registry = MinecraftServer.getEnchantmentRegistry();
|
||||
meta.getEnchantments().forEach((key, value) -> {
|
||||
MinestomEnchantment enchantment = (MinestomEnchantment) key;
|
||||
@@ -67,6 +66,6 @@ public class MinestomItemStack implements com.dfsek.terra.api.inventory.ItemStac
|
||||
});
|
||||
|
||||
EnchantmentList list = new EnchantmentList(enchantments);
|
||||
base = base.with(ItemComponent.ENCHANTMENTS, list);
|
||||
base = base.with(DataComponents.ENCHANTMENTS, list);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class MinestomMaterial implements Item {
|
||||
}
|
||||
|
||||
public MinestomMaterial(String id) {
|
||||
this.delegate = Material.fromNamespaceId(id);
|
||||
this.delegate = Material.fromKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-2
@@ -22,9 +22,12 @@ public class TerraMinestomWorldBuilder {
|
||||
private ConfigPack pack;
|
||||
private long seed = new Random().nextLong();
|
||||
private EntityFactory entityFactory = new DefaultEntityFactory();
|
||||
private BlockEntityFactory blockEntityFactory = new DefaultBlockEntityFactory();
|
||||
private BlockEntityFactory blockEntityFactory;
|
||||
|
||||
private TerraMinestomWorldBuilder(Instance instance) { this.instance = instance; }
|
||||
private TerraMinestomWorldBuilder(Instance instance) {
|
||||
this.instance = instance;
|
||||
this.blockEntityFactory = new DefaultBlockEntityFactory(instance);
|
||||
}
|
||||
|
||||
public static TerraMinestomWorldBuilder from(Instance instance) {
|
||||
return new TerraMinestomWorldBuilder(instance);
|
||||
|
||||
@@ -90,7 +90,7 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
.registerLoader(MusicSound.class, MusicSoundTemplate::new)
|
||||
.registerLoader(EntityType.class, EntityTypeTemplate::new)
|
||||
.registerLoader(SpawnCostConfig.class, SpawnCostConfig::new)
|
||||
.registerLoader(SpawnEntry.class, SpawnEntryConfig::new)
|
||||
.registerLoader(SpawnEntryConfig.class, SpawnEntryConfig::new)
|
||||
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
|
||||
.registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new)
|
||||
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
||||
|
||||
+6
-4
@@ -10,6 +10,8 @@ import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.world.biome.BiomeParticleConfig;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticleConfig> {
|
||||
@Value("particle")
|
||||
@@ -18,19 +20,19 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticle
|
||||
|
||||
@Value("probability")
|
||||
@Default
|
||||
private Integer probability = null;
|
||||
private Float probability = 0.1f;
|
||||
|
||||
@Override
|
||||
public BiomeParticleConfig get() {
|
||||
if(particle == null || probability == null) {
|
||||
if(particle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new BiomeParticleConfig(
|
||||
ParticleEffectArgumentType.readParameters(new StringReader(particle),
|
||||
(RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE),
|
||||
probability);
|
||||
RegistryWrapper.WrapperLookup.of(Stream.of(Registries.PARTICLE_TYPE))),
|
||||
probability);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
+7
-3
@@ -7,7 +7,7 @@ import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
|
||||
|
||||
public class SpawnEntryConfig implements ObjectTemplate<SpawnEntry> {
|
||||
public class SpawnEntryConfig implements ObjectTemplate<SpawnEntryConfig> {
|
||||
@Value("type")
|
||||
@Default
|
||||
private EntityType<?> type = null;
|
||||
@@ -28,8 +28,12 @@ public class SpawnEntryConfig implements ObjectTemplate<SpawnEntry> {
|
||||
return weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpawnEntry get() {
|
||||
public SpawnEntry getSpawnEntry() {
|
||||
return new SpawnEntry(type, minGroupSize, maxGroupSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpawnEntryConfig get() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ public class SpawnSettingsTemplate implements ObjectTemplate<SpawnSettings> {
|
||||
SpawnSettings.Builder builder = new SpawnSettings.Builder();
|
||||
for(SpawnTypeConfig spawn : spawns) {
|
||||
SpawnGroup group = spawn.getGroup();
|
||||
for(SpawnEntryConfig entry : spawn.getEntry()) {
|
||||
builder.spawn(group, entry.getWeight(), entry.get());
|
||||
for(SpawnEntryConfig entry : spawn.getEntries()) {
|
||||
builder.spawn(group, entry.getWeight(), entry.getSpawnEntry());
|
||||
}
|
||||
}
|
||||
for(SpawnCostConfig cost : costs) {
|
||||
|
||||
+3
-3
@@ -15,14 +15,14 @@ public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
|
||||
|
||||
@Value("entries")
|
||||
@Default
|
||||
private List<SpawnEntryConfig> entry = null;
|
||||
private List<SpawnEntryConfig> entries = null;
|
||||
|
||||
public SpawnGroup getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public List<SpawnEntryConfig> getEntry() {
|
||||
return entry;
|
||||
public List<SpawnEntryConfig> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -13,10 +13,10 @@ import net.minecraft.village.VillagerType;
|
||||
public class VillagerTypeTemplate implements ObjectTemplate<RegistryKey<VillagerType>> {
|
||||
@Value("id")
|
||||
@Default
|
||||
private String id = null;
|
||||
private Identifier id = null;
|
||||
|
||||
@Override
|
||||
public RegistryKey<VillagerType> get() {
|
||||
return RegistryKey.of(RegistryKeys.VILLAGER_TYPE, Identifier.ofVanilla(id));
|
||||
return RegistryKey.of(RegistryKeys.VILLAGER_TYPE, id);
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -19,8 +19,6 @@ import java.net.Proxy;
|
||||
|
||||
import com.dfsek.terra.lifecycle.LifecyclePlatform;
|
||||
|
||||
import static com.dfsek.terra.lifecycle.util.LifecycleUtil.initialized;
|
||||
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
public class MinecraftServerMixin {
|
||||
|
||||
-2
@@ -49,8 +49,6 @@ import com.dfsek.terra.lifecycle.LifecyclePlatform;
|
||||
import com.dfsek.terra.lifecycle.util.LifecycleUtil;
|
||||
import com.dfsek.terra.lifecycle.util.RegistryHack;
|
||||
|
||||
import static com.dfsek.terra.lifecycle.util.LifecycleUtil.initialized;
|
||||
|
||||
|
||||
@Mixin(RegistryLoader.class)
|
||||
public class RegistryLoaderMixin {
|
||||
|
||||
-2
@@ -12,8 +12,6 @@ import com.dfsek.terra.mod.CommonPlatform;
|
||||
|
||||
|
||||
public final class LifecycleUtil {
|
||||
public static boolean initialized = false;
|
||||
|
||||
private LifecycleUtil() {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user