mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
feat: fetch allay's changes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven("https://www.jitpack.io/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -6,9 +6,9 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.allaymc.api.block.property.type.BlockPropertyType.BlockPropertyValue;
|
||||
import org.allaymc.api.block.registry.BlockTypeRegistry;
|
||||
import org.allaymc.api.block.type.BlockState;
|
||||
import org.allaymc.api.block.type.BlockTypes;
|
||||
import org.allaymc.api.registry.Registries;
|
||||
import org.allaymc.api.utils.Identifier;
|
||||
import org.allaymc.api.utils.JSONUtils;
|
||||
|
||||
@@ -117,7 +117,7 @@ public final class Mapping {
|
||||
private static BlockState createBeBlockState(Map<String, Object> data) {
|
||||
var identifier = new Identifier((String) data.get("bedrock_identifier"));
|
||||
// 方块类型
|
||||
var blockType = BlockTypeRegistry.getRegistry().get(identifier);
|
||||
var blockType = Registries.BLOCKS.get(identifier);
|
||||
// 方块属性
|
||||
Map<String, Object> state = (Map<String, Object>) data.get("state");
|
||||
if (state == null) return blockType.getDefaultState();
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.allaymc.terra.allay;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.allaymc.api.plugin.Plugin;
|
||||
import org.allaymc.api.world.generator.WorldGeneratorFactory;
|
||||
import org.allaymc.api.registry.Registries;
|
||||
import org.allaymc.terra.allay.generator.AllayGeneratorWrapper;
|
||||
|
||||
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
|
||||
@@ -36,7 +36,7 @@ public class TerraAllayPlugin extends Plugin {
|
||||
PLATFORM.getEventManager().callEvent(new PlatformInitializationEvent());
|
||||
|
||||
log.info("Registering generator...");
|
||||
WorldGeneratorFactory.getFactory().register("TERRA", preset -> new AllayGeneratorWrapper(preset).getAllayWorldGenerator());
|
||||
Registries.WORLD_GENERATOR_FACTORIES.register("TERRA", preset -> new AllayGeneratorWrapper(preset).getAllayWorldGenerator());
|
||||
|
||||
log.info("Terra started");
|
||||
}
|
||||
|
||||
@@ -43,6 +43,6 @@ public final class AllayFakeEntity implements Entity {
|
||||
|
||||
@Override
|
||||
public Object getHandle() {
|
||||
return null;
|
||||
return fakeHandle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.allaymc.terra.allay.handle;
|
||||
|
||||
import org.allaymc.api.item.enchantment.EnchantmentRegistry;
|
||||
import org.allaymc.api.item.registry.ItemTypeRegistry;
|
||||
import org.allaymc.api.registry.Registries;
|
||||
import org.allaymc.api.utils.Identifier;
|
||||
import org.allaymc.terra.allay.Mapping;
|
||||
import org.allaymc.terra.allay.delegate.AllayEnchantment;
|
||||
@@ -23,17 +22,17 @@ import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
public class AllayItemHandle implements ItemHandle {
|
||||
@Override
|
||||
public Item createItem(String data) {
|
||||
return new AllayItemType(ItemTypeRegistry.getRegistry().get(new Identifier(Mapping.itemIdJeToBe(data))));
|
||||
return new AllayItemType(Registries.ITEMS.get(new Identifier(Mapping.itemIdJeToBe(data))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enchantment getEnchantment(String id) {
|
||||
return new AllayEnchantment(EnchantmentRegistry.getRegistry().getByK2(new Identifier(Mapping.enchantmentIdJeToBe(id))));
|
||||
return new AllayEnchantment(Registries.ENCHANTMENTS.getByK2(new Identifier(Mapping.enchantmentIdJeToBe(id))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Enchantment> getEnchantments() {
|
||||
return EnchantmentRegistry.getRegistry().getContent().m1().values().stream()
|
||||
return Registries.ENCHANTMENTS.getContent().m1().values().stream()
|
||||
.map(AllayEnchantment::new)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user