cpw.mods.fml.common.FMLLog Java Examples

The following examples show how to use cpw.mods.fml.common.FMLLog. 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: TrackRegistry.java    From NEI-Integration with MIT License 6 votes vote down vote up
/**
 * Returns a cached copy of a TrackSpec object.
 *
 * @param trackTag
 * @return
 */
public static TrackSpec getTrackSpec(String trackTag) {
    trackTag = trackTag.toLowerCase(Locale.ENGLISH);
    TrackSpec spec = trackSpecsFromTag.get(trackTag);
    if (spec == null) {
        if (!invalidSpecTags.contains(trackTag)) {
            FMLLog.log("Railcraft", Level.WARN, "Unknown Track Spec Tag(%s), reverting to normal track", trackTag);
            StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
            for (int i = 1; i < stackTrace.length && i < 9; i++) {
                FMLLog.log(Level.DEBUG, stackTrace[i].toString());
            }
            invalidSpecTags.add(trackTag);
        }
        spec = trackSpecsFromTag.get("railcraft:default");
    }
    return spec;
}
 
Example #2
Source File: CraftBlock.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
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.");
    }
}
 
Example #3
Source File: ThermosClassTransformer.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
@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, "Thermos: Patching " + asm.getActualName() + " for compatibility with Climate Control");
            extractFrom(asm, asm.method("extractFrom",
                    "(Lnet/minecraft/world/WorldServer;)Lnet/minecraft/world/chunk/IChunkProvider;").instructions());
        }
    }
}
 
Example #4
Source File: ClientProxy.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static <T extends Render> T unregisterRenderer(Class<? extends Entity> entityClass, Class<T> renderClass) {
    Injector registry = new Injector(RenderingRegistry.instance());
    List entityRenderers = registry.getField("entityRenderers");

    if(entityRenderers == null) {
        FMLLog.severe("Failed to get entityRenderers field in RenderingRegistry!");
        return null;
    }

    for(int i = 0; i < entityRenderers.size(); i++) {
        Injector pair = new Injector(entityRenderers.get(i));

        Class<? extends Entity> target = pair.getField("target");

        if(entityClass.equals(target)) {
            Render render = pair.getField("renderer");
            if(renderClass.isInstance(render)) {
                entityRenderers.remove(i);
                return (T)render;
            }
        }
    }
    return null;
}
 
Example #5
Source File: TrackRegistry.java    From NEI-Integration with MIT License 6 votes vote down vote up
/**
 * Returns a cached copy of a TrackSpec object.
 *
 * @param trackId
 * @return
 */
public static TrackSpec getTrackSpec(int trackId) {
    Short id = (short) trackId;
    TrackSpec spec = trackSpecsFromID.get(id);
    if (spec == null) {
        if (!invalidSpecIDs.contains(id)) {
            FMLLog.log("Railcraft", Level.WARN, "Unknown Track Spec ID(%d), reverting to normal track", trackId);
            StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
            for (int i = 1; i < stackTrace.length && i < 9; i++) {
                FMLLog.log(Level.DEBUG, stackTrace[i].toString());
            }
            invalidSpecIDs.add(id);
        }
        id = -1;
        spec = trackSpecsFromID.get(id);
    }
    return spec;
}
 
Example #6
Source File: IntegrationRegistry.java    From GardenCollection with MIT License 6 votes vote down vote up
public void init () {
    for (int i = 0; i < registry.size(); i++) {
        IntegrationModule module = registry.get(i);
        if (module.getModID() != null && !Loader.isModLoaded(module.getModID())) {
            registry.remove(i--);
            continue;
        }

        try {
            module.init();
        }
        catch (Throwable t) {
            registry.remove(i--);
            FMLLog.log(GardenStuff.MOD_ID, Level.INFO, "Could not load integration module: " + module.getClass().getName() + " (init)");
        }
    }
}
 
Example #7
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 #8
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 #9
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 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 #10
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 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 #11
Source File: AppEngTileMissingException.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void printStackTrace() {
	try
	{
		FMLLog.info( "[AppEng] Missing Tile at "+dc.x+", "+dc.y+", "+dc.z+" in +"+dc.getWorld().getWorldInfo().getVanillaDimension() );
	}
	catch( Throwable _ )
	{
		FMLLog.info( "[AppEng] Missing Tile at "+dc.x+", "+dc.y+", "+dc.z );
	}
	super.printStackTrace();
}
 
Example #12
Source File: ModBlocks.java    From GardenCollection with MIT License 5 votes vote down vote up
public static UniqueMetaIdentifier getUniqueMetaID (Block block, int meta) {
    String name = GameData.getBlockRegistry().getNameForObject(block);
    if (name == null) {
        FMLLog.log(GardenCore.MOD_ID, Level.WARN, "Tried to make a UniqueMetaIdentifier from an invalid block");
        return null;
    }

    return new UniqueMetaIdentifier(name, meta);
}
 
