Compare commits

...

11 Commits

Author SHA1 Message Date
Zoë Gidiere 3745c3e947 fix typos 2023-12-17 15:32:35 -07:00
Zoë Gidiere fd20837b55 fix error on startup 2023-12-17 15:29:18 -07:00
Zoë Gidiere 0091e5b785 spell check 2023-12-10 18:50:40 -07:00
Zoë Gidiere 41045ae8aa literally forgor the most important part 2023-12-10 18:47:12 -07:00
Zoë Gidiere 4a83f01c1f fix incase mods are used 2023-12-10 18:44:26 -07:00
Zoë Gidiere fc764a0fb3 fix issues with spawners and entity parsing 2023-12-10 18:40:43 -07:00
Zoë Gidiere 22c46f2f80 Pin OWConfig Version 2023-12-10 17:45:52 -07:00
Zoë Gidiere f408faaa80 reformat 2023-12-10 17:07:18 -07:00
Zoë Gidiere 0ad7ee4f9f fix CME 2023-12-10 16:57:27 -07:00
Zoë Gidiere 1e55074cfa Enforce NMS bindings 2023-12-10 15:46:00 -07:00
Zoë 2a92d76276 Merge pull request #437 from PolyhedralDev/dev/1.20.3
Dev/1.20.3
2023-12-09 15:13:11 -07:00
8 changed files with 60 additions and 23 deletions
@@ -27,7 +27,7 @@ fun Project.configureDistribution() {
group = "terra"
doFirst {
file("${buildDir}/resources/main/packs/").deleteRecursively()
val defaultPackUrl = URL("https://github.com/PolyhedralDev/TerraOverworldConfig/releases/download/latest/default.zip")
val defaultPackUrl = URL("https://github.com/PolyhedralDev/TerraOverworldConfig/releases/download/" + Versions.Terra.overworldConfig + "/default.zip")
downloadPack(defaultPackUrl, project)
}
}
+5 -1
View File
@@ -1,4 +1,8 @@
object Versions {
object Terra {
const val overworldConfig = "v1.3.4"
}
object Libraries {
const val tectonic = "4.2.1"
const val paralithic = "0.7.1"
@@ -41,7 +45,7 @@ object Versions {
const val architecuryLoom = "1.4.369"
const val architecturyPlugin = "3.4.151"
}
}
//
// object Forge {
// const val forge = "${Mod.minecraft}-48.0.13"
@@ -10,8 +10,8 @@ package com.dfsek.terra.addons.terrascript.script.functions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
@@ -32,7 +32,7 @@ public class BlockFunction implements Function<Void> {
protected final Returnable<Number> x, y, z;
protected final Returnable<String> blockData;
protected final Platform platform;
private final Map<String, BlockState> data = new HashMap<>();
private final Map<String, BlockState> data = new ConcurrentHashMap<>();
private final Returnable<Boolean> overwrite;
private final Returnable<Boolean> physics;
private final Position position;
@@ -65,6 +65,10 @@ public class TerraBukkitPlugin extends JavaPlugin {
platform.getEventManager().callEvent(new PlatformInitializationEvent());
if(!Initializer.init(platform)) {
Bukkit.getPluginManager().disablePlugin(this);
return;
}
try {
PaperCommandManager<CommandSender> commandManager = getCommandSenderPaperCommandManager();
@@ -84,8 +88,6 @@ public class TerraBukkitPlugin extends JavaPlugin {
Bukkit.getPluginManager().registerEvents(new CommonListener(), this); // Register master event listener
PaperUtil.checkPaper(this);
Initializer.init(platform);
}
@NotNull
@@ -20,6 +20,8 @@ package com.dfsek.terra.bukkit.handles;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Locale;
@@ -29,14 +31,10 @@ import com.dfsek.terra.api.handle.WorldHandle;
import com.dfsek.terra.bukkit.world.block.data.BukkitBlockState;
import com.dfsek.terra.bukkit.world.entity.BukkitEntityType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BukkitWorldHandle implements WorldHandle {
private final BlockState air;
private static final Logger logger = LoggerFactory.getLogger(BukkitWorldHandle.class);
private final BlockState air;
public BukkitWorldHandle() {
this.air = BukkitBlockState.newInstance(Material.AIR.createBlockData());
@@ -48,7 +46,7 @@ public class BukkitWorldHandle implements WorldHandle {
data = "minecraft:short_grass";
logger.warn(
"Translating minecraft:grass to minecraft:short_grass. In 1.20.3 minecraft:grass was renamed to minecraft:short_grass" +
". You are advised to preform this rename in your config backs as this translation will be removed in the next major " +
". You are advised to perform this rename in your config backs as this translation will be removed in the next major " +
"version of Terra.");
}
org.bukkit.block.data.BlockData bukkitData = Bukkit.createBlockData(
@@ -63,6 +61,13 @@ public class BukkitWorldHandle implements WorldHandle {
@Override
public @NotNull EntityType getEntity(@NotNull String id) {
if (!id.contains(":")) { //TODO: remove in 7.0
String newid = "minecraft:" + id.toLowerCase();;
logger.warn(
"Translating " + id + " to " + newid + ". In 1.20.3 entity parsing was reworked" +
". You are advised to perform this rename in your config backs as this translation will be removed in the next major " +
"version of Terra.");
}
if(!id.startsWith("minecraft:")) throw new IllegalArgumentException("Invalid entity identifier " + id);
String entityID = id.toUpperCase(Locale.ROOT).substring(10);
@@ -11,7 +11,7 @@ public interface Initializer {
String NMS = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
String TERRA_PACKAGE = Initializer.class.getPackageName();
static void init(PlatformImpl platform) {
static boolean init(PlatformImpl platform) {
Logger logger = LoggerFactory.getLogger(Initializer.class);
try {
Class<?> initializerClass = Class.forName(TERRA_PACKAGE + "." + NMS + ".NMSInitializer");
@@ -24,16 +24,27 @@ public interface Initializer {
} catch(ClassNotFoundException e) {
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.");
logger.error("");
logger.error("");
for(int i = 0; i < 20; i++) {
logger.error("PROCEEDING WITH AN EXISTING TERRA WORLD WILL RESULT IN CORRUPTION!!!");
String bypassKey = "IKnowThereAreNoNMSBindingsFor" + NMS + "ButIWillProceedAnyway";
if(System.getProperty(bypassKey) == null) {
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;
} else {
logger.error("");
logger.error("");
for(int i = 0; i < 20; i++) {
logger.error("PROCEEDING WITH AN EXISTING TERRA WORLD WILL RESULT IN CORRUPTION!!!");
}
logger.error("");
logger.error("");
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.");
logger.error("We will not give you any support for issues that may arise.");
logger.error("Since you enabled the \"{}\" flag, we won't disable Terra. But be warned.", bypassKey);
}
logger.error("");
logger.error("");
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.");
}
return true;
}
void initialize(PlatformImpl plugin);
@@ -45,7 +45,7 @@ public class MinecraftWorldHandle implements WorldHandle {
data = "minecraft:short_grass";
logger.warn(
"Translating minecraft:grass to minecraft:short_grass. In 1.20.3 minecraft:grass was renamed to minecraft:short_grass" +
". You are advised to preform this rename in your config backs as this translation will be removed in the next major " +
". You are advised to perform this rename in your config packs as this translation will be removed in the next major " +
"version of Terra.");
}
net.minecraft.block.BlockState state = BlockArgumentParser.block(Registries.BLOCK.getReadOnlyWrapper(), data, true)
@@ -64,6 +64,15 @@ public class MinecraftWorldHandle implements WorldHandle {
@Override
public @NotNull EntityType getEntity(@NotNull String id) {
if (!id.contains(":")) { //TODO: remove in 7.0
String newid = "minecraft:" + id.toLowerCase();;
logger.warn(
"Translating " + id + " to " + newid + ". In 1.20.3 entity parsing was reworked" +
". You are advised to perform this rename in your config packs as this translation will be removed in the next major " +
"version of Terra.");
id = newid;
}
if(!id.contains(":")) throw new IllegalArgumentException("Invalid entity identifier " + id);
Identifier identifier = Identifier.tryParse(id);
if(identifier == null) identifier = Identifier.tryParse(id);
return (EntityType) Registries.ENTITY_TYPE.get(identifier);
@@ -58,7 +58,13 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
}
public void terra$setSpawnedType(@NotNull EntityType creatureType) {
method_46408((net.minecraft.entity.EntityType<?>) creatureType, world.getRandom());
Random rand;
if (hasWorld()) {
rand = world.getRandom();
} else {
rand = Random.create();
}
method_46408((net.minecraft.entity.EntityType<?>) creatureType, rand);
}
public int terra$getDelay() {