Java 类cpw.mods.fml.common.FMLLog 实例源码

项目:Uranium    文件:CraftBlock.java   
public static void dumpMaterials() {
    if (MinecraftServer.getServer().cauldronConfig.dumpMaterials.getValue())
    {
        FMLLog.info("Cauldron Dump Materials is ENABLED. Starting dump...");
        for (int i = 0; i < 32000; i++)
        {
            Material material = Material.getMaterial(i);
            if (material != null)
            {
                FMLLog.info("Found material " + material + " with ID " + i);
            }
        }
        FMLLog.info("Cauldron Dump Materials complete.");
        FMLLog.info("To disable these dumps, set cauldron.dump-materials to false in bukkit.yml.");
    }
}
项目:Uranium    文件:UraniumClassTransformer.java   
@Override
public void transform(final ImagineASM asm) {
    if (asm.is("climateControl.utils.ChunkGeneratorExtractor")) {
        boolean undergroundBiomesInstalled = false;
        try {
            Class.forName("exterminatorJeff.undergroundBiomes.worldGen.ChunkProviderWrapper");
            undergroundBiomesInstalled = true;
        } catch (Exception ignored) {
        }
        if (!undergroundBiomesInstalled) {
            FMLLog.log(Level.INFO, "Uranium: Patching " + asm.getActualName() + " for compatibility with Climate Control");
            extractFrom(asm, asm.method("extractFrom",
                    "(Lnet/minecraft/world/WorldServer;)Lnet/minecraft/world/chunk/IChunkProvider;").instructions());
        }
    }
}
项目:TRAPPIST-1    文件:TPBiomeConfig.java   
private static void syncConfig(boolean load) {
    List<String> propOrder = new ArrayList<String>();
    try {
        Property prop = null;
        if(!config.isChild) {
            if(load) {
                config.load();
            }
        }

        biomeIDSpace = getIntegerConfigNode(config, prop, propOrder, Constants.CONFIG_CATEGORY_DIMENSIONS, "biomeIDSpace", "Biome ID for Space.", 100);

        config.setCategoryPropertyOrder(CATEGORY_GENERAL, propOrder);

           if (config.hasChanged())
           {
               config.save();
           }
    }catch (final Exception ex) {
        FMLLog.log(Level.ERROR, ex, "Trappist-1 has a problem loading it's config, this can have negative repercussions.");
    }
}
项目:TRAPPIST-1    文件:TPDimensionConfig.java   
private static void syncConfig(boolean load) {
    List<String> propOrder = new ArrayList<String>();
    try {
        Property prop = null;
        if(!config.isChild) {
            if(load) {
                config.load();
            }
        }

        dimensionIDTrappistOneB = getIntegerConfigNode(config, prop, propOrder, Constants.CONFIG_CATEGORY_DIMENSIONS, "dimensionIDTrappistOneB", "Dimension ID for Trappist-1B.", -35);
        dimensionIDTrappistOneC = getIntegerConfigNode(config, prop, propOrder, Constants.CONFIG_CATEGORY_DIMENSIONS, "dimensionIDTrappistOneC", "Dimension ID for Trappist-1C.", -36);

        config.setCategoryPropertyOrder(CATEGORY_GENERAL, propOrder);

           if (config.hasChanged())
           {
               config.save();
           }
    }catch (final Exception ex) {
        FMLLog.log(Level.ERROR, ex, "Trappist-1 has a problem loading it's config, this can have negative repercussions.");
    }
}
项目:Technical    文件:TileEntityAutoWorkBench.java   
public void updateEntity() {
    FMLLog.log(Level.INFO, "A");
    if(!worldObj.isRemote) {
        useItemToGetEnergy();
        if(canCraft()) {
            FMLLog.log(Level.INFO, "C");
            progress++;
            currentEnergy--;
            if(progress >= totalTime) {
                FMLLog.log(Level.INFO, "D");
                craftItem();
            }
        }
    }

    FMLLog.log(Level.INFO, "N");
    this.markDirty();
}
项目:Technical    文件:TileEntityAutoWorkBench.java   
public boolean useItemToGetEnergy() {
    if(machineItemStacks[0] == null) {
        return false;
    }
    if(getItemBurnTimeBurning(machineItemStacks[0]) > 0 && currentEnergy + getItemBurnTimeBurning(machineItemStacks[0]) < maxEnergy) {
        currentEnergy += getItemBurnTimeBurning(machineItemStacks[0]);
        machineItemStacks[0].stackSize--;
        FMLLog.log(Level.INFO, "B" + true);
        return true;
    }
    if(getItemBurnTimeElectrical(machineItemStacks[0]) > 0 && currentEnergy + getItemBurnTimeElectrical(machineItemStacks[0]) < maxEnergy) {
        currentEnergy += getItemBurnTimeElectrical(machineItemStacks[0]);
        machineItemStacks[0].stackSize--;
        FMLLog.log(Level.INFO, "B" + true);
        return true;
    }
    FMLLog.log(Level.INFO, "B" + false);
    return false;
}
项目:Technical    文件:TileEntityAutoWorkBench.java   
public boolean canCraft() {
    if(currentEnergy <= 0) {
        FMLLog.log(Level.INFO, "Ba");
        currentEnergy = 0;
        return false;
    } else {
        FMLLog.log(Level.INFO, "Bb");
        InventoryCrafting inv = new InventoryCrafting(new ContainerAutoWorkBench(new InventoryPlayer(null), this), 3, 3);
        for(int i = 1; i < machineItemStacks.length - 1; i++) {
            inv.setInventorySlotContents(i - 1, machineItemStacks[i - 1]);
            FMLLog.log(Level.INFO, "Bc" + (i - 1));
        }
        ItemStack stack = AutoWorkBenchRecipes.smelting().getSmeltingResult(inv, worldObj, Tier.normal)[0];
        FMLLog.log(Level.INFO, "Bd" + (stack != null));
        return stack != null;
    }
}
项目:Technical    文件:TechnicalWorldGenerator.java   
private void removeStone(World world, Random random, int x, int z) {
    int id = world.getBiomeGenForCoords(x, z).biomeID;
    Block block = Blocks.stone;

    if(id == 35 || id == 163 || id == 29 || id == 157 || id == 6 || id == 134 || id == 160 || id == 161 || id == 32 || id == 33) {
        block = Granite;
    } else if(id == 36 || id == 164 || id == 16 || id == 14 || id == 15 || id == 0 || id == 24 || id == 26) {
        block = Basalt;
    } else if(id == 2 || id == 1 || id == 7 || id == 129 || id == 5 || id == 30 || id == 11) {
        block = Limestone;
    } else if(id == 130 || id == 17 || id == 21 || id == 149 || id == 23 || id == 151 || id == 22 || id == 133 || id == 155 || id == 19 || id == 31 || id == 158 || id == 27) {
        block = Shale;
    } else if(id == 37 || id == 165 || id == 132 || id == 4 || id == 3 || id == 131 || id == 34 || id == 162 || id == 28 || id == 156 || id == 25) {
        block = Slate;
    } else if(id == 39 || id == 167 || id == 38 || id == 166 || id == 18 || id == 13 || id == 12 || id == 140) {
        block = Gneiss;
    } else {
        FMLLog.log(Level.ERROR, Technical.modName + ": TechnicalWorldGenerator could not find stone type for " + world.getBiomeGenForCoords(x, z).biomeName + " (id " + id + "). Please report this to the mod author(s)");
    }

    for(int y = 0; y < world.getActualHeight(); y++) {
        if(world.getBlock(x, y, z) == Blocks.stone)
            world.setBlock(x, y, z, block, 0, 0);
    }
}
项目:Technical    文件:TileEntityGrabber.java   
protected int getSlotToPushTo(IInventory inventory) {
    int slot = 0;
    for(; slot < inventory.getSizeInventory(); ++slot) {
        if(debug) {
            FMLLog.log(Level.INFO, "E " + (inventory.getStackInSlot(slot) != null));
            if(inventory.getStackInSlot(slot) != null) {
                FMLLog.log(Level.INFO, "E " + slot + " " + inventory.getStackInSlot(slot).toString());
                FMLLog.log(Level.INFO, "E-true " + (inventory.getStackInSlot(slot) == null));
                FMLLog.log(Level.INFO, "E-true " + (inventory.getStackInSlot(slot).getItem() == blockItemStack.getItem()));
                FMLLog.log(Level.INFO, "E-true " + (inventory.getStackInSlot(slot).getItemDamage() == blockItemStack.getItemDamage()));
                FMLLog.log(Level.INFO, "E-true " + inventory.getStackInSlot(slot).stackSize + " < " + inventory.getStackInSlot(slot).getItem().getItemStackLimit(inventory.getStackInSlot(slot)));
            }
        }
        if(inventory.getStackInSlot(slot) == null || inventory.getStackInSlot(slot).getItem() == blockItemStack.getItem() && inventory.getStackInSlot(slot).getItemDamage() == blockItemStack.getItemDamage()
                && inventory.getStackInSlot(slot).stackSize < inventory.getStackInSlot(slot).getItem().getItemStackLimit(inventory.getStackInSlot(slot)))
            break;
    }

    if(slot > inventory.getSizeInventory() - 1)
        slot = inventory.getSizeInventory() - 1;

    if(debug)
        FMLLog.log(Level.INFO, "E" + slot);

    return slot;
}
项目:Technical    文件:TileEntityGrabber.java   
protected boolean pushItemIInventory(IInventory inventory, int slot) {
    if(inventory.getStackInSlot(slot) == null) {
        if(debug)
            FMLLog.log(Level.INFO, "F");
        inventory.setInventorySlotContents(slot, blockItemStack.copy());
        blockItemStack = null;
        markDirty = true;
    } else if(inventory.getStackInSlot(slot).getItem() == blockItemStack.getItem() && inventory.getStackInSlot(slot).stackSize < inventory.getInventoryStackLimit() && inventory.getStackInSlot(slot).stackSize < inventory.getStackInSlot(slot).getMaxStackSize()) {
        if(debug)
            FMLLog.log(Level.INFO, "G");
        blockItemStack.stackSize = blockItemStack.stackSize + inventory.getStackInSlot(slot).stackSize;
        inventory.setInventorySlotContents(slot, blockItemStack.copy());
        blockItemStack = null;
        markDirty = true;
    } else {
        if(debug)
            FMLLog.log(Level.INFO, "Ga");
    }
    return markDirty;
}
项目:Technical    文件:TileEntityGrabberFiltering.java   
protected boolean pushItemTechnicalAutoTileEntity() {
    if(debug)
        FMLLog.log(Level.INFO, "fC");
    TechnicalAutoTileEntity pushTileEntity = (TechnicalAutoTileEntity) pushTileEntity();
    if(blockItemStack.stackSize > 1) {
        ItemStack oldStack = blockItemStack.copy();
        ItemStack newStack = blockItemStack.splitStack(1);
        newStack = pushTileEntity.pushItem(newStack, -1);
        if(newStack == null || newStack.stackSize == 0) {
            if(debug)
                FMLLog.log(Level.INFO, "fDa");
            markDirty = true;
        } else {
            blockItemStack = oldStack;
        }
    }
    return markDirty;
}
项目:Technical    文件:TileEntityGrabberFiltering.java   
protected boolean pullItemTechnicalAutoTileEntity() {
    if(debug)
        FMLLog.log(Level.INFO, "fI");
    TechnicalAutoTileEntity pullTileEntity = (TechnicalAutoTileEntity) pullTileEntity();
    if(blockItemStack == null || blockItemStack.stackSize == 0) {
        blockItemStack = pullTileEntity.pullItem(-1, 1);
        markDirty = true;
    } else {
        ItemStack pulledItem = pullTileEntity.pullItem(-1, 1, blockItemStack);
        if(pulledItem != null)
            blockItemStack.stackSize += pulledItem.stackSize;
        pulledItem = null;
        markDirty = true;
    }
    return markDirty;
}
项目:TRHS_Club_Mod_2016    文件:ForgeChunkManager.java   
public static Ticket requestPlayerTicket(Object mod, String player, World world, Type type)
{
    ModContainer mc = getContainer(mod);
    if (mc == null)
    {
        FMLLog.log(Level.ERROR, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
        return null;
    }
    if (playerTickets.get(player).size()>playerTicketLength)
    {
        FMLLog.warning("Unable to assign further chunkloading tickets to player %s (on behalf of mod %s)", player, mc.getModId());
        return null;
    }
    Ticket ticket = new Ticket(mc.getModId(),type,world,player);
    playerTickets.put(player, ticket);
    tickets.get(world).put("Forge", ticket);
    return ticket;
}
项目:4Space-5    文件:GalacticraftRegistry.java   
/***
 * Now returns a boolean to indicate whether registration of the WorldProvider type was successful.
 * (If it failed, you should probably set the CelestialBody as unreachable.)
 * 
 * @param id
 * @param provider
 * @param keepLoaded
 * @return <boolean> success
 */
public static boolean registerProvider(int id, Class<? extends WorldProvider> provider, boolean keepLoaded, int defaultID)
{
    boolean flag = DimensionManager.registerProviderType(id, provider, keepLoaded);
    if (flag)
    {
        GalacticraftRegistry.worldProviderIDs.add(id);
        return true;
    }
    else
    {
        GalacticraftRegistry.worldProviderIDs.add(defaultID);  //Adding the 0 here preserves the order, important for network compatibility between GC versions
        FMLLog.severe("Could not register dimension " + id + " - does it clash with another mod?  Change the ID in config.");
        return false;
    }
}
项目:TRHS_Club_Mod_2016    文件:AdvancedModelLoader.java   
/**
 * Load the model from the supplied classpath resolvable resource name
 * @param resource The resource name
 * @return A model
 * @throws IllegalArgumentException if the resource name cannot be understood
 * @throws ModelFormatException if the underlying model handler cannot parse the model format
 */
public static IModelCustom loadModel(ResourceLocation resource) throws IllegalArgumentException, ModelFormatException
{
    String name = resource.func_110623_a();
    int i = name.lastIndexOf('.');
    if (i == -1)
    {
        FMLLog.severe("The resource name %s is not valid", resource);
        throw new IllegalArgumentException("The resource name is not valid");
    }
    String suffix = name.substring(i+1);
    IModelCustomLoader loader = instances.get(suffix);
    if (loader == null)
    {
        FMLLog.severe("The resource name %s is not supported", resource);
        throw new IllegalArgumentException("The resource name is not supported");
    }

    return loader.loadInstance(resource);
}
项目:TweakCraft    文件:ItemApi.java   
public static ItemStack getBlock(String itemString, int meta) {
    ItemStack item = null;
    try {
        String itemClass = "thaumcraft.common.config.ConfigBlocks";
        Object obj = Class.forName(itemClass).getField(itemString).get(null);
        if (obj instanceof Block) {
            item = new ItemStack((Block) obj, 1, meta);
        }
        else if (obj instanceof ItemStack) {
            item = (ItemStack) obj;
        }
    }
    catch (Exception ex) {
        FMLLog.warning("[Thaumcraft] Could not retrieve block identified by: " + itemString);
    }
    return item;
}
项目:4Space-5    文件:ConfigManagerMicCore.java   
public static void syncConfig()
{
    try
    {
        ConfigManagerMicCore.enableSmallMoons = ConfigManagerMicCore.configuration.get(Configuration.CATEGORY_GENERAL, "Enable Small Moons", true, "This will cause some dimensions to appear round, disable if render transformations cause a conflict.").getBoolean(true);
        ConfigManagerMicCore.enableDebug = ConfigManagerMicCore.configuration.get(Configuration.CATEGORY_GENERAL, "Enable Debug messages", false, "Enable debug messages during Galacticraft bytecode injection at startup.").getBoolean(false);
    }
    catch (final Exception e)
    {
        FMLLog.severe("Problem loading core config (\"miccore.conf\")");
    }
    finally
    {
        if (ConfigManagerMicCore.configuration.hasChanged())
        {
            ConfigManagerMicCore.configuration.save();
        }

        ConfigManagerMicCore.loaded = true;
    }
}
项目:4Space-5    文件:ClassDiscoverer.java   
private void findClasspathMods() {
    List<String> knownLibraries = ImmutableList.<String>builder()
            .addAll(modClassLoader.getDefaultLibraries())
            .addAll(CoreModManager.getLoadedCoremods()).build();
    File[] minecraftSources = modClassLoader.getParentSources();
    HashSet<String> searchedSources = new HashSet<String>();
    for (File minecraftSource : minecraftSources) {
        if (searchedSources.contains(minecraftSource.getAbsolutePath()))
            continue;
        searchedSources.add(minecraftSource.getAbsolutePath());

        if (minecraftSource.isFile()) {
            if (!knownLibraries.contains(minecraftSource.getName())) {
                FMLLog.fine("Found a minecraft related file at %s, examining for codechicken classes", minecraftSource.getAbsolutePath());
                try {
                    readFromZipFile(minecraftSource);
                } catch (Exception e) {
                    CodeChickenCorePlugin.logger.error("Failed to scan " + minecraftSource.getAbsolutePath() + ", the zip file is invalid", e);
                }
            }
        } else if (minecraftSource.isDirectory()) {
            FMLLog.fine("Found a minecraft related directory at %s, examining for codechicken classes", minecraftSource.getAbsolutePath());
            readFromDirectory(minecraftSource, minecraftSource);
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLClientHandler.java   
private void detectOptifine()
{
    try
    {
        Class<?> optifineConfig = Class.forName("Config", false, Loader.instance().getModClassLoader());
        String optifineVersion = (String) optifineConfig.getField("VERSION").get(null);
        Map<String,Object> dummyOptifineMeta = ImmutableMap.<String,Object>builder().put("name", "Optifine").put("version", optifineVersion).build();
        ModMetadata optifineMetadata = MetadataCollection.from(getClass().getResourceAsStream("optifinemod.info"),"optifine").getMetadataForId("optifine", dummyOptifineMeta);
        optifineContainer = new DummyModContainer(optifineMetadata);
        FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features",optifineContainer.getVersion());
    }
    catch (Exception e)
    {
        optifineContainer = null;
    }
}
项目:ThermosRebased    文件:CraftBlock.java   
public static void dumpMaterials() {
    if (MinecraftServer.getServer().cauldronConfig.dumpMaterials.getValue())
    {
        FMLLog.info("Cauldron Dump Materials is ENABLED. Starting dump...");
        for (int i = 0; i < 32000; i++)
        {
            Material material = Material.getMaterial(i);
            if (material != null)
            {
                FMLLog.info("Found material " + material + " with ID " + i);
            }
        }
        FMLLog.info("Cauldron Dump Materials complete.");
        FMLLog.info("To disable these dumps, set cauldron.dump-materials to false in bukkit.yml.");
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLFileResourcePack.java   
@Override
protected InputStream func_110591_a(String resourceName) throws IOException
{
    try
    {
        return super.func_110591_a(resourceName);
    }
    catch (IOException ioe)
    {
        if ("pack.mcmeta".equals(resourceName))
        {
            FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName());
            return new ByteArrayInputStream(("{\n" +
                    " \"pack\": {\n"+
                    "   \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
                    "   \"pack_format\": 1\n"+
                    "}\n" +
                    "}").getBytes(Charsets.UTF_8));
        }
        else throw ioe;
    }
}
项目:TRHS_Club_Mod_2016    文件:GuiModList.java   
@Override
protected void func_146284_a(GuiButton button) {
    if (button.field_146124_l)
    {
        switch (button.field_146127_k)
        {
            case 6:
                this.field_146297_k.func_147108_a(this.mainMenu);
                return;
            case 20:
                try
                {
                    IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
                    GuiScreen newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this);
                    this.field_146297_k.func_147108_a(newScreen);
                }
                catch (Exception e)
                {
                    FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId());
                }
                return;
        }
    }
    super.func_146284_a(button);
}
项目:TweakCraft    文件:ResearchCategories.java   
public static void addResearch(ResearchItem ri) {
    ResearchCategoryList rl = getResearchList(ri.category);
    if ( (rl != null) && !rl.research.containsKey(ri.key)) {
        if (!ri.isVirtual()) {
            for (ResearchItem rr : rl.research.values()) {
                if ( (rr.displayColumn == ri.displayColumn) && (rr.displayRow == ri.displayRow)) {
                    FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
                    return;
                }
            }
        }
        rl.research.put(ri.key, ri);
        if (ri.displayColumn < rl.minDisplayColumn) {
            rl.minDisplayColumn = ri.displayColumn;
        }
        if (ri.displayRow < rl.minDisplayRow) {
            rl.minDisplayRow = ri.displayRow;
        }
        if (ri.displayColumn > rl.maxDisplayColumn) {
            rl.maxDisplayColumn = ri.displayColumn;
        }
        if (ri.displayRow > rl.maxDisplayRow) {
            rl.maxDisplayRow = ri.displayRow;
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLNetworkHandler.java   
public static String checkModList(Map<String,String> listData, Side side)
{
    List<ModContainer> rejects = Lists.newArrayList();
    for (Entry<ModContainer, NetworkModHolder> networkMod : NetworkRegistry.INSTANCE.registry().entrySet())
    {
        boolean result = networkMod.getValue().check(listData, side);
        if (!result)
        {
            rejects.add(networkMod.getKey());
        }
    }
    if (rejects.isEmpty())
    {
        return null;
    }
    else
    {
        FMLLog.info("Rejecting connection %s: %s", side, rejects);
        return String.format("Mod rejections %s",rejects);
    }
}
项目:TRHS_Club_Mod_2016    文件:ForgeMessage.java   
@Override
void fromBytes(ByteBuf bytes)
{
    int listSize = bytes.readInt();
    for (int i = 0; i < listSize; i++) {
        String fluidName = ByteBufUtils.readUTF8String(bytes);
        int fluidId = bytes.readInt();
        fluidIds.put(FluidRegistry.getFluid(fluidName), fluidId);
    }
    // do we have a defaults list?

    if (bytes.isReadable())
    {
        for (int i = 0; i < listSize; i++)
        {
            defaultFluids.add(ByteBufUtils.readUTF8String(bytes));
        }
    }
    else
    {
        FMLLog.getLogger().log(Level.INFO, "Legacy server message contains no default fluid list - there may be problems with fluids");
        defaultFluids.clear();
    }
}
项目:TRHS_Club_Mod_2016    文件:GameData.java   
private void testConsistency() {
    // test if there's an entry for every set bit in availabilityMap
    for (int i = availabilityMap.nextSetBit(0); i >= 0; i = availabilityMap.nextSetBit(i+1))
    {
        if (iBlockRegistry.getRaw(i) == null && iItemRegistry.getRaw(i) == null && !blockedIds.contains(i))
        {
            throw new IllegalStateException(String.format("availabilityMap references empty entries for id %d.", i));
        }
    }

    for (int pass = 0; pass < 2; pass++)
    {
        boolean isBlock = pass == 0;
        String type = isBlock ? "block" : "item";
        FMLControlledNamespacedRegistry<?> registry = isBlock ? iBlockRegistry : iItemRegistry;
        registry.validateContent((isBlock ? MAX_BLOCK_ID : MAX_ITEM_ID), type, availabilityMap, blockedIds, iBlockRegistry);
    }

    FMLLog.fine("Registry consistency check successful");
}
项目:TRHS_Club_Mod_2016    文件:EntityRegistry.java   
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id)
{
    if (EntityList.field_75626_c.containsKey(entityClass))
    {
        ModContainer activeModContainer = Loader.instance().activeModContainer();
        String modId = "unknown";
        if (activeModContainer != null)
        {
            modId = activeModContainer.getModId();
        }
        else
        {
            FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped.");
        }
        FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass);
        return;
    }
    id = instance().validateAndClaimId(id);
    EntityList.func_75618_a(entityClass, entityName, id);
}
项目:TRHS_Club_Mod_2016    文件:EntityRegistry.java   
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
{
    if (EntityList.field_75626_c.containsKey(entityClass))
    {
        ModContainer activeModContainer = Loader.instance().activeModContainer();
        String modId = "unknown";
        if (activeModContainer != null)
        {
            modId = activeModContainer.getModId();
        }
        else
        {
            FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped.");
        }
        FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass);
        return;
    }
    instance().validateAndClaimId(id);
    EntityList.func_75614_a(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
}
项目:TRHS_Club_Mod_2016    文件:LanguageRegistry.java   
/**
 * Deprecated for removal in 1.8. Use the assets lang system
 */
@Deprecated
public void loadLocalization(String localizationFile, String lang, boolean isXML)
{
    URL urlResource = this.getClass().getResource(localizationFile);
    if (urlResource != null)
    {
        loadLocalization(urlResource, lang, isXML);
    }
    else
    {
        ModContainer activeModContainer = Loader.instance().activeModContainer();
        if (activeModContainer!=null)
        {
            FMLLog.log(activeModContainer.getModId(), Level.ERROR, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile);
        }
        else
        {
            FMLLog.log(Level.ERROR, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile);
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:LanguageRegistry.java   
private void searchZipForLanguages(File source, Side side) throws IOException
{
    ZipFile zf = new ZipFile(source);
    List<String> added = Lists.newArrayList();
    for (ZipEntry ze : Collections.list(zf.entries()))
    {
        Matcher matcher = assetENUSLang.matcher(ze.getName());
        if (matcher.matches())
        {
            String lang = matcher.group(2);
            //FMLLog.fine("Injecting found translation data for lang %s in zip file %s at %s into language system", lang, source.getName(), ze.getName());
            added.add(lang);
            LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(zf.getInputStream(ze)));
            // Ensure en_US is available to StringTranslate on the server
            if ("en_US".equals(lang) && side == Side.SERVER)
            {
                StringTranslate.inject(zf.getInputStream(ze));
            }
        }
    }
    if (added.size() > 0)
        FMLLog.fine("Found translations in %s [%s]", source.getName(), Joiner.on(", ").join(added));
    zf.close();
}
项目:TRHS_Club_Mod_2016    文件:LanguageRegistry.java   
private void searchDirForLanguages(File source, String path, Side side) throws IOException
{
    for (File file : source.listFiles())
    {
        String currPath = path+file.getName();
        if (file.isDirectory())
        {
            searchDirForLanguages(file, currPath+'/', side);
        }
        Matcher matcher = assetENUSLang.matcher(currPath);
        if (matcher.matches())
        {
            String lang = matcher.group(2);
            FMLLog.fine("Injecting found translation assets for lang %s at %s into language system", lang, currPath);
            LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(new FileInputStream(file)));
            // Ensure en_US is available to StringTranslate on the server
            if ("en_US".equals(lang) && side == Side.SERVER)
            {
                StringTranslate.inject(new FileInputStream(file));
            }
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLControlledNamespacedRegistry.java   
void addSubstitutionAlias(String modId, String nameToReplace, Object toReplace) throws ExistingSubstitutionException {
    if (getPersistentSubstitutions().containsKey(nameToReplace) || getPersistentSubstitutions().containsValue(toReplace))
    {
        FMLLog.severe("The substitution of %s has already occured. You cannot duplicate substitutions", nameToReplace);
        throw new ExistingSubstitutionException(nameToReplace, toReplace);
    }
    I replacement = cast(toReplace);
    I original = getRaw(nameToReplace);
    if (original == null)
    {
        throw new NullPointerException("The replacement target is not present. This won't work");
    }
    if (!original.getClass().isAssignableFrom(replacement.getClass()))
    {
        FMLLog.severe("The substitute %s for %s (type %s) is type incompatible. This won't work", replacement.getClass().getName(), nameToReplace, original.getClass().getName());
        throw new IncompatibleSubstitutionException(nameToReplace, replacement, original);
    }
    int existingId = getId(replacement);
    if (existingId != -1)
    {
        FMLLog.severe("The substitute %s for %s is registered into the game independently. This won't work", replacement.getClass().getName(), nameToReplace);
        throw new IllegalArgumentException("The object substitution is already registered. This won't work");
    }
    getPersistentSubstitutions().put(nameToReplace, replacement);
}
项目:TRHS_Club_Mod_2016    文件:ForgeChunkManager.java   
static void captureConfig(File configDir)
{
    cfgFile = new File(configDir,"forgeChunkLoading.cfg");
    config = new Configuration(cfgFile, true);
    try
    {
        config.load();
    }
    catch (Exception e)
    {
        File dest = new File(cfgFile.getParentFile(),"forgeChunkLoading.cfg.bak");
        if (dest.exists())
        {
            dest.delete();
        }
        cfgFile.renameTo(dest);
        FMLLog.log(Level.ERROR, e, "A critical error occured reading the forgeChunkLoading.cfg file, defaults will be used - the invalid file is backed up at forgeChunkLoading.cfg.bak");
    }
    syncConfigDefaults();
}
项目:TRHS_Club_Mod_2016    文件:FluidStack.java   
public FluidStack(Fluid fluid, int amount)
{
    if (fluid == null)
    {
        FMLLog.bigWarning("Null fluid supplied to fluidstack. Did you try and create a stack for an unregistered fluid?");
        throw new IllegalArgumentException("Cannot create a fluidstack from a null fluid");
    }
    else if (!FluidRegistry.isFluidRegistered(fluid))
    {
        FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid %s (type %s)", fluid.getName(), fluid.getClass().getName());
        throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid");
    }
    this.fluidDelegate = FluidRegistry.makeDelegate(fluid);
    this.amount = amount;
    this.fluid = fluid;
}
项目:TRHS_Club_Mod_2016    文件:FluidRegistry.java   
public static void loadFluidDefaults(NBTTagCompound tag)
{
    Set<String> defaults = Sets.newHashSet();
    if (tag.func_150297_b("DefaultFluidList",9))
    {
        FMLLog.getLogger().log(Level.DEBUG, "Loading persistent fluid defaults from world");
        NBTTagList tl = tag.func_150295_c("DefaultFluidList", 8);
        for (int i = 0; i < tl.func_74745_c(); i++)
        {
            defaults.add(tl.func_150307_f(i));
        }
    }
    else
    {
        FMLLog.getLogger().log(Level.DEBUG, "World is missing persistent fluid defaults - using local defaults");
    }
    loadFluidDefaults(HashBiMap.create(fluidIDs), defaults);
}
项目:Uranium    文件:CraftServer.java   
@Override
public boolean unloadWorld(World world, boolean save) {
    if (world == null) {
        return false;
    }

    net.minecraft.world.WorldServer handle = ((CraftWorld) world).getHandle();

    if (!(console.worlds.contains(handle))) {
        return false;
    }

    if (handle.playerEntities.size() > 0) {
        return false;
    }

    WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
    pluginManager.callEvent(e);

    if (e.isCancelled()) {
        return false;
    }

    if (save) {
        try {
            handle.saveAllChunks(true, null);
            handle.flush();
            WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
            getPluginManager().callEvent(event);
        } catch (net.minecraft.world.MinecraftException ex) {
            getLogger().log(Level.SEVERE, null, ex);
            FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, "Failed to save world " + handle.getWorld().getName() + " while unloading it.");
        }
    }
    MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(handle)); // Cauldron - fire unload event before removing world
    worlds.remove(world.getName().toLowerCase());
    DimensionManager.setWorld(handle.provider.dimensionId, null); // Cauldron - remove world from DimensionManager
    return true;
}
项目:Uranium    文件:ULog.java   
public void log(Level level, Throwable throwable, String message,
        Object... args) {
    Throwable t = null;
    if (throwable != null) {
        t = new Throwable();
        t.initCause(throwable);
        t.fillInStackTrace();
    }
    FMLLog.log(mTag, level, t, String.format(message, args));
}
项目:Technical    文件:CentrifugeRecipeHandler.java   
@Override
public String getGuiTexture() {
    try {
        return null; //type.guiClass.newInstance().getTextureLocation().toString();
    } catch (Exception e) {
        FMLLog.log(Level.FATAL, "Severe error in mod Technical. Please report this to the mod author (" + Technical.authors + "):");
        e.printStackTrace();
    }
    return "";
}
项目:Technical    文件:MachineRecipes.java   
public void addRecipe(ItemStack[] items, ItemStack[] results, Tier tier) {
    for(int i = 0; i < items.length; i++)
        if(items[i] != null)
            items[i].setItemDamage(32767);
    smeltingList.put(items, results);

    if(debug)
        FMLLog.log(Level.INFO, "X " + items[0] + " " + tier + " " + items.length);
    tierList.put(items, tier);
}
项目:Technical    文件:MachineRecipes.java   
public ItemStack[] getSmeltingResult(ItemStack[] itemStacks, Tier tier) {
    if(this.getClass().getName().equals(MachineRecipes.class.getName()))
        FMLLog.log(Level.WARN, Technical.modName + ": Something is trying to get a smelting result from class " + this.getClass().getName() + ". This is not allowed, and may cause errors");
    if(itemStacks.length != 3)
        FMLLog.log(Level.WARN, Technical.modName + ": Something is trying to get a recipe from class " + getClass().getName() + " and the ItemStacks given are not a legal number (" + itemStacks.length + "). Please report this to the mod author (" + Technical.authors + ")");

    if(!allowedByTier(itemStacks, tier)) {
        if(debug)
            FMLLog.log(Level.INFO, "_");
        return new ItemStack[9];
    }

    Iterator<Entry<ItemStack[], ItemStack[]>> iterator = smeltingList.entrySet().iterator();

    Entry<ItemStack[], ItemStack[]> entry;

    do {
        if(!iterator.hasNext()) {
            return new ItemStack[9];
        }
        entry = (Entry<ItemStack[], ItemStack[]>) iterator.next();
    } while(!canBeSmelted(itemStacks, (ItemStack[]) entry.getKey()));

    ItemStack[] result = new ItemStack[9];
    for(int i = 0; i < 3; i++) {
        if(itemStacks[i] != null) {
            result[i] = itemStacks[i].copy();
            result[i].stackSize = ((ItemStack[]) entry.getKey())[i].stackSize;
        }
    }

    for(int i = 0; i < result.length - 3; i++)
        if(((ItemStack[]) entry.getValue()).length > i)
            result[i + 3] = ((ItemStack[]) entry.getValue())[i];

    if(debug)
        FMLLog.log(Level.INFO, "B" + result);

    return result;
}