Java Code Examples for cpw.mods.fml.common.FMLLog#warning()

The following examples show how to use cpw.mods.fml.common.FMLLog#warning() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThaumcraftApiHelper.java    From AdvancedMod with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Subtract vis for use by a crafting mechanic. Costs are calculated slightly 
 * differently and things like the frugal enchant is ignored
 * Must NOT be multiplied by 100 - send the actual vis cost
 * @param wand the wand itemstack
 * @param player the player using the wand
 * @param cost the cost of the operation. 
 * @param doit actually subtract the vis from the wand if true - if false just simulate the result
 * @return was the vis successfully subtracted
 */
public static boolean consumeVisFromWandCrafting(ItemStack wand, EntityPlayer player, 
		AspectList cost, boolean doit) {
	boolean ot = false;
    try {
        if(consumeVisFromWandCrafting == null) {
            Class fake = Class.forName("thaumcraft.common.items.wands.ItemWandCasting");
            consumeVisFromWandCrafting = fake.getMethod("consumeAllVisCrafting", 
            		ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class);
        }
        ot = (Boolean) consumeVisFromWandCrafting.invoke(
        		consumeVisFromWandCrafting.getDeclaringClass().cast(wand.getItem()), wand, player, cost, doit);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.items.wands.ItemWandCasting method consumeAllVisCrafting");
    }
	return ot;
}
 
Example 2
Source File: ThaumcraftApiHelper.java    From AdvancedMod with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Use to subtract vis from a wand for most operations
 * Wands store vis differently so "real" vis costs need to be multiplied by 100 before calling this method
 * @param wand the wand itemstack
 * @param player the player using the wand
 * @param cost the cost of the operation. 
 * @param doit actually subtract the vis from the wand if true - if false just simulate the result
 * @param crafting is this a crafting operation or not - if 
 * false then things like frugal and potency will apply to the costs
 * @return was the vis successfully subtracted
 */
public static boolean consumeVisFromWand(ItemStack wand, EntityPlayer player, 
		AspectList cost, boolean doit, boolean crafting) {
	boolean ot = false;
    try {
        if(consumeVisFromWand == null) {
            Class fake = Class.forName("thaumcraft.common.items.wands.ItemWandCasting");
            consumeVisFromWand = fake.getMethod("consumeAllVis", 
            		ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class, boolean.class);
        }
        ot = (Boolean) consumeVisFromWand.invoke(
        		consumeVisFromWand.getDeclaringClass().cast(wand.getItem()), wand, player, cost, doit, crafting);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.items.wands.ItemWandCasting method consumeAllVis");
    }
	return ot;
}
 
Example 3
Source File: ThaumcraftApiHelper.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public static AspectList generateTags(Item item, int meta) {
    try {
        if(generateTags == null) {
            Class fake = Class.forName("thaumcraft.common.lib.crafting.ThaumcraftCraftingManager");
            generateTags = fake.getMethod("generateTags", Item.class, int.class);
        }
        return (AspectList) generateTags.invoke(null, item, meta);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.crafting.ThaumcraftCraftingManager method generateTags");
    }
	return null;
}
 
Example 4
Source File: AspectSourceHelper.java    From GardenCollection with MIT License 5 votes vote down vote up
/**
 * This method is what is used to drain essentia from jars and other sources for things like 
 * infusion crafting or powering the arcane furnace. A record of possible sources are kept track of
 * and refreshed as needed around the calling tile entity. This also renders the essentia trail particles.
 * Only 1 essentia is drained at a time
 * @param tile the tile entity that is draining the essentia
 * @param aspect the aspect that you are looking for
 * @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions. 
 * @param range how many blocks you wish to search for essentia sources. 
 * @return boolean returns true if essentia was found and removed from a source.
 */
public static boolean drainEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
    try {
        if(drainEssentia == null) {
            Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
            drainEssentia = fake.getMethod("drainEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
        }
        return (Boolean) drainEssentia.invoke(null, tile, aspect, direction, range);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method drainEssentia");
    }
	return false;
}
 
Example 5
Source File: AspectSourceHelper.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method is what is used to drain essentia from jars and other sources for things like 
 * infusion crafting or powering the arcane furnace. A record of possible sources are kept track of
 * and refreshed as needed around the calling tile entity. This also renders the essentia trail particles.
 * Only 1 essentia is drained at a time
 * @param tile the tile entity that is draining the essentia
 * @param aspect the aspect that you are looking for
 * @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions. 
 * @param range how many blocks you wish to search for essentia sources. 
 * @return boolean returns true if essentia was found and removed from a source.
 */
