mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
refactor: replace 'var' with explicit type
This commit is contained in:
@@ -2,6 +2,7 @@ package com.dfsek.terra.allay;
|
||||
|
||||
import org.allaymc.api.utils.HashUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
@@ -22,13 +23,13 @@ public class JeBlockState {
|
||||
}
|
||||
|
||||
private JeBlockState(String data) {
|
||||
var strings = data.replace("[", ",").replace("]", ",").replace(" ", "").split(",");
|
||||
String[] strings = data.replace("[", ",").replace("]", ",").replace(" ", "").split(",");
|
||||
this.identifier = strings[0];
|
||||
this.properties = new TreeMap<>();
|
||||
if (strings.length > 1) {
|
||||
for (int i = 1; i < strings.length; i++) {
|
||||
final var tmp = strings[i];
|
||||
final var index = tmp.indexOf("=");
|
||||
final String tmp = strings[i];
|
||||
final int index = tmp.indexOf("=");
|
||||
properties.put(tmp.substring(0, index), tmp.substring(index + 1));
|
||||
}
|
||||
}
|
||||
@@ -40,14 +41,12 @@ public class JeBlockState {
|
||||
}
|
||||
|
||||
private void completeMissingProperties() {
|
||||
var defaultProperties = Mapping.getJeBlockDefaultProperties(identifier);
|
||||
Map<String, String> defaultProperties = Mapping.getJeBlockDefaultProperties(identifier);
|
||||
if(properties.size() == defaultProperties.size()) {
|
||||
return;
|
||||
}
|
||||
for (var entry : defaultProperties.entrySet()) {
|
||||
if (properties.containsKey(entry.getKey())) continue;
|
||||
properties.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
defaultProperties.entrySet().stream().filter(entry -> !properties.containsKey(entry.getKey())).forEach(
|
||||
entry -> properties.put(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
private JeBlockState(String identifier, TreeMap<String, String> properties) {
|
||||
@@ -59,7 +58,7 @@ public class JeBlockState {
|
||||
if(!includeProperties) return identifier;
|
||||
StringBuilder builder = new StringBuilder(identifier).append(";");
|
||||
properties.forEach((k, v) -> builder.append(k).append("=").append(v).append(";"));
|
||||
var str = builder.toString();
|
||||
String str = builder.toString();
|
||||
if (hash == Integer.MAX_VALUE) {
|
||||
hash = HashUtils.fnv1a_32(str.getBytes());
|
||||
}
|
||||
|
||||
@@ -6,14 +6,18 @@ 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.BlockStateSafeGetter.Getter;
|
||||
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.utils.JSONUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
@@ -41,7 +45,7 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
public static BlockState blockStateJeToBe(JeBlockState jeBlockState) {
|
||||
var result = BLOCK_STATE_JE_HASH_TO_BE.get(jeBlockState.getHash());
|
||||
BlockState result = BLOCK_STATE_JE_HASH_TO_BE.get(jeBlockState.getHash());
|
||||
if(result == null) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().warn("Failed to find be block state for {}", jeBlockState);
|
||||
return BE_AIR_STATE;
|
||||
@@ -68,7 +72,7 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
public static Map<String, String> getJeBlockDefaultProperties(String jeBlockIdentifier) {
|
||||
var defaultProperties = JE_BLOCK_DEFAULT_PROPERTIES.get(jeBlockIdentifier);
|
||||
Map<String, String> defaultProperties = JE_BLOCK_DEFAULT_PROPERTIES.get(jeBlockIdentifier);
|
||||
if( defaultProperties == null) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().warn("Failed to find default properties for {}", jeBlockIdentifier);
|
||||
return Map.of();
|
||||
@@ -81,15 +85,13 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
private static boolean initBiomeMapping() {
|
||||
try (var stream = Mapping.class.getClassLoader().getResourceAsStream("mapping/biomes.json")) {
|
||||
try (InputStream stream = Mapping.class.getClassLoader().getResourceAsStream("mapping/biomes.json")) {
|
||||
if (stream == null) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("biomes mapping not found");
|
||||
return false;
|
||||
}
|
||||
var mappings = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, Integer>>>(){}).entrySet();
|
||||
for(var mapping : mappings) {
|
||||
BIOME_ID_JE_TO_BE.put(mapping.getKey(), mapping.getValue().get("bedrock_id"));
|
||||
}
|
||||
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")));
|
||||
} catch(IOException e) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load biomes mapping", e);
|
||||
return false;
|
||||
@@ -98,20 +100,20 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
private static boolean initItemMapping() {
|
||||
try (var stream = Mapping.class.getClassLoader().getResourceAsStream("mapping/items.json")) {
|
||||
try (InputStream stream = Mapping.class.getClassLoader().getResourceAsStream("mapping/items.json")) {
|
||||
if (stream == null) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("items mapping not found");
|
||||
return false;
|
||||
}
|
||||
var mappings = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, Object>>>(){}).entrySet();
|
||||
for(var mapping : mappings) {
|
||||
var item = ItemTypeSafeGetter
|
||||
Set<Entry<String, Map<String, Object>>> mappings = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, Object>>>(){}).entrySet();
|
||||
mappings.forEach(mapping -> {
|
||||
ItemType<?> item = ItemTypeSafeGetter
|
||||
.name((String) mapping.getValue().get("bedrock_identifier"))
|
||||
// NOTICE: should be cast to double
|
||||
.meta(((Double) mapping.getValue().get("bedrock_data")).intValue())
|
||||
.itemType();
|
||||
ITEM_ID_JE_TO_BE.put(mapping.getKey(), item);
|
||||
}
|
||||
});
|
||||
} catch(IOException e) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load items mapping", e);
|
||||
}
|
||||
@@ -119,19 +121,19 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
private static boolean initBlockStateMapping() {
|
||||
try (var stream = Mapping.class.getClassLoader().getResourceAsStream("mapping/blocks.json")) {
|
||||
try (InputStream stream = Mapping.class.getClassLoader().getResourceAsStream("mapping/blocks.json")) {
|
||||
if (stream == null) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("blocks mapping not found");
|
||||
return false;
|
||||
}
|
||||
// noinspection unchecked
|
||||
var mappings = (List<Map<String, Map<String, Object>>>) JSONUtils.from(stream, new TypeToken<Map<String, Object>>(){}).get("mappings");
|
||||
for(var mapping : mappings) {
|
||||
var jeState = createJeBlockState(mapping.get("java_state"));
|
||||
var beState = createBeBlockState(mapping.get("bedrock_state"));
|
||||
List<Map<String, Map<String, Object>>> mappings = (List<Map<String, Map<String, Object>>>) JSONUtils.from(stream, new TypeToken<Map<String, Object>>(){}).get("mappings");
|
||||
mappings.forEach(mapping -> {
|
||||
JeBlockState jeState = createJeBlockState(mapping.get("java_state"));
|
||||
BlockState beState = createBeBlockState(mapping.get("bedrock_state"));
|
||||
BLOCK_STATE_BE_TO_JE.put(beState, jeState);
|
||||
BLOCK_STATE_JE_HASH_TO_BE.put(jeState.getHash(), beState);
|
||||
}
|
||||
});
|
||||
} catch(IOException e) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load blocks mapping", e);
|
||||
}
|
||||
@@ -139,15 +141,15 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
private static boolean initJeBlockDefaultProperties() {
|
||||
try (var stream = Mapping.class.getClassLoader().getResourceAsStream("je_block_default_states.json")) {
|
||||
try (InputStream stream = Mapping.class.getClassLoader().getResourceAsStream("je_block_default_states.json")) {
|
||||
if (stream == null) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("je_block_default_states.json not found");
|
||||
return false;
|
||||
}
|
||||
var states = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, String>>>(){});
|
||||
for(var entry : states.entrySet()) {
|
||||
var identifier = entry.getKey();
|
||||
var properties = entry.getValue();
|
||||
Map<String, Map<String, String>> states = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, String>>>(){});
|
||||
for(Entry<String, Map<String, String>> entry : states.entrySet()) {
|
||||
String identifier = entry.getKey();
|
||||
Map<String, String> properties = entry.getValue();
|
||||
JE_BLOCK_DEFAULT_PROPERTIES.put(identifier, properties);
|
||||
}
|
||||
} catch(IOException e) {
|
||||
@@ -157,7 +159,7 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
private static BlockState createBeBlockState(Map<String, Object> data) {
|
||||
var getter = BlockStateSafeGetter
|
||||
Getter getter = BlockStateSafeGetter
|
||||
.name("minecraft:" + data.get("bedrock_identifier"));
|
||||
if (data.containsKey("state")) {
|
||||
// noinspection unchecked
|
||||
@@ -167,8 +169,8 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
private static Map<String, Object> convertValueType(Map<String, Object> data) {
|
||||
var result = new TreeMap<String, Object>();
|
||||
for (var entry : data.entrySet()) {
|
||||
TreeMap<String, Object> result = new TreeMap<>();
|
||||
for (Entry<String, Object> entry : data.entrySet()) {
|
||||
if (entry.getValue() instanceof Number number) {
|
||||
// Convert double to int because the number in json is double
|
||||
result.put(entry.getKey(), number.intValue());
|
||||
@@ -180,8 +182,7 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
private static JeBlockState createJeBlockState(Map<String, Object> data) {
|
||||
var identifier = (String) data.get("Name");
|
||||
// noinspection unchecked
|
||||
return JeBlockState.create(identifier, new TreeMap<>((Map<String, String>) data.getOrDefault("Properties", Map.of())));
|
||||
return JeBlockState.create((String) data.get("Name"), new TreeMap<>((Map<String, String>) data.getOrDefault("Properties", Map.of())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class AllayBlockState implements com.dfsek.terra.api.block.state.Bl
|
||||
|
||||
@Override
|
||||
public boolean matches(com.dfsek.terra.api.block.state.BlockState o) {
|
||||
var other = ((AllayBlockState) o);
|
||||
AllayBlockState other = ((AllayBlockState) o);
|
||||
return other.allayBlockState == this.allayBlockState && other.containsWater == this.containsWater;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ public record AllayChunk(ServerWorld world, Chunk allayChunk) implements com.dfs
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, BlockState data, boolean physics) {
|
||||
var allayBlockState = (AllayBlockState) data;
|
||||
AllayBlockState allayBlockState = (AllayBlockState) data;
|
||||
allayChunk.setBlockState(x, y, z, allayBlockState.allayBlockState());
|
||||
var containsWater = allayBlockState.containsWater() || allayChunk.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER);
|
||||
boolean containsWater = allayBlockState.containsWater() || allayChunk.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER);
|
||||
if (containsWater) {
|
||||
allayChunk.setBlockState(x, y, z, WATER, 1);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public record AllayChunk(ServerWorld world, Chunk allayChunk) implements com.dfs
|
||||
|
||||
@Override
|
||||
public @NotNull BlockState getBlock(int x, int y, int z) {
|
||||
var blockState = allayChunk.getBlockState(x, y, z);
|
||||
org.allaymc.api.block.type.BlockState blockState = allayChunk.getBlockState(x, y, z);
|
||||
return new AllayBlockState(blockState, Mapping.blockStateBeToJe(blockState));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,20 +8,24 @@ import java.util.Map;
|
||||
import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
||||
|
||||
import org.allaymc.api.item.enchantment.EnchantmentInstance;
|
||||
import org.allaymc.api.item.enchantment.EnchantmentType;
|
||||
|
||||
|
||||
/**
|
||||
* @author daoge_cmd
|
||||
*/
|
||||
public record AllayItemMeta(ItemStack allayItemStack) implements ItemMeta {
|
||||
@Override
|
||||
public void addEnchantment(Enchantment enchantment, int level) {
|
||||
var allayEnchantment = ((AllayEnchantment) enchantment).allayEnchantment();
|
||||
EnchantmentType allayEnchantment = ((AllayEnchantment) enchantment).allayEnchantment();
|
||||
allayItemStack.addEnchantment(allayEnchantment, (short) level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Enchantment, Integer> getEnchantments() {
|
||||
Map<Enchantment, Integer> results = new HashMap<>();
|
||||
for (var allayEnchantmentInstance : allayItemStack.getEnchantments()) {
|
||||
for (EnchantmentInstance allayEnchantmentInstance : allayItemStack.getEnchantments()) {
|
||||
results.put(new AllayEnchantment(allayEnchantmentInstance.getType()), allayEnchantmentInstance.getLevel());
|
||||
}
|
||||
return results;
|
||||
|
||||
@@ -5,6 +5,9 @@ import org.allaymc.api.item.ItemStack;
|
||||
import com.dfsek.terra.api.inventory.Item;
|
||||
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
||||
|
||||
import org.allaymc.api.item.enchantment.EnchantmentInstance;
|
||||
|
||||
|
||||
/**
|
||||
* @author daoge_cmd
|
||||
*/
|
||||
@@ -31,9 +34,9 @@ public record AllayItemStack(ItemStack allayItemStack) implements com.dfsek.terr
|
||||
|
||||
@Override
|
||||
public void setItemMeta(ItemMeta meta) {
|
||||
var targetItem = ((AllayItemMeta) meta).allayItemStack();
|
||||
ItemStack targetItem = ((AllayItemMeta) meta).allayItemStack();
|
||||
allayItemStack.removeAllEnchantments();
|
||||
for (var enchantment : targetItem.getEnchantments()) {
|
||||
for (EnchantmentInstance enchantment : targetItem.getEnchantments()) {
|
||||
allayItemStack.addEnchantment(enchantment.getType(), enchantment.getLevel());
|
||||
}
|
||||
allayItemStack.setLore(targetItem.getLore());
|
||||
|
||||
@@ -24,9 +24,9 @@ public record AllayProtoChunk(UnsafeChunk allayChunk) implements ProtoChunk {
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
||||
var allayBlockState = (AllayBlockState) blockState;
|
||||
AllayBlockState allayBlockState = (AllayBlockState) blockState;
|
||||
allayChunk.setBlockState(x, y, z, allayBlockState.allayBlockState());
|
||||
var containsWater = allayBlockState.containsWater() || allayChunk.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER);
|
||||
boolean containsWater = allayBlockState.containsWater() || allayChunk.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER);
|
||||
if (containsWater) {
|
||||
allayChunk.setBlockState(x, y, z, WATER, 1);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public record AllayProtoChunk(UnsafeChunk allayChunk) implements ProtoChunk {
|
||||
|
||||
@Override
|
||||
public @NotNull BlockState getBlock(int x, int y, int z) {
|
||||
var blockState = allayChunk.getBlockState(x, y, z);
|
||||
org.allaymc.api.block.type.BlockState blockState = allayChunk.getBlockState(x, y, z);
|
||||
return new AllayBlockState(blockState, Mapping.blockStateBeToJe(blockState));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,15 +41,15 @@ public record AllayProtoWorld(AllayServerWorld allayServerWorld, OtherChunkAcces
|
||||
|
||||
@Override
|
||||
public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
|
||||
var allayBlockState = (AllayBlockState)data;
|
||||
var containsWater = allayBlockState.containsWater() || context.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER);
|
||||
AllayBlockState allayBlockState = (AllayBlockState)data;
|
||||
boolean containsWater = allayBlockState.containsWater() || context.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER);
|
||||
context.setBlockState(x, y, z, allayBlockState.allayBlockState());
|
||||
if (containsWater) context.setBlockState(x, y, z, WATER, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(int x, int y, int z) {
|
||||
var blockState = context.getBlockState(x, y, z);
|
||||
org.allaymc.api.block.type.BlockState blockState = context.getBlockState(x, y, z);
|
||||
return new AllayBlockState(blockState, Mapping.blockStateBeToJe(blockState));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public record AllayServerWorld(AllayGeneratorWrapper allayGeneratorWrapper, Dime
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(int x, int y, int z) {
|
||||
var allayBlockState = allayDimension.getBlockState(x, y, z);
|
||||
org.allaymc.api.block.type.BlockState allayBlockState = allayDimension.getBlockState(x, y, z);
|
||||
return new AllayBlockState(allayBlockState, Mapping.blockStateBeToJe(allayBlockState));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.dfsek.terra.allay.generator;
|
||||
|
||||
import com.dfsek.terra.api.world.chunk.generation.stage.GenerationStage;
|
||||
|
||||
import org.allaymc.api.utils.AllayStringUtils;
|
||||
import org.allaymc.api.world.biome.BiomeType;
|
||||
import org.allaymc.api.world.chunk.UnsafeChunk;
|
||||
import org.allaymc.api.world.generator.WorldGenerator;
|
||||
import org.allaymc.api.world.generator.context.NoiseContext;
|
||||
import org.allaymc.api.world.generator.context.PopulateContext;
|
||||
@@ -13,6 +16,8 @@ import com.dfsek.terra.allay.delegate.AllayProtoWorld;
|
||||
import com.dfsek.terra.allay.delegate.AllayServerWorld;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
@@ -39,8 +44,8 @@ public class AllayGeneratorWrapper implements GeneratorWrapper {
|
||||
protected AllayServerWorld allayServerWorld;
|
||||
|
||||
public AllayGeneratorWrapper(String preset) {
|
||||
var options = AllayStringUtils.parseOptions(preset);
|
||||
var packName = options.getOrDefault(OPTION_PACK_NAME, DEFAULT_PACK_NAME);
|
||||
Map<String, String> options = AllayStringUtils.parseOptions(preset);
|
||||
String packName = options.getOrDefault(OPTION_PACK_NAME, DEFAULT_PACK_NAME);
|
||||
this.seed = Long.parseLong(options.getOrDefault(OPTION_SEED, "0"));
|
||||
this.configPack = createConfigPack(packName);
|
||||
this.chunkGenerator = createGenerator(this.configPack);
|
||||
@@ -85,16 +90,16 @@ public class AllayGeneratorWrapper implements GeneratorWrapper {
|
||||
|
||||
@Override
|
||||
public boolean apply(NoiseContext context) {
|
||||
var chunk = context.getCurrentChunk();
|
||||
var chunkX = chunk.getX();
|
||||
var chunkZ = chunk.getZ();
|
||||
UnsafeChunk chunk = context.getCurrentChunk();
|
||||
int chunkX = chunk.getX();
|
||||
int chunkZ = chunk.getZ();
|
||||
chunkGenerator.generateChunkData(
|
||||
new AllayProtoChunk(chunk),
|
||||
worldProperties, biomeProvider,
|
||||
chunkX, chunkZ
|
||||
);
|
||||
var minHeight = context.getDimensionInfo().minHeight();
|
||||
var maxHeight = context.getDimensionInfo().maxHeight();
|
||||
int minHeight = context.getDimensionInfo().minHeight();
|
||||
int maxHeight = context.getDimensionInfo().maxHeight();
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int y = minHeight; y < maxHeight; y++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
@@ -119,9 +124,9 @@ public class AllayGeneratorWrapper implements GeneratorWrapper {
|
||||
|
||||
@Override
|
||||
public boolean apply(PopulateContext context) {
|
||||
var tmp = new AllayProtoWorld(allayServerWorld, context);
|
||||
AllayProtoWorld tmp = new AllayProtoWorld(allayServerWorld, context);
|
||||
try {
|
||||
for(var generationStage : configPack.getStages()) {
|
||||
for(GenerationStage generationStage : configPack.getStages()) {
|
||||
generationStage.populate(tmp);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
@@ -137,7 +142,7 @@ public class AllayGeneratorWrapper implements GeneratorWrapper {
|
||||
}
|
||||
|
||||
protected static ConfigPack createConfigPack(String packName) {
|
||||
var byId = TerraAllayPlugin.PLATFORM.getConfigRegistry().getByID(packName);
|
||||
Optional<ConfigPack> byId = TerraAllayPlugin.PLATFORM.getConfigRegistry().getByID(packName);
|
||||
return byId.orElseGet(
|
||||
() -> TerraAllayPlugin.PLATFORM.getConfigRegistry().getByID(packName.toUpperCase(Locale.ENGLISH))
|
||||
.orElseThrow(() -> new IllegalArgumentException("Cant find terra config pack named " + packName))
|
||||
|
||||
@@ -16,7 +16,7 @@ public class AllayWorldHandle implements WorldHandle {
|
||||
|
||||
@Override
|
||||
public @NotNull BlockState createBlockState(@NotNull String data) {
|
||||
var jeBlockState = JeBlockState.fromString(data);
|
||||
JeBlockState jeBlockState = JeBlockState.fromString(data);
|
||||
return new AllayBlockState(Mapping.blockStateJeToBe(jeBlockState), jeBlockState);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user