mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-03 06:16:10 +00:00
fix issues with spawners and entity parsing
This commit is contained in:
@@ -61,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 preform 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);
|
||||
|
||||
|
||||
@@ -64,6 +64,14 @@ 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 preform 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);
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user