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