Java 类net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry 实例源码

项目:Toms-Mod    文件:ResearchHandler.java   
public static void init() {
    log.info("Loading Research Handler...");
    RegistryBuilder<Research> builder = new RegistryBuilder<>();
    builder.setName(loc);
    builder.setType(Research.class);
    builder.setIDRange(MIN_ID, MAX_ID);
    iResearchRegistry = (FMLControlledNamespacedRegistry<Research>) builder.create();
    // iResearchRegistry = PersistentRegistryManager.createRegistry(loc,
    // Research.class, new ResourceLocation("invalid"), MIN_ID, MAX_ID,
    // true, ResearchCallbacks.INSTANCE, ResearchCallbacks.INSTANCE,
    // ResearchCallbacks.INSTANCE);
}
项目:renderTo    文件:RenderToGuiScreen.java   
private void setupItemList() {
    String domain = domainListModel.get(domainListSelection) + ":";
    FMLControlledNamespacedRegistry<Item> r1 = GameData.getItemRegistry();
    cachedItems.clear();
    for(Object keyobj : r1.getKeys()) {
        String name = keyobj.toString();
        int index = name.indexOf(':');
        if((index < 0 && domain.equals("minecraft:")) || name.startsWith(domain)) {
            String fillName = index < 0 ? name : name.substring(index + 1);
            Item item = r1.getObject(name);
            if(item.getHasSubtypes()) {
                List<ItemStack> itemStacks = new ArrayList<ItemStack>();
                item.getSubItems(item, item.getCreativeTab(), itemStacks);
                int id = 0;
                for(ItemStack stack : itemStacks) {
                    String indexName = String.format("%s:%03d", fillName, id++);
                    if(checkMatches(indexName, currentFilterPattern)) {
                        itemListModel.add(indexName);
                        cachedItems.put(indexName, stack);
                    }
                }
            } else {
                if(checkMatches(fillName, currentFilterPattern)) {
                    itemListModel.add(fillName);
                    cachedItems.put(fillName, new ItemStack(r1.getObject(name)));
                }
            }
        }
    }
}
项目:Lector    文件:SoundController.java   
private static SoundEvent registerSound(ResourceLocation rl){
    SoundEvent ret = new SoundEvent(rl).setRegistryName(rl);
    ((FMLControlledNamespacedRegistry) SoundEvent.REGISTRY).register(ret);
    return ret;
}
项目:ExNihiloAdscensio    文件:ItemFMLRegistryWrapper.java   
/**
 * @param registry - The registry to get data from.
 * @param item     - The Item to create a stack for
 */
public ItemFMLRegistryWrapper(FMLControlledNamespacedRegistry<T> registry, Item item) {
    this.registry = registry;
    this.item = item;
}
项目:ExNihiloAdscensio    文件:ItemFMLRegistryWrapper.java   
/**
 * @return the used registry.
 */
public FMLControlledNamespacedRegistry<T> getRegistry() {
    return registry;
}
项目:AquaMunda    文件:SoundController.java   
private static SoundEvent registerSound(ResourceLocation rl){
    SoundEvent ret = new SoundEvent(rl).setRegistryName(rl);
    ((FMLControlledNamespacedRegistry)SoundEvent.REGISTRY).register(ret);
    return ret;
}