net.minecraft.util.registry.RegistryKey#of ( )源码实例Demo

下面列出了net.minecraft.util.registry.RegistryKey#of ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: multiconnect   文件: Protocol_1_13_2.java
private void mutateEntityTypeRegistry(ISimpleRegistry<EntityType<?>> registry) {
    registry.unregister(EntityType.CAT);
    int ocelotId = Registry.ENTITY_TYPE.getRawId(EntityType.OCELOT);
    registry.unregister(EntityType.OCELOT);
    RegistryKey<EntityType<?>> ocelotKey = RegistryKey.of(registry.getRegistryKey(), new Identifier("ocelot"));
    registry.register(EntityType.CAT, ocelotId, ocelotKey);
    registry.unregister(EntityType.FOX);
    registry.unregister(EntityType.PANDA);
    registry.unregister(EntityType.PILLAGER);
    registry.unregister(EntityType.RAVAGER);
    registry.unregister(EntityType.TRADER_LLAMA);
    registry.unregister(EntityType.WANDERING_TRADER);
    registry.unregister(EntityType.TRIDENT);
    insertAfter(registry, EntityType.FISHING_BOBBER, EntityType.TRIDENT, "trident");
    ENTITY_REGISTRY_1_13 = registry.copy();
}
 
源代码2 项目: multiconnect   文件: AbstractProtocol.java
@SuppressWarnings("unchecked")
public static <T> void insertAfter(ISimpleRegistry<T> registry, T element, T toInsert, String id, boolean inPlace) {
    RegistryKey<T> key = RegistryKey.of(registry.getRegistryKey(), new Identifier(id));
    int numericalId = ((SimpleRegistry<T>) registry).getRawId(element) + 1;
    if (inPlace) {
        registry.registerInPlace(toInsert, numericalId, key);
    } else {
        registry.register(toInsert, numericalId, key);
    }
}
 
源代码3 项目: multiconnect   文件: AbstractProtocol.java
@SuppressWarnings("unchecked")
protected <T> void postMutateRegistry(Registry<T> registry) {
    if (!(registry instanceof SimpleRegistry)) return;
    if (registry instanceof DefaultedRegistry) return;
    ISimpleRegistry<T> iregistry = (ISimpleRegistry<T>) registry;
    DefaultRegistry<T> defaultRegistry = (DefaultRegistry<T>) DefaultRegistry.DEFAULT_REGISTRIES.get(registry);
    if (defaultRegistry == null) return;
    for (Map.Entry<Identifier, T> entry : defaultRegistry.defaultEntriesById.entrySet()) {
        if (registry.getId(entry.getValue()) == null) {
            RegistryKey<T> key = RegistryKey.of(iregistry.getRegistryKey(), entry.getKey());
            iregistry.register(entry.getValue(), iregistry.getNextId(), key, false);
        }
    }
}
 
源代码4 项目: multiconnect   文件: AbstractProtocol.java
@SuppressWarnings("unchecked")
public static <T> void rename(ISimpleRegistry<T> registry, T value, String newName) {
    int id = ((SimpleRegistry<T>) registry).getRawId(value);
    registry.purge(value);
    RegistryKey<T> key = RegistryKey.of(registry.getRegistryKey(), new Identifier(newName));
    registry.registerInPlace(value, id, key);
}
 
源代码5 项目: multiconnect   文件: Protocol_1_13_2.java
private void mutateRecipeSerializerRegistry(ISimpleRegistry<RecipeSerializer<?>> registry) {
    registry.unregister(RecipeSerializer.SUSPICIOUS_STEW);
    registry.unregister(RecipeSerializer.BLASTING);
    registry.unregister(RecipeSerializer.SMOKING);
    registry.unregister(RecipeSerializer.CAMPFIRE_COOKING);
    registry.unregister(RecipeSerializer.STONECUTTING);
    RegistryKey<RecipeSerializer<?>> bannerAddPatternKey = RegistryKey.of(registry.getRegistryKey(), new Identifier("crafting_special_banneraddpattern"));
    registry.register(AddBannerPatternRecipe.SERIALIZER, registry.getNextId(), bannerAddPatternKey);
}
 
源代码6 项目: multiconnect   文件: Entities_1_12_2.java
private static void register(ISimpleRegistry<EntityType<?>> registry, EntityType<?> entity, int id, String name, String oldName) {
    RegistryKey<EntityType<?>> key = RegistryKey.of(registry.getRegistryKey(), new Identifier(name));
    registry.register(entity, id, key, false);
}
 
源代码7 项目: multiconnect   文件: Particles_1_12_2.java
private static void register(ISimpleRegistry<ParticleType<?>> registry, ParticleType<?> particle, int id, String name) {
    RegistryKey<ParticleType<?>> key = RegistryKey.of(registry.getRegistryKey(), new Identifier(name));
    registry.register(particle, id, key, false);
}
 
源代码8 项目: multiconnect   文件: Blocks_1_12_2.java
private static void register(ISimpleRegistry<Block> registry, Block block, int id, String name) {
    RegistryKey<Block> key = RegistryKey.of(registry.getRegistryKey(), new Identifier(name));
    registry.registerInPlace(block, id, key, false);
}
 
源代码9 项目: multiconnect   文件: Enchantments_1_12_2.java
private static void register(ISimpleRegistry<Enchantment> registry, Enchantment enchantment, int id, String name) {
    RegistryKey<Enchantment> key = RegistryKey.of(registry.getRegistryKey(), new Identifier(name));
    registry.register(enchantment, id, key, false);
}
 
源代码10 项目: multiconnect   文件: Items_1_12_2.java
private static void register(ISimpleRegistry<Item> registry, Item item, int id, String name) {
    RegistryKey<Item> key = RegistryKey.of(registry.getRegistryKey(), new Identifier(name));
    registry.registerInPlace(item, id, key, false);
}
 
源代码11 项目: multiconnect   文件: Items_1_12_2.java
private static void registerBlockItem(ISimpleRegistry<Item> registry, Block block) {
    RegistryKey<Item> key = RegistryKey.of(registry.getRegistryKey(), Registry.BLOCK.getId(block));
    registry.registerInPlace(Item.BLOCK_ITEMS.getOrDefault(block, AIR), Registry.BLOCK.getRawId(block), key, false);
}
 
public static void register() {
    Registry.register(Registry.CHUNK_GENERATOR, new Identifier(Constants.MOD_ID, "moon"), MoonChunkGenerator.CODEC);

    MOON = RegistryKey.of(Registry.DIMENSION, new Identifier(Constants.MOD_ID, "moon"));

    FabricDimensions.registerDefaultPlacer(MOON, GalacticraftDimensions::placeEntity);
}
 
 同类方法