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

项目:RuneCraftery    文件:ModIdMapPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    byte[] allData = Bytes.concat(partials);
    GameData.initializeServerGate(1);
    try
    {
        NBTTagCompound serverList = CompressedStreamTools.func_74792_a(allData);
        NBTTagList list = serverList.func_74761_m("List");
        Set<ItemData> itemData = GameData.buildWorldItemData(list);
        GameData.validateWorldSave(itemData);
        MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
        if (serverDifference!=null)
        {
            FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);

        }
    }
    catch (IOException e)
    {
    }
}
项目:RuneCraftery    文件:ModIdMapPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    byte[] allData = Bytes.concat(partials);
    GameData.initializeServerGate(1);
    try
    {
        NBTTagCompound serverList = CompressedStreamTools.decompress(allData);
        NBTTagList list = serverList.getTagList("List");
        Set<ItemData> itemData = GameData.buildWorldItemData(list);
        GameData.validateWorldSave(itemData);
        MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
        if (serverDifference!=null)
        {
            FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);

        }
    }
    catch (IOException e)
    {
    }
}
项目:BetterNutritionMod    文件:ModIdMapPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    byte[] allData = Bytes.concat(partials);
    GameData.initializeServerGate(1);
    try
    {
        NBTTagCompound serverList = CompressedStreamTools.decompress(allData);
        NBTTagList list = serverList.getTagList("List");
        Set<ItemData> itemData = GameData.buildWorldItemData(list);
        GameData.validateWorldSave(itemData);
        MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
        if (serverDifference!=null)
        {
            FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);

        }
    }
    catch (IOException e)
    {
    }
}
项目:OreDupeFix    文件:OreDupeFix.java   
/**
 * Dump ore dictionary
 */
public static void dumpOreDict() {
    Map<Integer, ItemData> idMap = ReflectionHelper.getPrivateValue(GameData.class, null, "idMap");

    List<String> oreNames = Arrays.asList(OreDictionary.getOreNames());
    Collections.sort(oreNames);

    for (String oreName : oreNames) {
        StringBuffer sb = new StringBuffer();

        sb.append("ore: " + oreName + ": ");
        ArrayList<ItemStack> oreItems = OreDictionary.getOres(oreName);
        for (ItemStack oreItem : oreItems) {
            ItemData itemData = idMap.get(oreItem.itemID);
            String modID = itemData.getModId();

            sb.append(oreItem.itemID + ":" + oreItem.getItemDamage() + "=" + modID + ", ");
        }
        System.out.println(sb);
    }
}
项目:WikiLink    文件:Link.java   
public static void buildmodIdItemIdHashMap()
{
    NBTTagList itemDataList = new NBTTagList();

    GameData.writeItemData(itemDataList);
    for (int i = 0; i < itemDataList.tagCount(); i++)
    {
        ItemData data = new ItemData((NBTTagCompound) itemDataList.tagAt(i));
            modIdItemIdMapping.put(data.getItemId(), data.getModId());
    }
}
项目:RuneCraftery    文件:FMLClientHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
    boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
    for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
    {
        ValueDifference<ItemData> vd = mismatch.getValue();
        if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
        {
            criticalMismatch = true;
        }
    }

    if (!criticalMismatch)
    {
        // We'll carry on with this connection, and just log a message instead
        return;
    }
    // Nuke the connection
    ((NetClientHandler)toKill).func_72553_e();
    // Stop GuiConnecting
    GuiConnecting.forceTermination((GuiConnecting)client.field_71462_r);
    // pulse the network manager queue to clear cruft
    mgr.func_74428_b();
    // Nuke the world client
    client.func_71403_a((WorldClient)null);
    // Show error screen
    warnIDMismatch(s, false);
}
项目:RuneCraftery    文件:FMLClientHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
    boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
    for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
    {
        ValueDifference<ItemData> vd = mismatch.getValue();
        if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
        {
            criticalMismatch = true;
        }
    }

    if (!criticalMismatch)
    {
        // We'll carry on with this connection, and just log a message instead
        return;
    }
    // Nuke the connection
    ((NetClientHandler)toKill).disconnect();
    // Stop GuiConnecting
    GuiConnecting.forceTermination((GuiConnecting)client.currentScreen);
    // pulse the network manager queue to clear cruft
    mgr.processReadPackets();
    // Nuke the world client
    client.loadWorld((WorldClient)null);
    // Show error screen
    warnIDMismatch(s, false);
}
项目:RuneCraftery    文件:Minecraft.java   
/**
 * Arguments: World foldername,  World ingame name, WorldSettings
 */
