mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-01 15:37:24 +00:00
Merge branch 'dev/7.0-2' into dev/seismic
This commit is contained in:
commit
ef10081bcd
@ -17,8 +17,8 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
//TODO Allow pulling from Versions.kt
|
//TODO Allow pulling from Versions.kt
|
||||||
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.1")
|
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.1")
|
||||||
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.2")
|
|
||||||
|
|
||||||
|
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "2.0.0-beta.16")
|
||||||
implementation("org.ow2.asm", "asm", "9.7")
|
implementation("org.ow2.asm", "asm", "9.7")
|
||||||
implementation("org.ow2.asm", "asm-tree", "9.7")
|
implementation("org.ow2.asm", "asm-tree", "9.7")
|
||||||
implementation("com.dfsek.tectonic", "common", "4.2.1")
|
implementation("com.dfsek.tectonic", "common", "4.2.1")
|
||||||
|
@ -45,8 +45,8 @@ object Versions {
|
|||||||
const val yarn = "$minecraft+build.8"
|
const val yarn = "$minecraft+build.8"
|
||||||
const val fabricLoader = "0.16.10"
|
const val fabricLoader = "0.16.10"
|
||||||
|
|
||||||
const val architecuryLoom = "1.7.413"
|
const val architecuryLoom = "1.9.428"
|
||||||
const val architecturyPlugin = "3.4.159"
|
const val architecturyPlugin = "3.4.161"
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -57,13 +57,13 @@ object Versions {
|
|||||||
|
|
||||||
object Bukkit {
|
object Bukkit {
|
||||||
const val minecraft = "1.21.4"
|
const val minecraft = "1.21.4"
|
||||||
const val paperBuild = "$minecraft-R0.1-20241211.212446-17"
|
const val paperBuild = "$minecraft-R0.1-20250317.101324-208"
|
||||||
const val paper = paperBuild
|
const val paper = paperBuild
|
||||||
const val paperLib = "1.0.8"
|
const val paperLib = "1.0.8"
|
||||||
const val reflectionRemapper = "0.1.1"
|
const val reflectionRemapper = "0.1.1"
|
||||||
const val paperDevBundle = paperBuild
|
const val paperDevBundle = paperBuild
|
||||||
const val runPaper = "2.3.1"
|
const val runPaper = "2.3.1"
|
||||||
const val paperWeight = "1.7.2"
|
const val paperWeight = "2.0.0-beta.16"
|
||||||
const val cloud = "2.0.0-beta.10"
|
const val cloud = "2.0.0-beta.10"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,10 @@ object Versions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object Allay {
|
object Allay {
|
||||||
const val api = "0.1.3"
|
const val api = "0.2.0"
|
||||||
|
const val gson = "2.12.1"
|
||||||
|
const val mappings = "3626653"
|
||||||
|
const val mappingsGenerator = "366618e"
|
||||||
}
|
}
|
||||||
|
|
||||||
object Minestom {
|
object Minestom {
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,7 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
|
distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
Current mapping version: je 1.21.4 to be 1.21.50
|
Current mapping version: je 1.21.4 to be 1.21.50
|
||||||
|
|
||||||
- `mapping/biomes.json` obtain from GeyserMC/mappings.
|
- `mapping/biomes.json` and `mapping/items.json` obtain from [GeyserMC/mappings](https://github.com/GeyserMC/mappings).
|
||||||
- `mapping/items.json` obtain from 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`.
|
||||||
- `mapping/blocks.json` generated by using 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).
|
||||||
- `je_block_default_states.json` converted from https://zh.minecraft.wiki/w/Module:Block_state_values.
|
|
||||||
|
@ -1,5 +1,37 @@
|
|||||||
|
repositories {
|
||||||
|
ivy {
|
||||||
|
url = uri("https://raw.githubusercontent.com/")
|
||||||
|
patternLayout {
|
||||||
|
artifact("[organisation]/[revision]/[artifact].([ext])")
|
||||||
|
setM2compatible(true)
|
||||||
|
}
|
||||||
|
metadataSources {
|
||||||
|
artifact()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val geyserMappings: Configuration by configurations.register("geyserMappings") {
|
||||||
|
isCanBeConsumed = false
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
shadedApi(project(":common:implementation:base"))
|
shadedApi(project(":common:implementation:base"))
|
||||||
|
|
||||||
|
implementation("com.google.code.gson", "gson", Versions.Allay.gson)
|
||||||
|
|
||||||
compileOnly("org.allaymc.allay", "api", Versions.Allay.api)
|
compileOnly("org.allaymc.allay", "api", Versions.Allay.api)
|
||||||
}
|
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.processResources {
|
||||||
|
from(geyserMappings) {
|
||||||
|
into("mapping")
|
||||||
|
|
||||||
|
// rather jank, but whatever
|
||||||
|
rename("(?:generator_)?([^-]+)-(.*)\\.json", "$1.json")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,36 +1,48 @@
|
|||||||
package com.dfsek.terra.allay;
|
package com.dfsek.terra.allay;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.TypeAdapterFactory;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
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.ints.Int2ObjectOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
import org.allaymc.api.block.type.BlockState;
|
import org.allaymc.api.block.type.BlockState;
|
||||||
import org.allaymc.api.block.type.BlockStateSafeGetter;
|
import org.allaymc.api.block.type.BlockStateSafeGetter;
|
||||||
import org.allaymc.api.block.type.BlockStateSafeGetter.Getter;
|
|
||||||
import org.allaymc.api.block.type.BlockTypes;
|
import org.allaymc.api.block.type.BlockTypes;
|
||||||
import org.allaymc.api.item.type.ItemType;
|
import org.allaymc.api.item.type.ItemType;
|
||||||
import org.allaymc.api.item.type.ItemTypeSafeGetter;
|
import org.allaymc.api.item.type.ItemTypeSafeGetter;
|
||||||
import org.allaymc.api.utils.JSONUtils;
|
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Objects;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author daoge_cmd
|
* @author daoge_cmd
|
||||||
|
* @author IWareQ
|
||||||
*/
|
*/
|
||||||
public final class Mapping {
|
public final class Mapping {
|
||||||
|
private static final Gson GSON = new GsonBuilder()
|
||||||
|
.registerTypeAdapterFactory(new IgnoreFailureTypeAdapterFactory())
|
||||||
|
.create();
|
||||||
|
|
||||||
private static final Map<String, Map<String, String>> JE_BLOCK_DEFAULT_PROPERTIES = new Object2ObjectOpenHashMap<>();
|
private static final Map<String, Map<String, String>> JE_BLOCK_DEFAULT_PROPERTIES = new Object2ObjectOpenHashMap<>();
|
||||||
private static final Map<BlockState, JeBlockState> BLOCK_STATE_BE_TO_JE = new Object2ObjectOpenHashMap<>();
|
private static final Map<BlockState, JeBlockState> BE_BLOCK_STATE_TO_JE = new Object2ObjectOpenHashMap<>();
|
||||||
private static final Map<Integer, BlockState> BLOCK_STATE_JE_HASH_TO_BE = new Int2ObjectOpenHashMap<>();
|
private static final Map<Integer, BlockState> JE_BLOCK_STATE_HASH_TO_BE = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Map<String, ItemType<?>> ITEM_ID_JE_TO_BE = new Object2ObjectOpenHashMap<>();
|
private static final Map<String, ItemType<?>> JE_ITEM_ID_TO_BE = new Object2ObjectOpenHashMap<>();
|
||||||
private static final Map<String, Integer> BIOME_ID_JE_TO_BE = new Object2IntOpenHashMap<>();
|
private static final Map<String, Integer> JE_BIOME_ID_TO_BE = new Object2IntOpenHashMap<>();
|
||||||
|
|
||||||
private static final BlockState BE_AIR_STATE = BlockTypes.AIR.getDefaultState();
|
private static final BlockState BE_AIR_STATE = BlockTypes.AIR.getDefaultState();
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
@ -41,11 +53,11 @@ public final class Mapping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JeBlockState blockStateBeToJe(BlockState beBlockState) {
|
public static JeBlockState blockStateBeToJe(BlockState beBlockState) {
|
||||||
return BLOCK_STATE_BE_TO_JE.get(beBlockState);
|
return BE_BLOCK_STATE_TO_JE.get(beBlockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockState blockStateJeToBe(JeBlockState jeBlockState) {
|
public static BlockState blockStateJeToBe(JeBlockState jeBlockState) {
|
||||||
BlockState result = BLOCK_STATE_JE_HASH_TO_BE.get(jeBlockState.getHash());
|
BlockState result = JE_BLOCK_STATE_HASH_TO_BE.get(jeBlockState.getHash());
|
||||||
if(result == null) {
|
if(result == null) {
|
||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().warn("Failed to find be block state for {}", jeBlockState);
|
TerraAllayPlugin.INSTANCE.getPluginLogger().warn("Failed to find be block state for {}", jeBlockState);
|
||||||
return BE_AIR_STATE;
|
return BE_AIR_STATE;
|
||||||
@ -54,7 +66,7 @@ public final class Mapping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemType<?> itemIdJeToBe(String jeItemId) {
|
public static ItemType<?> itemIdJeToBe(String jeItemId) {
|
||||||
return ITEM_ID_JE_TO_BE.get(jeItemId);
|
return JE_ITEM_ID_TO_BE.get(jeItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enchantment identifiers are same in both versions
|
// Enchantment identifiers are same in both versions
|
||||||
@ -68,15 +80,16 @@ public final class Mapping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int biomeIdJeToBe(String jeBiomeId) {
|
public static int biomeIdJeToBe(String jeBiomeId) {
|
||||||
return BIOME_ID_JE_TO_BE.get(jeBiomeId);
|
return JE_BIOME_ID_TO_BE.get(jeBiomeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> getJeBlockDefaultProperties(String jeBlockIdentifier) {
|
public static Map<String, String> getJeBlockDefaultProperties(String jeBlockIdentifier) {
|
||||||
Map<String, String> defaultProperties = JE_BLOCK_DEFAULT_PROPERTIES.get(jeBlockIdentifier);
|
var defaultProperties = JE_BLOCK_DEFAULT_PROPERTIES.get(jeBlockIdentifier);
|
||||||
if(defaultProperties == null) {
|
if(defaultProperties == null) {
|
||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().warn("Failed to find default properties for {}", jeBlockIdentifier);
|
TerraAllayPlugin.INSTANCE.getPluginLogger().warn("Failed to find default properties for {}", jeBlockIdentifier);
|
||||||
return Map.of();
|
return Map.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultProperties;
|
return defaultProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,8 +103,9 @@ public final class Mapping {
|
|||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("biomes mapping not found");
|
TerraAllayPlugin.INSTANCE.getPluginLogger().error("biomes mapping not found");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Entry<String, Map<String, Integer>>> mappings = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, Integer>>>(){}).entrySet();
|
|
||||||
mappings.forEach(mapping -> BIOME_ID_JE_TO_BE.put(mapping.getKey(), mapping.getValue().get("bedrock_id")));
|
Map<String, BiomeMapping> mappings = from(stream, new TypeToken<>() {});
|
||||||
|
mappings.forEach((javaId, mapping) -> JE_BIOME_ID_TO_BE.put(javaId, mapping.bedrockId()));
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load biomes mapping", e);
|
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load biomes mapping", e);
|
||||||
return false;
|
return false;
|
||||||
@ -105,17 +119,18 @@ public final class Mapping {
|
|||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("items mapping not found");
|
TerraAllayPlugin.INSTANCE.getPluginLogger().error("items mapping not found");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Entry<String, Map<String, Object>>> mappings = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, Object>>>() {}).entrySet();
|
|
||||||
mappings.forEach(mapping -> {
|
Map<String, ItemMapping> mappings = from(stream, new TypeToken<>() {});
|
||||||
ItemType<?> item = ItemTypeSafeGetter
|
mappings.forEach((javaId, mapping) -> {
|
||||||
.name((String) mapping.getValue().get("bedrock_identifier"))
|
ItemType<?> itemType = ItemTypeSafeGetter
|
||||||
// NOTICE: should be cast to double
|
.name(mapping.bedrockId())
|
||||||
.meta(((Double) mapping.getValue().get("bedrock_data")).intValue())
|
.meta(mapping.bedrockData())
|
||||||
.itemType();
|
.itemType();
|
||||||
ITEM_ID_JE_TO_BE.put(mapping.getKey(), item);
|
JE_ITEM_ID_TO_BE.put(javaId, itemType);
|
||||||
});
|
});
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load items mapping", e);
|
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load items mapping", e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -126,16 +141,18 @@ public final class Mapping {
|
|||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("blocks mapping not found");
|
TerraAllayPlugin.INSTANCE.getPluginLogger().error("blocks mapping not found");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// noinspection unchecked
|
|
||||||
List<Map<String, Map<String, Object>>> mappings = (List<Map<String, Map<String, Object>>>) JSONUtils.from(stream, new TypeToken<Map<String, Object>>() {}).get("mappings");
|
Map<String, List<BlockMapping>> root = from(stream, new TypeToken<>() {});
|
||||||
|
List<BlockMapping> mappings = root.get("mappings");
|
||||||
mappings.forEach(mapping -> {
|
mappings.forEach(mapping -> {
|
||||||
JeBlockState jeState = createJeBlockState(mapping.get("java_state"));
|
JeBlockState jeState = createJeBlockState(mapping.javaState());
|
||||||
BlockState beState = createBeBlockState(mapping.get("bedrock_state"));
|
BlockState beState = createBeBlockState(mapping.bedrockState());
|
||||||
BLOCK_STATE_BE_TO_JE.put(beState, jeState);
|
BE_BLOCK_STATE_TO_JE.put(beState, jeState);
|
||||||
BLOCK_STATE_JE_HASH_TO_BE.put(jeState.getHash(), beState);
|
JE_BLOCK_STATE_HASH_TO_BE.put(jeState.getHash(), beState);
|
||||||
});
|
});
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load blocks mapping", e);
|
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load blocks mapping", e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -146,30 +163,30 @@ public final class Mapping {
|
|||||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("je_block_default_states.json not found");
|
TerraAllayPlugin.INSTANCE.getPluginLogger().error("je_block_default_states.json not found");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Map<String, Map<String, String>> states = JSONUtils.from(stream, new TypeToken<>() {});
|
|
||||||
for(Entry<String, Map<String, String>> entry : states.entrySet()) {
|
Map<String, Map<String, String>> states = from(stream, new TypeToken<>() {});
|
||||||
String identifier = entry.getKey();
|
JE_BLOCK_DEFAULT_PROPERTIES.putAll(states);
|
||||||
Map<String, String> properties = entry.getValue();
|
|
||||||
JE_BLOCK_DEFAULT_PROPERTIES.put(identifier, properties);
|
|
||||||
}
|
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BlockState createBeBlockState(Map<String, Object> data) {
|
private static JeBlockState createJeBlockState(BlockMapping.JavaState state) {
|
||||||
Getter getter = BlockStateSafeGetter
|
Map<String, String> properties = state.properties() == null ? Map.of() : state.properties();
|
||||||
.name("minecraft:" + data.get("bedrock_identifier"));
|
return JeBlockState.create(state.name(), new TreeMap<>(properties));
|
||||||
if(data.containsKey("state")) {
|
}
|
||||||
// noinspection unchecked
|
|
||||||
convertValueType((Map<String, Object>) data.get("state")).forEach(getter::property);
|
private static BlockState createBeBlockState(BlockMapping.BedrockState state) {
|
||||||
|
BlockStateSafeGetter.Getter getter = BlockStateSafeGetter.name("minecraft:" + state.bedrockId());
|
||||||
|
if(state.state() != null) {
|
||||||
|
convertValueType(state.state()).forEach(getter::property);
|
||||||
}
|
}
|
||||||
return getter.blockState();
|
return getter.blockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, Object> convertValueType(Map<String, Object> data) {
|
private static Map<String, Object> convertValueType(Map<String, Object> data) {
|
||||||
TreeMap<String, Object> result = new TreeMap<>();
|
Map<String, Object> result = new TreeMap<>();
|
||||||
for(Entry<String, Object> entry : data.entrySet()) {
|
for(Entry<String, Object> entry : data.entrySet()) {
|
||||||
if(entry.getValue() instanceof Number number) {
|
if(entry.getValue() instanceof Number number) {
|
||||||
// Convert double to int because the number in json is double
|
// Convert double to int because the number in json is double
|
||||||
@ -178,11 +195,78 @@ public final class Mapping {
|
|||||||
result.put(entry.getKey(), entry.getValue());
|
result.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static JeBlockState createJeBlockState(Map<String, Object> data) {
|
public static <V> V from(InputStream inputStream, TypeToken<V> typeToken) {
|
||||||
// noinspection unchecked
|
JsonReader reader = new JsonReader(new InputStreamReader(Objects.requireNonNull(inputStream)));
|
||||||
return JeBlockState.create((String) data.get("Name"), new TreeMap<>((Map<String, String>) data.getOrDefault("Properties", Map.of())));
|
return GSON.fromJson(reader, typeToken.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public record BiomeMapping(
|
||||||
|
@SerializedName("bedrock_id")
|
||||||
|
int bedrockId
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public record ItemMapping(
|
||||||
|
@SerializedName("bedrock_identifier")
|
||||||
|
String bedrockId,
|
||||||
|
@SerializedName("bedrock_data")
|
||||||
|
int bedrockData
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public record BlockMapping(
|
||||||
|
@SerializedName("java_state")
|
||||||
|
BlockMapping.JavaState javaState,
|
||||||
|
@SerializedName("bedrock_state")
|
||||||
|
BlockMapping.BedrockState bedrockState
|
||||||
|
) {
|
||||||
|
public record JavaState(
|
||||||
|
@SerializedName("Name")
|
||||||
|
String name,
|
||||||
|
@Nullable
|
||||||
|
@SerializedName("Properties")
|
||||||
|
Map<String, String> properties
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public record BedrockState(
|
||||||
|
@SerializedName("bedrock_identifier")
|
||||||
|
String bedrockId,
|
||||||
|
@Nullable
|
||||||
|
Map<String, Object> state
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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
|
||||||
|
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
||||||
|
TypeAdapter<T> delegate = gson.getDelegateAdapter(this, typeToken);
|
||||||
|
return new TypeAdapter<>() {
|
||||||
|
@Override
|
||||||
|
public void write(JsonWriter writer, T value) throws IOException {
|
||||||
|
delegate.write(writer, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T read(JsonReader reader) throws IOException {
|
||||||
|
try {
|
||||||
|
return delegate.read(reader);
|
||||||
|
} catch(Exception e) {
|
||||||
|
reader.skipValue();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.dfsek.terra.allay.delegate;
|
package com.dfsek.terra.allay.delegate;
|
||||||
|
|
||||||
import org.allaymc.api.item.data.ItemId;
|
|
||||||
import org.allaymc.api.item.type.ItemType;
|
import org.allaymc.api.item.type.ItemType;
|
||||||
import org.allaymc.api.registry.Registries;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.inventory.Item;
|
import com.dfsek.terra.api.inventory.Item;
|
||||||
|
|
||||||
@ -16,7 +14,7 @@ public final class AllayItemType implements Item {
|
|||||||
|
|
||||||
public AllayItemType(ItemType<?> allayItemType) {
|
public AllayItemType(ItemType<?> allayItemType) {
|
||||||
this.allayItemType = allayItemType;
|
this.allayItemType = allayItemType;
|
||||||
this.maxDurability = Registries.ITEM_DATA.get(ItemId.fromIdentifier(allayItemType.getIdentifier())).maxDamage();
|
this.maxDurability = allayItemType.getItemData().maxDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,197 +0,0 @@
|
|||||||
{
|
|
||||||
"minecraft:badlands": {
|
|
||||||
"bedrock_id": 37
|
|
||||||
},
|
|
||||||
"minecraft:bamboo_jungle": {
|
|
||||||
"bedrock_id": 48
|
|
||||||
},
|
|
||||||
"minecraft:basalt_deltas": {
|
|
||||||
"bedrock_id": 181
|
|
||||||
},
|
|
||||||
"minecraft:beach": {
|
|
||||||
"bedrock_id": 16
|
|
||||||
},
|
|
||||||
"minecraft:birch_forest": {
|
|
||||||
"bedrock_id": 27
|
|
||||||
},
|
|
||||||
"minecraft:cherry_grove": {
|
|
||||||
"bedrock_id": 192
|
|
||||||
},
|
|
||||||
"minecraft:cold_ocean": {
|
|
||||||
"bedrock_id": 44
|
|
||||||
},
|
|
||||||
"minecraft:crimson_forest": {
|
|
||||||
"bedrock_id": 179
|
|
||||||
},
|
|
||||||
"minecraft:dark_forest": {
|
|
||||||
"bedrock_id": 29
|
|
||||||
},
|
|
||||||
"minecraft:deep_cold_ocean": {
|
|
||||||
"bedrock_id": 45
|
|
||||||
},
|
|
||||||
"minecraft:deep_dark": {
|
|
||||||
"bedrock_id": 190
|
|
||||||
},
|
|
||||||
"minecraft:deep_frozen_ocean": {
|
|
||||||
"bedrock_id": 47
|
|
||||||
},
|
|
||||||
"minecraft:deep_lukewarm_ocean": {
|
|
||||||
"bedrock_id": 43
|
|
||||||
},
|
|
||||||
"minecraft:deep_ocean": {
|
|
||||||
"bedrock_id": 24
|
|
||||||
},
|
|
||||||
"minecraft:desert": {
|
|
||||||
"bedrock_id": 2
|
|
||||||
},
|
|
||||||
"minecraft:dripstone_caves": {
|
|
||||||
"bedrock_id": 188
|
|
||||||
},
|
|
||||||
"minecraft:end_barrens": {
|
|
||||||
"bedrock_id": 9
|
|
||||||
},
|
|
||||||
"minecraft:end_highlands": {
|
|
||||||
"bedrock_id": 9
|
|
||||||
},
|
|
||||||
"minecraft:end_midlands": {
|
|
||||||
"bedrock_id": 9
|
|
||||||
},
|
|
||||||
"minecraft:eroded_badlands": {
|
|
||||||
"bedrock_id": 165
|
|
||||||
},
|
|
||||||
"minecraft:flower_forest": {
|
|
||||||
"bedrock_id": 132
|
|
||||||
},
|
|
||||||
"minecraft:forest": {
|
|
||||||
"bedrock_id": 4
|
|
||||||
},
|
|
||||||
"minecraft:frozen_ocean": {
|
|
||||||
"bedrock_id": 46
|
|
||||||
},
|
|
||||||
"minecraft:frozen_peaks": {
|
|
||||||
"bedrock_id": 183
|
|
||||||
},
|
|
||||||
"minecraft:frozen_river": {
|
|
||||||
"bedrock_id": 11
|
|
||||||
},
|
|
||||||
"minecraft:grove": {
|
|
||||||
"bedrock_id": 185
|
|
||||||
},
|
|
||||||
"minecraft:ice_spikes": {
|
|
||||||
"bedrock_id": 140
|
|
||||||
},
|
|
||||||
"minecraft:jagged_peaks": {
|
|
||||||
"bedrock_id": 182
|
|
||||||
},
|
|
||||||
"minecraft:jungle": {
|
|
||||||
"bedrock_id": 21
|
|
||||||
},
|
|
||||||
"minecraft:lukewarm_ocean": {
|
|
||||||
"bedrock_id": 42
|
|
||||||
},
|
|
||||||
"minecraft:lush_caves": {
|
|
||||||
"bedrock_id": 187
|
|
||||||
},
|
|
||||||
"minecraft:mangrove_swamp": {
|
|
||||||
"bedrock_id": 191
|
|
||||||
},
|
|
||||||
"minecraft:meadow": {
|
|
||||||
"bedrock_id": 186
|
|
||||||
},
|
|
||||||
"minecraft:mushroom_fields": {
|
|
||||||
"bedrock_id": 14
|
|
||||||
},
|
|
||||||
"minecraft:nether_wastes": {
|
|
||||||
"bedrock_id": 8
|
|
||||||
},
|
|
||||||
"minecraft:ocean": {
|
|
||||||
"bedrock_id": 0
|
|
||||||
},
|
|
||||||
"minecraft:old_growth_birch_forest": {
|
|
||||||
"bedrock_id": 155
|
|
||||||
},
|
|
||||||
"minecraft:old_growth_pine_taiga": {
|
|
||||||
"bedrock_id": 32
|
|
||||||
},
|
|
||||||
"minecraft:old_growth_spruce_taiga": {
|
|
||||||
"bedrock_id": 160
|
|
||||||
},
|
|
||||||
"minecraft:pale_garden": {
|
|
||||||
"bedrock_id": 62
|
|
||||||
},
|
|
||||||
"minecraft:plains": {
|
|
||||||
"bedrock_id": 1
|
|
||||||
},
|
|
||||||
"minecraft:river": {
|
|
||||||
"bedrock_id": 7
|
|
||||||
},
|
|
||||||
"minecraft:savanna": {
|
|
||||||
"bedrock_id": 35
|
|
||||||
},
|
|
||||||
"minecraft:savanna_plateau": {
|
|
||||||
"bedrock_id": 36
|
|
||||||
},
|
|
||||||
"minecraft:small_end_islands": {
|
|
||||||
"bedrock_id": 9
|
|
||||||
},
|
|
||||||
"minecraft:snowy_beach": {
|
|
||||||
"bedrock_id": 26
|
|
||||||
},
|
|
||||||
"minecraft:snowy_plains": {
|
|
||||||
"bedrock_id": 12
|
|
||||||
},
|
|
||||||
"minecraft:snowy_slopes": {
|
|
||||||
"bedrock_id": 184
|
|
||||||
},
|
|
||||||
"minecraft:snowy_taiga": {
|
|
||||||
"bedrock_id": 30
|
|
||||||
},
|
|
||||||
"minecraft:soul_sand_valley": {
|
|
||||||
"bedrock_id": 178
|
|
||||||
},
|
|
||||||
"minecraft:sparse_jungle": {
|
|
||||||
"bedrock_id": 23
|
|
||||||
},
|
|
||||||
"minecraft:stony_peaks": {
|
|
||||||
"bedrock_id": 189
|
|
||||||
},
|
|
||||||
"minecraft:stony_shore": {
|
|
||||||
"bedrock_id": 25
|
|
||||||
},
|
|
||||||
"minecraft:sunflower_plains": {
|
|
||||||
"bedrock_id": 129
|
|
||||||
},
|
|
||||||
"minecraft:swamp": {
|
|
||||||
"bedrock_id": 6
|
|
||||||
},
|
|
||||||
"minecraft:taiga": {
|
|
||||||
"bedrock_id": 5
|
|
||||||
},
|
|
||||||
"minecraft:the_end": {
|
|
||||||
"bedrock_id": 9
|
|
||||||
},
|
|
||||||
"minecraft:the_void": {
|
|
||||||
"bedrock_id": 7
|
|
||||||
},
|
|
||||||
"minecraft:warm_ocean": {
|
|
||||||
"bedrock_id": 40
|
|
||||||
},
|
|
||||||
"minecraft:warped_forest": {
|
|
||||||
"bedrock_id": 180
|
|
||||||
},
|
|
||||||
"minecraft:windswept_forest": {
|
|
||||||
"bedrock_id": 34
|
|
||||||
},
|
|
||||||
"minecraft:windswept_gravelly_hills": {
|
|
||||||
"bedrock_id": 131
|
|
||||||
},
|
|
||||||
"minecraft:windswept_hills": {
|
|
||||||
"bedrock_id": 3
|
|
||||||
},
|
|
||||||
"minecraft:windswept_savanna": {
|
|
||||||
"bedrock_id": 163
|
|
||||||
},
|
|
||||||
"minecraft:wooded_badlands": {
|
|
||||||
"bedrock_id": 38
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,8 +1,10 @@
|
|||||||
apply(plugin = "io.papermc.paperweight.userdev")
|
plugins {
|
||||||
|
id("io.papermc.paperweight.userdev")
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":platforms:bukkit:common"))
|
api(project(":platforms:bukkit:common"))
|
||||||
paperDevBundle(Versions.Bukkit.paperDevBundle)
|
paperweight.paperDevBundle(Versions.Bukkit.paperDevBundle)
|
||||||
implementation("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
|
implementation("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public class NMSChunkGeneratorDelegate extends ChunkGenerator {
|
|||||||
BlockState[] array = new BlockState[world.getHeight()];
|
BlockState[] array = new BlockState[world.getHeight()];
|
||||||
WorldProperties properties = new NMSWorldProperties(seed, world);
|
WorldProperties properties = new NMSWorldProperties(seed, world);
|
||||||
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
||||||
for(int y = properties.getMaxHeight() - 1; y >= properties.getMinHeight(); y--) {
|
for(int y = properties.getMaxHeight(); y >= properties.getMinHeight(); y--) {
|
||||||
array[y - properties.getMinHeight()] = ((CraftBlockData) delegate.getBlock(properties, x, y, z, biomeProvider)
|
array[y - properties.getMinHeight()] = ((CraftBlockData) delegate.getBlock(properties, x, y, z, biomeProvider)
|
||||||
.getHandle()).getState();
|
.getHandle()).getState();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user