Example #13
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 #14
Source File: BlockNameConversion.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
public static Item findItem(String oldname)
{
    FMLLog.getLogger().trace("findItem() START " + oldname);
    Item item = null;
    for (int i = 0; i < NameConversions.MAX && item == null; i++)
    {
        FMLLog.getLogger().trace("findItem()       Checking for " + NameConversions.conversion(oldname, i));
        item = GameRegistry.findItem(Chisel.MOD_ID, NameConversions.conversion(oldname, i));
    }

    return item;
}
 
Example #15
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 #16
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 #17
Source File: ResearchCategories.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
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;
        }
        		}
}
 
Example #18
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public CustomSpawner()
{
    biomeList = new ArrayList<BiomeGenBase>();
    log.setParent(FMLLog.getLogger());
    try
    {
        for (BiomeGenBase biomegenbase : BiomeGenBase.biomeList)
        {
            if (biomegenbase == null)
            {
                continue;
            }
            biomeList.add(biomegenbase);
        }

        customCreatureSpawnList = new List[biomeList.size()];
        customMobSpawnList = new List[biomeList.size()];
        customAmbientSpawnList = new List[biomeList.size()];
        customAquaticSpawnList = new List[biomeList.size()];
        entityClasses = new List[4];
        vanillaClassList = new ArrayList<Class>();
        vanillaClassList.add(EntityChicken.class);
        vanillaClassList.add(EntityCow.class);
        vanillaClassList.add(EntityPig.class);
        vanillaClassList.add(EntitySheep.class);
        vanillaClassList.add(EntityWolf.class);
        vanillaClassList.add(EntitySquid.class);
        vanillaClassList.add(EntityOcelot.class);
        vanillaClassList.add(EntityBat.class);
        clearLists();
    }
    catch (Exception ex)
    {
        throw new RuntimeException(ex);
    }
}
 
Example #19
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 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 #20
Source File: BlockNameConversion.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
public static Block findBlock(String oldname) {
	FMLLog.getLogger().trace("[Chisel 2] findBlock() START: " + oldname);
	Block block = null;
	for (int i = 0; i < NameConversions.MAX && block == null; i++) {
		FMLLog.getLogger().trace("[Chisel 2] findBlock()       Checking for " + NameConversions.conversion(oldname, i));
		block = GameRegistry.findBlock(Chisel.MOD_ID, NameConversions.conversion(oldname, i));
	}

	return block;
}
 
Example #21
Source File: ModBlocks.java    From GardenCollection with MIT License 5 votes vote down vote up
public static UniqueMetaIdentifier getUniqueMetaID (Block block, int meta) {
    String name = GameData.getBlockRegistry().getNameForObject(block);
    if (name == null) {
        FMLLog.log(GardenContainers.MOD_ID, Level.WARN, "Tried to make a UniqueMetaIdentifier from an invalid block");
        return null;
    }

    return new UniqueMetaIdentifier(name, meta);
}
 
Example #22
Source File: ModBlocks.java    From GardenCollection with MIT License 5 votes vote down vote up
public static UniqueMetaIdentifier getUniqueMetaID (Block block, int meta) {
    String name = GameData.getBlockRegistry().getNameForObject(block);
    if (name == null) {
        FMLLog.log(GardenTrees.MOD_ID, Level.WARN, "Tried to make a UniqueMetaIdentifier from an invalid block");
        return null;
    }

    return new UniqueMetaIdentifier(name, meta);
}
 
Example #23
Source File: LanternSourceRegistry.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
public void registerLanternSource (ILanternSource lanternSource) {
    if (lanternSource == null)
        return;

    if (registry.containsKey(lanternSource.getSourceID())) {
        FMLLog.log("GardenStuff", Level.ERROR, "Key '%s' already registered as a lantern source.");
        return;
    }

    registry.put(lanternSource.getSourceID(), lanternSource);
}
 
Example #24
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 #25
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 #26
Source File: ResearchCategories.java    From GardenCollection with MIT License 5 votes vote down vote up
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;
        }
        		}
}
 
Example #27
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 #28
Source File: AspectSourceHelper.java    From Chisel-2 with GNU General Public License v2.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 #29
Source File: ResearchCategories.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
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;
        }
        		}
}
 
Example #30
Source File: Chisel.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
	ChiselTabs.postInit();
	Compatibility.init(event);
	FMLLog.severe("Unable to lookup chisel:... is not an error, please do not treat it as such");
	FMLLog.bigWarning("In case you didn't see the red above I suggest you read it - Cricket");
}