public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings)
{
    this.loadWorld((WorldClient)null);
    System.gc();
    ISaveHandler isavehandler = this.saveLoader.getSaveLoader(par1Str, false);
    WorldInfo worldinfo = isavehandler.loadWorldInfo();

    if (worldinfo == null && par3WorldSettings != null)
    {
        worldinfo = new WorldInfo(par3WorldSettings, par1Str);
        isavehandler.saveWorldInfo(worldinfo);
    }

    if (par3WorldSettings == null)
    {
        par3WorldSettings = new WorldSettings(worldinfo);
    }

    this.statFileWriter.readStat(StatList.startGameStat, 1);

    GameData.initializeServerGate(2);

    this.theIntegratedServer = new IntegratedServer(this, par1Str, par2Str, par3WorldSettings);
    this.theIntegratedServer.startServerThread();

    MapDifference<Integer, ItemData> idDifferences = GameData.gateWorldLoadingForValidation();
    if (idDifferences!=null)
    {
        FMLClientHandler.instance().warnIDMismatch(idDifferences, true);
    }
    else
    {
        GameData.releaseGate(true);
        continueWorldLoading();
    }

}
项目:BetterNutritionMod    文件:FMLClientHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
    boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
    for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
    {
        ValueDifference<ItemData> vd = mismatch.getValue();
        if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
        {
            criticalMismatch = true;
        }
    }

    if (!criticalMismatch)
    {
        // We'll carry on with this connection, and just log a message instead
        return;
    }
    // Nuke the connection
    ((NetClientHandler)toKill).disconnect();
    // Stop GuiConnecting
    GuiConnecting.forceTermination((GuiConnecting)client.currentScreen);
    // pulse the network manager queue to clear cruft
    mgr.processReadPackets();
    // Nuke the world client
    client.loadWorld((WorldClient)null);
    // Show error screen
    warnIDMismatch(s, false);
}
项目:BetterNutritionMod    文件:Minecraft.java   
/**
 * Arguments: World foldername,  World ingame name, WorldSettings
 */
public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings)
{
    this.loadWorld((WorldClient)null);
    System.gc();
    ISaveHandler isavehandler = this.saveLoader.getSaveLoader(par1Str, false);
    WorldInfo worldinfo = isavehandler.loadWorldInfo();

    if (worldinfo == null && par3WorldSettings != null)
    {
        worldinfo = new WorldInfo(par3WorldSettings, par1Str);
        isavehandler.saveWorldInfo(worldinfo);
    }

    if (par3WorldSettings == null)
    {
        par3WorldSettings = new WorldSettings(worldinfo);
    }

    this.statFileWriter.readStat(StatList.startGameStat, 1);

    GameData.initializeServerGate(2);

    this.theIntegratedServer = new IntegratedServer(this, par1Str, par2Str, par3WorldSettings);
    this.theIntegratedServer.startServerThread();

    MapDifference<Integer, ItemData> idDifferences = GameData.gateWorldLoadingForValidation();
    if (idDifferences!=null)
    {
        FMLClientHandler.instance().warnIDMismatch(idDifferences, true);
    }
    else
    {
        GameData.releaseGate(true);
        continueWorldLoading();
    }

}
项目:RuneCraftery    文件:FMLClientHandler.java   
public void warnIDMismatch(MapDifference<Integer, ItemData> idDifferences, boolean mayContinue)
{
    GuiIdMismatchScreen mismatch = new GuiIdMismatchScreen(idDifferences, mayContinue);
    client.func_71373_a(mismatch);
}
项目:RuneCraftery    文件:FMLServerHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler handler, INetworkManager mgr)
{

}
项目:RuneCraftery    文件:FMLCommonHandler.java   
public void disconnectIDMismatch(MapDifference<Integer, ItemData> serverDifference, NetHandler toKill, INetworkManager network)
{
    sidedDelegate.disconnectIDMismatch(serverDifference, toKill, network);
}
项目:RuneCraftery    文件:FMLClientHandler.java   
public void warnIDMismatch(MapDifference<Integer, ItemData> idDifferences, boolean mayContinue)
{
    GuiIdMismatchScreen mismatch = new GuiIdMismatchScreen(idDifferences, mayContinue);
    client.displayGuiScreen(mismatch);
}
项目:RuneCraftery    文件:FMLServerHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler handler, INetworkManager mgr)
{

}
项目:RuneCraftery    文件:FMLCommonHandler.java   
public void disconnectIDMismatch(MapDifference<Integer, ItemData> serverDifference, NetHandler toKill, INetworkManager network)
{
    sidedDelegate.disconnectIDMismatch(serverDifference, toKill, network);
}
项目:BetterNutritionMod    文件:FMLClientHandler.java   
public void warnIDMismatch(MapDifference<Integer, ItemData> idDifferences, boolean mayContinue)
{
    GuiIdMismatchScreen mismatch = new GuiIdMismatchScreen(idDifferences, mayContinue);
    client.displayGuiScreen(mismatch);
}
项目:BetterNutritionMod    文件:FMLServerHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler handler, INetworkManager mgr)
{

}
项目:BetterNutritionMod    文件:FMLCommonHandler.java   
public void disconnectIDMismatch(MapDifference<Integer, ItemData> serverDifference, NetHandler toKill, INetworkManager network)
{
    sidedDelegate.disconnectIDMismatch(serverDifference, toKill, network);
}
项目:RuneCraftery    文件:IFMLSidedHandler.java   
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);
项目:RuneCraftery    文件:IFMLSidedHandler.java   
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);
项目:BetterNutritionMod    文件:IFMLSidedHandler.java   
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);