Merge remote-tracking branch 'origin/master'

This commit is contained in:
Zoë Gidiere
2025-10-05 20:24:25 -06:00
15 changed files with 53 additions and 3673 deletions

View File

@@ -57,15 +57,6 @@ fun Project.configureDependencies() {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "Sonatype Snapshots"
}
maven("https://repo.opencollab.dev/maven-releases/") {
name = "OpenCollab Releases"
}
maven("https://repo.opencollab.dev/maven-snapshots/") {
name = "OpenCollab Snapshots"
}
maven("https://storehouse.okaeri.eu/repository/maven-public/") {
name = "Okaeri"
}
maven("https://repo.onarandombox.com/multiverse-releases") {
name = "onarandombox"
}

View File

@@ -86,10 +86,13 @@ object Versions {
}
object Allay {
const val api = "0.4.1"
const val api = "0.12.0"
const val gson = "2.13.1"
const val mappings = "3626653"
const val mappingsGenerator = "366618e"
const val mappings = "8002ed6"
const val mappingsGenerator = "fd83f41"
const val mcmeta = "b758592"
}
object Minestom {

View File

@@ -2,8 +2,8 @@
## Resource files
Current mapping version: je 1.21.4 to be 1.21.50
Current mapping version: je 1.21.7 to be 1.21.93
- `mapping/biomes.json` and `mapping/items.json` obtain from [GeyserMC/mappings](https://github.com/GeyserMC/mappings).
- `mapping/blocks.json` generated by using [GeyserMC/mappings-generator](https://github.com/GeyserMC/mappings-generator), and it's origin name is `generator_blocks.json`.
- `je_block_default_states.json` converted from [Block state values](https://zh.minecraft.wiki/w/Module:Block_state_values).
- `mapping/biomes.json` and `mapping/items.json` are obtained from [GeyserMC/mappings](https://github.com/GeyserMC/mappings).
- `mapping/blocks.json` is obtained from [GeyserMC/mappings-generator](https://github.com/GeyserMC/mappings-generator) (path: `https://github.com/GeyserMC/mappings-generator/blob/master/new_generator_blocks.json`).
- `je_blocks.json` is obtained from [misode/mcmeta](https://github.com/misode/mcmeta) (path: `https://github.com/misode/mcmeta/blob/<version>-summary/blocks/data.json`).

View File

@@ -15,6 +15,10 @@ val geyserMappings: Configuration by configurations.register("geyserMappings") {
isCanBeConsumed = false
}
val mcmeta: Configuration by configurations.register("mcmeta") {
isCanBeConsumed = false
}
dependencies {
shadedApi(project(":common:implementation:base"))
@@ -24,7 +28,9 @@ dependencies {
geyserMappings("GeyserMC.mappings", "items", Versions.Allay.mappings, ext = "json")
geyserMappings("GeyserMC.mappings", "biomes", Versions.Allay.mappings, ext = "json")
geyserMappings("GeyserMC.mappings-generator", "generator_blocks", Versions.Allay.mappingsGenerator, ext = "json")
geyserMappings("GeyserMC.mappings-generator", "new_generator_blocks", Versions.Allay.mappingsGenerator, ext = "json")
mcmeta("misode.mcmeta", "blocks/data", Versions.Allay.mcmeta, ext ="json")
}
tasks.processResources {
@@ -32,6 +38,9 @@ tasks.processResources {
into("mapping")
// rather jank, but whatever
rename("(?:generator_)?([^-]+)-(.*)\\.json", "$1.json")
rename("(?:new_generator_)?([^-]+)-(.*)\\.json", "$1.json")
}
from(mcmeta) {
rename("data-(.*)\\.json", "je_blocks.json")
}
}

View File

@@ -3,8 +3,8 @@ package com.dfsek.terra.allay;
import com.dfsek.tectonic.api.TypeRegistry;
import com.dfsek.tectonic.api.depth.DepthTracker;
import com.dfsek.tectonic.api.exception.LoadException;
import org.allaymc.api.registry.Registries;
import org.allaymc.api.server.Server;
import org.allaymc.api.world.biome.BiomeId;
import org.jetbrains.annotations.NotNull;
import java.io.File;
@@ -89,6 +89,6 @@ public class AllayPlatform extends AbstractPlatform {
protected AllayBiome parseBiome(String id, DepthTracker depthTracker) throws LoadException {
if(!id.startsWith("minecraft:")) throw new LoadException("Invalid biome identifier " + id, depthTracker);
return new AllayBiome(BiomeId.fromId(Mapping.biomeIdJeToBe(id)));
return new AllayBiome(Registries.BIOMES.getByK1(Mapping.biomeIdJeToBe(id)));
}
}

View File

@@ -1,6 +1,6 @@
package com.dfsek.terra.allay;
import org.allaymc.api.utils.HashUtils;
import org.allaymc.api.utils.hash.HashUtils;
import java.util.Map;
import java.util.TreeMap;

View File

@@ -8,19 +8,17 @@ import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.allaymc.api.block.type.BlockState;
import org.allaymc.api.block.type.BlockStateSafeGetter;
import org.allaymc.api.block.type.BlockStateGetter;
import org.allaymc.api.block.type.BlockTypes;
import org.allaymc.api.item.type.ItemType;
import org.allaymc.api.item.type.ItemTypeSafeGetter;
import org.allaymc.api.item.type.ItemTypeGetter;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -37,11 +35,11 @@ public final class Mapping {
.registerTypeAdapterFactory(new IgnoreFailureTypeAdapterFactory())
.create();
private static final Map<String, Map<String, String>> JE_BLOCK_DEFAULT_PROPERTIES = new Object2ObjectOpenHashMap<>();
private static final Map<BlockState, JeBlockState> BE_BLOCK_STATE_TO_JE = new Object2ObjectOpenHashMap<>();
private static final Map<Integer, BlockState> JE_BLOCK_STATE_HASH_TO_BE = new Int2ObjectOpenHashMap<>();
private static final Map<String, ItemType<?>> JE_ITEM_ID_TO_BE = new Object2ObjectOpenHashMap<>();
private static final Map<String, Integer> JE_BIOME_ID_TO_BE = new Object2IntOpenHashMap<>();
private static final Map<String, Map<String, String>> JE_BLOCK_DEFAULT_PROPERTIES = new HashMap<>();
private static final Map<BlockState, JeBlockState> BE_BLOCK_STATE_TO_JE = new HashMap<>();
private static final Map<Integer, BlockState> JE_BLOCK_STATE_HASH_TO_BE = new HashMap<>();
private static final Map<String, ItemType<?>> JE_ITEM_ID_TO_BE = new HashMap<>();
private static final Map<String, Integer> JE_BIOME_ID_TO_BE = new HashMap<>();
private static final BlockState BE_AIR_STATE = BlockTypes.AIR.getDefaultState();
@@ -104,8 +102,7 @@ public final class Mapping {
return false;
}
Map<String, BiomeMapping> mappings = from(stream, new TypeToken<>() {
});
Map<String, BiomeMapping> mappings = from(stream, new TypeToken<>() {});
mappings.forEach((javaId, mapping) -> JE_BIOME_ID_TO_BE.put(javaId, mapping.bedrockId()));
} catch(IOException e) {
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load biomes mapping", e);
@@ -121,10 +118,9 @@ public final class Mapping {
return false;
}
Map<String, ItemMapping> mappings = from(stream, new TypeToken<>() {
});
Map<String, ItemMapping> mappings = from(stream, new TypeToken<>() {});
mappings.forEach((javaId, mapping) -> {
ItemType<?> itemType = ItemTypeSafeGetter
ItemType<?> itemType = ItemTypeGetter
.name(mapping.bedrockId())
.meta(mapping.bedrockData())
.itemType();
@@ -144,8 +140,7 @@ public final class Mapping {
return false;
}
Map<String, List<BlockMapping>> root = from(stream, new TypeToken<>() {
});
Map<String, List<BlockMapping>> root = from(stream, new TypeToken<>() {});
List<BlockMapping> mappings = root.get("mappings");
mappings.forEach(mapping -> {
JeBlockState jeState = createJeBlockState(mapping.javaState());
@@ -160,16 +155,21 @@ public final class Mapping {
return true;
}
@SuppressWarnings("unchecked")
private static boolean initJeBlockDefaultProperties() {
try(InputStream stream = Mapping.class.getClassLoader().getResourceAsStream("je_block_default_states.json")) {
try(InputStream stream = Mapping.class.getClassLoader().getResourceAsStream("je_blocks.json")) {
if(stream == null) {
TerraAllayPlugin.INSTANCE.getPluginLogger().error("je_block_default_states.json not found");
return false;
}
Map<String, Map<String, String>> states = from(stream, new TypeToken<>() {
});
JE_BLOCK_DEFAULT_PROPERTIES.putAll(states);
Map<String, List<Map<String, ?>>> data = from(stream, new TypeToken<>() {});
for(var entry : data.entrySet()) {
JE_BLOCK_DEFAULT_PROPERTIES.put(
"minecraft:" + entry.getKey(),
(Map<String, String>) entry.getValue().get(1)
);
}
} catch(IOException e) {
throw new RuntimeException(e);
}
@@ -182,7 +182,7 @@ public final class Mapping {
}
private static BlockState createBeBlockState(BlockMapping.BedrockState state) {
BlockStateSafeGetter.Getter getter = BlockStateSafeGetter.name("minecraft:" + state.bedrockId());
BlockStateGetter.Getter getter = BlockStateGetter.name("minecraft:" + state.bedrockId());
if(state.state() != null) {
convertValueType(state.state()).forEach(getter::property);
}
@@ -249,7 +249,6 @@ public final class Mapping {
}
}
// see https://stackoverflow.com/questions/59655279/is-there-an-easy-way-to-make-gson-skip-a-field-if-theres-an-error-deserializing
public static class IgnoreFailureTypeAdapterFactory implements TypeAdapterFactory {
@Override

View File

@@ -1,6 +1,6 @@
package com.dfsek.terra.allay.delegate;
import org.allaymc.api.block.tag.BlockTags;
import org.allaymc.api.block.data.BlockTags;
import org.allaymc.api.block.type.BlockType;
import com.dfsek.terra.allay.Mapping;

View File

@@ -1,7 +1,7 @@
package com.dfsek.terra.allay.delegate;
import org.allaymc.api.block.data.BlockTags;
import org.allaymc.api.block.property.type.BlockPropertyTypes;
import org.allaymc.api.block.tag.BlockTags;
import org.allaymc.api.block.type.BlockTypes;
import org.allaymc.api.world.chunk.Chunk;
import org.jetbrains.annotations.NotNull;

View File

@@ -1,7 +1,7 @@
package com.dfsek.terra.allay.delegate;
import org.allaymc.api.block.property.type.BlockPropertyTypes;
import org.allaymc.api.block.tag.BlockTags;
import org.allaymc.api.block.data.BlockTags;
import org.allaymc.api.block.type.BlockTypes;
import org.allaymc.api.world.chunk.UnsafeChunk;
import org.jetbrains.annotations.NotNull;

View File

@@ -2,7 +2,7 @@ package com.dfsek.terra.allay.delegate;
import com.dfsek.seismic.type.vector.Vector3;
import org.allaymc.api.block.property.type.BlockPropertyTypes;
import org.allaymc.api.block.tag.BlockTags;
import org.allaymc.api.block.data.BlockTags;
import org.allaymc.api.block.type.BlockTypes;
import org.allaymc.api.world.generator.context.OtherChunkAccessibleContext;

View File

@@ -22,7 +22,7 @@ import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
public record AllayServerWorld(AllayGeneratorWrapper allayGeneratorWrapper, Dimension allayDimension) implements ServerWorld {
@Override
public Chunk getChunkAt(int x, int z) {
return new AllayChunk(this, allayDimension.getChunkService().getChunk(x, z));
return new AllayChunk(this, allayDimension.getChunkManager().getChunk(x, z));
}
@Override

View File

@@ -152,11 +152,6 @@ public class AllayGeneratorWrapper implements GeneratorWrapper {
}
return true;
}
@Override
public String getName() {
return "TERRA_NOISER";
}
}
@@ -174,10 +169,5 @@ public class AllayGeneratorWrapper implements GeneratorWrapper {
}
return true;
}
@Override
public String getName() {
return "TERRA_POPULATOR";
}
}
}

View File

@@ -1,7 +1,6 @@
package com.dfsek.terra.allay.handle;
import org.allaymc.api.registry.Registries;
import org.allaymc.api.utils.Identifier;
import java.util.Set;
import java.util.stream.Collectors;
@@ -13,6 +12,8 @@ import com.dfsek.terra.api.handle.ItemHandle;
import com.dfsek.terra.api.inventory.Item;
import com.dfsek.terra.api.inventory.item.Enchantment;
import org.allaymc.api.utils.identifier.Identifier;
/**
* @author daoge_cmd

File diff suppressed because it is too large Load Diff