public static boolean drainEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
    try {
        if(drainEssentia == null) {
            Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
            drainEssentia = fake.getMethod("drainEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
        }
        return (Boolean) drainEssentia.invoke(null, tile, aspect, direction, range);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method drainEssentia");
    }
	return false;
}
 
Example 6
Source File: AspectSourceHelper.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method is what is used to drain essentia from jars and other sources for things like 
 * infusion crafting or powering the arcane furnace. A record of possible sources are kept track of
 * and refreshed as needed around the calling tile entity. This also renders the essentia trail particles.
 * Only 1 essentia is drained at a time
 * @param tile the tile entity that is draining the essentia
 * @param aspect the aspect that you are looking for
 * @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions. 
 * @param range how many blocks you wish to search for essentia sources. 
 * @return boolean returns true if essentia was found and removed from a source.
 */
public static boolean drainEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
    try {
        if(drainEssentia == null) {
            Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
            drainEssentia = fake.getMethod("drainEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
        }
        return (Boolean) drainEssentia.invoke(null, tile, aspect, direction, range);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method drainEssentia");
    }
	return false;
}
 
Example 7
Source File: VisNetHandler.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public static void generateVisEffect(int dim, int x, int y, int z, int x2, int y2, int z2, int color) {
	try {
        if(generateVisEffect == null) {
            Class fake = Class.forName("thaumcraft.common.lib.Utils");
            generateVisEffect = fake.getMethod("generateVisEffect", int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class);
        }
        generateVisEffect.invoke(null, dim, x,y,z,x2,y2,z2,color);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.Utils method generateVisEffect");
    }
}
 
Example 8
Source File: ThaumcraftApiHelper.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This "sticky" warp to a player. Sticky warp is permanent warp that can be removed.
 * It will automatically be synced clientside
 * @param player the player using the wand
 * @param amount how much warp to add. Can have negative amounts.
 */
public static void addStickyWarpToPlayer(EntityPlayer player, int amount) {
	boolean ot = false;
    try {
        if(addStickyWarpToPlayer == null) {
            Class fake = Class.forName("thaumcraft.common.Thaumcraft");
            addStickyWarpToPlayer = fake.getMethod("addStickyWarpToPlayer", 
            		EntityPlayer.class, int.class);
        }
        addStickyWarpToPlayer.invoke(null, player, amount);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.Thaumcraft method addStickyWarpToPlayer");
    }
}
 
Example 9
Source File: AspectSourceHelper.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
/**
 * This method is what is used to drain essentia from jars and other sources for things like 
 * infusion crafting or powering the arcane furnace. A record of possible sources are kept track of
 * and refreshed as needed around the calling tile entity. This also renders the essentia trail particles.
 * Only 1 essentia is drained at a time
 * @param tile the tile entity that is draining the essentia
 * @param aspect the aspect that you are looking for
 * @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions. 
 * @param range how many blocks you wish to search for essentia sources. 
 * @return boolean returns true if essentia was found and removed from a source.
 */
public static boolean drainEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
    try {
        if(drainEssentia == null) {
            Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
            drainEssentia = fake.getMethod("drainEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
        }
        return (Boolean) drainEssentia.invoke(null, tile, aspect, direction, range);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method drainEssentia");
    }
	return false;
}
 
Example 10
Source File: AspectSourceHelper.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method returns if there is any essentia of the passed type that can be drained. It in no way checks how
 * much there is, only if an essentia container nearby contains at least 1 point worth.
 * @param tile the tile entity that is checking the essentia
 * @param aspect the aspect that you are looking for
 * @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions. 
 * @param range how many blocks you wish to search for essentia sources. 
 * @return boolean returns true if essentia was found and removed from a source.
 */
public static boolean findEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
    try {
        if(findEssentia == null) {
            Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
            findEssentia = fake.getMethod("findEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
        }
        return (Boolean) findEssentia.invoke(null, tile, aspect, direction, range);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method findEssentia");
    }
	return false;
}
 
