Java 类cpw.mods.fml.common.registry.GameRegistry.Type 实例源码

项目:Chisel-1.7.2    文件:Chisel.java   
@EventHandler
public void missingMapping(FMLMissingMappingsEvent event) {
    for(MissingMapping m: event.get()) {
        // This bug was introduced along with Chisel 1.5.2, and was fixed in 1.5.3.
        // Ice Stairs were called null.0-7 instead of other names, and Marble/Limestone stairs did not exist.
        // This fixes the bug.
        if(m.name.startsWith("null.") && m.name.length() == 6 && m.type == Type.BLOCK) {
            m.setAction(Action.WARN);
        }
    }
}
项目:Chisel-2    文件:Chisel.java   
@EventHandler
public void missingMapping(FMLMissingMappingsEvent event) {
    BlockNameConversion.init();

    for (MissingMapping m : event.get()) {
        // This bug was introduced along with Chisel 1.5.2, and was fixed in
        // 1.5.3.
        // Ice Stairs were called null.0-7 instead of other names, and
        // Marble/Limestone stairs did not exist.
        // This fixes the bug.
        if (m.name.startsWith("null.") && m.name.length() == 6 && m.type == Type.BLOCK) {
            m.warn();// (Action.WARN);
        }

        // Fix mapping of snakestoneSand, snakestoneStone, limestoneStairs,
        // marbleStairs when loading an old (1.5.4) save
        else if (m.type == Type.BLOCK) {
            final Block block = BlockNameConversion.findBlock(m.name);

            if (block != null) {
                m.remap(block);
                FMLLog.getLogger().info("Remapping block " + m.name + " to " + General.getName(block));
            } else
                FMLLog.getLogger().warn("Block " + m.name + " could not get remapped.");
        } else if (m.type == Type.ITEM) {
            final Item item = BlockNameConversion.findItem(m.name);

            if (item != null) {
                m.remap(item);
                FMLLog.getLogger().info("Remapping item " + m.name + " to " + General.getName(item));

            } else
                FMLLog.getLogger().warn("Item " + m.name + " could not get remapped.");
        }
    }
}
项目:betterAnvil-forge    文件:BetterAnvil.java   
@EventHandler
public void init(FMLInitializationEvent event) {
    try {
        GameRegistry.addSubstitutionAlias("minecraft:anvil", Type.BLOCK, BetterAnvil.ANVIL);
        GameRegistry.addSubstitutionAlias("minecraft:anvil", Type.ITEM, new ItemAnvilBlock(BetterAnvil.ANVIL));
    } catch(ExistingSubstitutionException e) {
        e.printStackTrace();
    }
    MinecraftForge.EVENT_BUS.register(EventHandlerBA.INSTANCE);

    //register gui
    NetworkRegistry.INSTANCE.registerGuiHandler(BetterAnvil.instance, new GuiHandler());
}
项目:TRHS_Club_Mod_2016    文件:GameData.java   
void registerSubstitutionAlias(String nameToSubstitute, Type type, Object toReplace) throws ExistingSubstitutionException
{
    type.getRegistry().addSubstitutionAlias(Loader.instance().activeModContainer().getModId(),nameToSubstitute, toReplace);
    type.getRegistry().activateSubstitution(nameToSubstitute);
}