Example 11
Source File: RegisteredPotions.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static <T extends Potion> T registerPotion(Class<T> potionClass) {
    int id = ModConfig.loadPotionId(potionClass.getSimpleName());
    if(id == -1) {
        for(int i = 0; i < Potion.potionTypes.length; i++) {
            if(Potion.potionTypes[i] == null) {
                id = i;
                break;
            }
        }

        if(id == -1) {
            id = Potion.potionTypes.length;
            FMLLog.warning("Gadomancy could not find a free potion id and will extend the potionTypes array! This might cause fatal errors. Please consider changing the config!");
        }
    }

    if(id > 127) {
        FMLLog.warning("The potion id '" + id + "' of potion '" + Gadomancy.NAME + ":" + potionClass.getSimpleName() + "' is bigger then 127 this might cause errors as well. Please consider changing the config.");
    }

    if(id >= Potion.potionTypes.length) {
        Potion[] potions = new Potion[Potion.potionTypes.length + 1];
        System.arraycopy(Potion.potionTypes, 0, potions, 0, Potion.potionTypes.length);
        Potion.potionTypes = potions;
    } else if(Potion.potionTypes[id] != null) {
        Potion conflict = Potion.potionTypes[id];
        throw new RuntimeException("Potion id conflict! Do not report this bug you just have to change the configuration files. Failed to register potion '"
                + Gadomancy.NAME + ":" + potionClass.getSimpleName() + "' with id '" + id
                + "'. Another potion with this id already exists: " + conflict.getName() + " (as " + conflict.getClass().getName() + ")");
    }

    return new Injector(potionClass).invokeConstructor(int.class, id);
}
 
Example 12
Source File: ThaumcraftApiHelper.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public static boolean isResearchComplete(String username, String researchkey) {
	boolean ot = false;
    try {
        if(isResearchComplete == null) {
            Class fake = Class.forName("thaumcraft.common.lib.research.ResearchManager");
            isResearchComplete = fake.getMethod("isResearchComplete", String.class, String.class);
        }
        ot = (Boolean) isResearchComplete.invoke(null, username, researchkey);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.research.ResearchManager method isResearchComplete");
    }
	return ot;
}
 
Example 13
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
/**
 * This "sticky" warp to a player. Sticky warp is permanent warp that can be removed.
 * It will automatically be synced clientside
 * @param player the player using the wand
 * @param amount how much warp to add. Can have negative amounts.
 */
public static void addStickyWarpToPlayer(EntityPlayer player, int amount) {
	boolean ot = false;
    try {
        if(addStickyWarpToPlayer == null) {
            Class fake = Class.forName("thaumcraft.common.Thaumcraft");
            addStickyWarpToPlayer = fake.getMethod("addStickyWarpToPlayer", 
            		EntityPlayer.class, int.class);
        }
        addStickyWarpToPlayer.invoke(null, player, amount);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.Thaumcraft method addStickyWarpToPlayer");
    }
}
 
Example 14
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
/**
 * This adds permanents or temporary warp to a player. It will automatically be synced clientside
 * @param player the player using the wand
 * @param amount how much warp to add. Negative amounts are only valid for temporary warp
 * @param temporary add temporary warp instead of permanent
 */
public static void addWarpToPlayer(EntityPlayer player, int amount, boolean temporary) {
	boolean ot = false;
    try {
        if(addWarpToPlayer == null) {
            Class fake = Class.forName("thaumcraft.common.Thaumcraft");
            addWarpToPlayer = fake.getMethod("addWarpToPlayer", 
            		EntityPlayer.class, int.class, boolean.class);
        }
        addWarpToPlayer.invoke(null, player, amount, temporary);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.Thaumcraft method addWarpToPlayer");
    }
}
 
Example 15
Source File: AspectSourceHelper.java    From GardenCollection with MIT License 5 votes vote down vote up
/**
 * This method returns if there is any essentia of the passed type that can be drained. It in no way checks how
 * much there is, only if an essentia container nearby contains at least 1 point worth.
 * @param tile the tile entity that is checking the essentia
 * @param aspect the aspect that you are looking for
 * @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions. 
 * @param range how many blocks you wish to search for essentia sources. 
 * @return boolean returns true if essentia was found and removed from a source.
 */
public static boolean findEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
    try {
        if(findEssentia == null) {
            Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
            findEssentia = fake.getMethod("findEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
        }
        return (Boolean) findEssentia.invoke(null, tile, aspect, direction, range);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method findEssentia");
    }
	return false;
}
 
Example 16
Source File: AspectSourceHelper.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method returns if there is any essentia of the passed type that can be drained. It in no way checks how
 * much there is, only if an essentia container nearby contains at least 1 point worth.
 * @param tile the tile entity that is checking the essentia
 * @param aspect the aspect that you are looking for
 * @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions. 
 * @param range how many blocks you wish to search for essentia sources. 
 * @return boolean returns true if essentia was found and removed from a source.
 */
public static boolean findEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
    try {
        if(findEssentia == null) {
            Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
            findEssentia = fake.getMethod("findEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
        }
        return (Boolean) findEssentia.invoke(null, tile, aspect, direction, range);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method findEssentia");
    }
	return false;
}
 
Example 17
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
public static AspectList generateTags(Item item, int meta) {
    try {
        if(generateTags == null) {
            Class fake = Class.forName("thaumcraft.common.lib.crafting.ThaumcraftCraftingManager");
            generateTags = fake.getMethod("generateTags", Item.class, int.class);
        }
        return (AspectList) generateTags.invoke(null, item, meta);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.crafting.ThaumcraftCraftingManager method generateTags");
    }
	return null;
}
 
Example 18
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
public static boolean isResearchComplete(String username, String researchkey) {
	boolean ot = false;
    try {
        if(isResearchComplete == null) {
            Class fake = Class.forName("thaumcraft.common.lib.research.ResearchManager");
            isResearchComplete = fake.getMethod("isResearchComplete", String.class, String.class);
        }
        ot = (Boolean) isResearchComplete.invoke(null, username, researchkey);
    } catch(Exception ex) { 
    	FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.research.ResearchManager method isResearchComplete");
    }
	return ot;
}
 
Example 19
Source File: Entity.java    From TickDynamic with MIT License 5 votes vote down vote up
/**
 * Register the instance of IExtendedProperties into the entity's collection.
 * @param identifier The identifier which you can use to retrieve these properties for the entity.
 * @param properties The instanceof IExtendedProperties to register
 * @return The identifier that was used to register the extended properties.  Empty String indicates an error.  If your requested key already existed, this will return a modified one that is unique.
 */
public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties)
{
    if (identifier == null)
    {
        FMLLog.warning("Someone is attempting to register extended properties using a null identifier.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }
    if (properties == null)
    {
        FMLLog.warning("Someone is attempting to register null extended properties.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }

    String baseIdentifier = identifier;
    int identifierModCount = 1;
    while (this.extendedProperties.containsKey(identifier))
    {
        identifier = String.format("%s%d", baseIdentifier, identifierModCount++);
    }

    if (baseIdentifier != identifier)
    {
        FMLLog.info("An attempt was made to register exended properties using an existing key.  The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier);
    }

    this.extendedProperties.put(identifier, properties);
    return identifier;
}
 
Example 20
Source File: MoCConfiguration.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
public MoCProperty getItem(String category, String key, int defaultID, String comment)
{
    MoCProperty prop = get(category, key, -1, comment);
    int defaultShift = defaultID + ITEM_SHIFT;

    if (prop.getInt() != -1)
    {
        configMarkers[prop.getInt() + ITEM_SHIFT] = true;
        return prop;
    }
    else
    {
        if (defaultID < MAX_BLOCKS - ITEM_SHIFT)
        {
            FMLLog.warning(
                "Mod attempted to get a item ID with a default value in the block ID section, " +
                "mod authors should make sure there defaults are above %d unless explicitly needed " +
                "so that all block ids are free to store blocks.", MAX_BLOCKS - ITEM_SHIFT);
            FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
        }

        if (Item.itemsList[defaultShift] == null && !configMarkers[defaultShift] && defaultShift >= Block.blocksList.length)
        {
            prop.set(defaultID);
            configMarkers[defaultShift] = true;
            return prop;
        }
        else
        {
            for (int x = Item.itemsList.length - 1; x >= ITEM_SHIFT; x--)
            {
                if (Item.itemsList[x] == null && !configMarkers[x])
                {
                    prop.set(x - ITEM_SHIFT);
                    configMarkers[x] = true;
                    return prop;
                }
            }

            throw new RuntimeException("No more item ids available for " + key);
        }
    }
}