Added poor Ores to the Crusher

This commit is contained in:
Ellpeck 2015-07-01 21:32:48 +02:00
parent 0f6225959f
commit ed1d09148c
26 changed files with 75 additions and 68 deletions

View file

@ -28,7 +28,6 @@ import ellpeck.actuallyadditions.recipe.HairyBallHandler;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.BlockDispenser;
@Mod(modid = ModUtil.MOD_ID, name = ModUtil.NAME, version = ModUtil.VERSION, canBeDeactivated = false)
public class ActuallyAdditions{
@ -41,7 +40,7 @@ public class ActuallyAdditions{
@EventHandler
public void preInit(FMLPreInitializationEvent event){
Util.logInfo("Starting PreInitialization Phase...");
ModUtil.LOGGER.info("Starting PreInitialization Phase...");
ConfigurationHandler.init(event.getSuggestedConfigurationFile());
PacketHandler.init();
@ -52,12 +51,12 @@ public class ActuallyAdditions{
FuelHandler.init();
proxy.preInit();
Util.logInfo("PreInitialization Finished.");
ModUtil.LOGGER.info("PreInitialization Finished.");
}
@EventHandler
public void init(FMLInitializationEvent event){
Util.logInfo("Starting Initialization Phase...");
ModUtil.LOGGER.info("Starting Initialization Phase...");
InitAchievements.init();
GuiHandler.init();
@ -68,12 +67,12 @@ public class ActuallyAdditions{
FMLInterModComms.sendMessage("Waila", "register", "ellpeck.actuallyadditions.waila.WailaDataProvider.register");
proxy.init();
Util.logInfo("Initialization Finished.");
ModUtil.LOGGER.info("Initialization Finished.");
}
@EventHandler
public void postInit(FMLPostInitializationEvent event){
Util.logInfo("Starting PostInitialization Phase...");
ModUtil.LOGGER.info("Starting PostInitialization Phase...");
ItemCoffee.initIngredients();
CrusherCrafting.init();
@ -81,7 +80,7 @@ public class ActuallyAdditions{
HairyBallHandler.init();
proxy.postInit();
Util.logInfo("PostInitialization Finished.");
ModUtil.LOGGER.info("PostInitialization Finished.");
}
@EventHandler
@ -92,9 +91,9 @@ public class ActuallyAdditions{
@EventHandler
public void serverStarting(FMLServerStartingEvent event){
BlockDispenser.dispenseBehaviorRegistry.putObject(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
BlockDispenser.dispenseBehaviorRegistry.putObject(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
BlockDispenser.dispenseBehaviorRegistry.putObject(InitItems.itemFertilizer, new DispenserHandlerFertilize());
Util.registerDispenserHandler(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize());
}
}

View file

@ -1,7 +1,6 @@
package ellpeck.actuallyadditions.achievement;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.stats.Achievement;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.AchievementPage;
@ -18,7 +17,7 @@ public class InitAchievements{
public static ArrayList<Achievement> achievementList = new ArrayList<Achievement>();
public static void init(){
Util.logInfo("Initializing Achievements...");
ModUtil.LOGGER.info("Initializing Achievements...");
for(int i = 0; i < TheAchievements.values().length; i++){
achievementList.add(TheAchievements.values()[i].ach);

View file

@ -4,7 +4,6 @@ import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.CompatUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
@ -79,7 +78,7 @@ public class InitBlocks{
public static Block blockColoredLampOn;
public static void init(){
Util.logInfo("Initializing Blocks...");
ModUtil.LOGGER.info("Initializing Blocks...");
blockTestifiBucksGreenWall = new BlockGeneric("blockTestifiBucksGreenWall");
BlockUtil.register(blockTestifiBucksGreenWall, BlockGeneric.TheItemBlock.class);

View file

@ -5,7 +5,6 @@ import ellpeck.actuallyadditions.items.ItemCoffee;
import ellpeck.actuallyadditions.recipe.CrusherRecipeManualRegistry;
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
@ -27,7 +26,7 @@ public class InterModCommunications{
if(input != null && outputOne != null){
CrusherRecipeManualRegistry.registerRecipe(input, outputOne, outputTwo, secondChance);
Util.logInfo("Crusher Recipe that was sent from Mod " + message.getSender() + " has been registered successfully: " + input.toString() + " -> " + outputOne.toString() + (outputTwo != null ? " + " + outputTwo.toString() + ", Second Chance: " + secondChance : ""));
ModUtil.LOGGER.info("Crusher Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input.toString()+" -> "+outputOne.toString()+(outputTwo != null ? " + "+outputTwo.toString()+", Second Chance: "+secondChance : ""));
}
else ModUtil.LOGGER.log(Level.ERROR, "Crusher Recipe that was sent from Mod " + message.getSender() + " could not be registered: It's missing an Input or an Output!");
}
@ -45,7 +44,7 @@ public class InterModCommunications{
if(input != null && potionID > 0 && duration > 0 && maxAmp > 0){
PotionEffect effect = new PotionEffect(potionID, duration, amplifier);
ItemCoffee.registerIngredient(new ItemCoffee.Ingredient(input, new PotionEffect[]{effect}, maxAmp));
Util.logInfo("Coffee Machine Recipe that was sent from Mod " + message.getSender() + " has been registered successfully: " + input.toString() + " -> " + effect.toString());
ModUtil.LOGGER.info("Coffee Machine Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input.toString()+" -> "+effect.toString());
}
else ModUtil.LOGGER.log(Level.ERROR, "Coffee Machine Recipe that was sent from Mod " + message.getSender() + " could not be registered: It's missing an Input, a Potion ID, a Duration or a max Amplifier!");
}
@ -59,7 +58,7 @@ public class InterModCommunications{
if(output != null && chance > 0){
HairyBallHandler.addReturn(output, chance);
Util.logInfo("Ball Of Hair Recipe that was sent from Mod " + message.getSender() + " has been registered successfully: " + output.toString() + ", Chance: " + chance);
ModUtil.LOGGER.info("Ball Of Hair Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+output.toString()+", Chance: "+chance);
}
else ModUtil.LOGGER.log(Level.ERROR, "Ball Of Hair Recipe that was sent from Mod " + message.getSender() + " could not be registered: It's missing an Output or a Chance!");
}

View file

@ -1,6 +1,6 @@
package ellpeck.actuallyadditions.config;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraftforge.common.config.Configuration;
import java.io.File;
@ -10,7 +10,7 @@ public class ConfigurationHandler{
public static final String ISSUES_WARNING = " [THIS COULD CAUSE ISSUES, CHANGE AT YOUR OWN RISK!]";
public static void init(File configFile){
Util.logInfo("Grabbing Configurations...");
ModUtil.LOGGER.info("Grabbing Configurations...");
Configuration config = new Configuration(configFile);
try{

View file

@ -6,7 +6,7 @@ import ellpeck.actuallyadditions.items.metalists.TheFoods;
import ellpeck.actuallyadditions.recipe.CrusherRecipeAutoRegistry;
import ellpeck.actuallyadditions.recipe.CrusherRecipeAutoRegistry.SearchCase;
import ellpeck.actuallyadditions.recipe.CrusherRecipeManualRegistry;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack;
public class CrusherCrafting{
public static void init(){
Util.logInfo("Initializing Crusher Recipes...");
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10));
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()));
@ -30,6 +30,7 @@ public class CrusherCrafting{
CrusherRecipeManualRegistry.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2, 1);
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("oreNether", 6));
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("orePoor", 4, "nugget"));
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("denseore", 8));
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("gem", 1));
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("ingot", 1));

View file

@ -1,11 +1,11 @@
package ellpeck.actuallyadditions.crafting;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
public class InitCrafting {
public static void init(){
Util.logInfo("Initializing Crafting Recipes...");
ModUtil.LOGGER.info("Initializing Crafting Recipes...");
ItemCrafting.init();
BlockCrafting.init();

View file

@ -4,22 +4,23 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements;
import ellpeck.actuallyadditions.achievement.TheAchievements;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class CraftEvent{
@SubscribeEvent
public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){
checkAchievements(event.crafting, event, InitAchievements.CRAFTING_ACH);
checkAchievements(event.crafting, event.player, InitAchievements.CRAFTING_ACH);
}
public static void checkAchievements(ItemStack gotten, PlayerEvent event, int type){
public static void checkAchievements(ItemStack gotten, EntityPlayer player, int type){
for(int i = 0; i < TheAchievements.values().length; i++){
TheAchievements ach = TheAchievements.values()[i];
if(ach.type == type){
if(gotten.getItem() == ach.ach.theItemStack.getItem()){
if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){
event.player.addStat(ach.ach, 1);
player.addStat(ach.ach, 1);
}
}
}

View file

@ -1,11 +1,12 @@
package ellpeck.actuallyadditions.event;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
public class InitEvents{
public static void init(){
Util.logInfo("Initializing Events...");
ModUtil.LOGGER.info("Initializing Events...");
Util.registerEvent(new SmeltEvent());
Util.registerEvent(new CraftEvent());

View file

@ -8,6 +8,6 @@ public class PickupEvent{
@SubscribeEvent
public void onPickupEvent(PlayerEvent.ItemPickupEvent event){
CraftEvent.checkAchievements(event.pickedUp.getEntityItem(), event, InitAchievements.PICKUP_ACH);
CraftEvent.checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.PICKUP_ACH);
}
}

View file

@ -8,6 +8,6 @@ public class SmeltEvent{
@SubscribeEvent
public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){
CraftEvent.checkAchievements(event.smelting, event, InitAchievements.SMELTING_ACH);
CraftEvent.checkAchievements(event.smelting, event.player, InitAchievements.SMELTING_ACH);
}
}

View file

@ -6,7 +6,6 @@ import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheJams;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
@ -18,7 +17,7 @@ public class InitVillager{
public static final String JAM_HOUSE_CHEST_NAME = ModUtil.MOD_ID_LOWER+".jamHouseChest";
public static void init(){
Util.logInfo("Initializing Village Addons...");
ModUtil.LOGGER.info("Initializing Village Addons...");
if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()){
initJamVillagePart();

View file

@ -7,7 +7,6 @@ import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
@ -64,7 +63,7 @@ public class OreGen implements IWorldGenerator{
}
public static void init(){
Util.logInfo("Registering World Generator...");
ModUtil.LOGGER.info("Registering World Generator...");
GameRegistry.registerWorldGenerator(new OreGen(), 10);
}
}

View file

@ -5,7 +5,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.gui.*;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@ -142,7 +142,7 @@ public class GuiHandler implements IGuiHandler{
public static final int ENERVATOR_ID = 20;
public static void init(){
Util.logInfo("Initializing GuiHandler...");
ModUtil.LOGGER.info("Initializing GuiHandler...");
NetworkRegistry.INSTANCE.registerGuiHandler(ActuallyAdditions.instance, new GuiHandler());
}
}

View file

@ -7,7 +7,7 @@ import ellpeck.actuallyadditions.items.tools.*;
import ellpeck.actuallyadditions.material.InitItemMaterials;
import ellpeck.actuallyadditions.util.CompatUtil;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
@ -81,7 +81,7 @@ public class InitItems{
public static Item itemBattery;
public static void init(){
Util.logInfo("Initializing Items...");
ModUtil.LOGGER.info("Initializing Items...");
itemDrill = new ItemDrill();
ItemUtil.register(itemDrill);

View file

@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.material;
import ellpeck.actuallyadditions.config.values.ConfigFloatValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.util.EnumHelper;
@ -12,7 +12,7 @@ public class InitItemMaterials{
public static ToolMaterial toolMaterialObsidian;
public static void init(){
Util.logInfo("Initializing Materials...");
ModUtil.LOGGER.info("Initializing Materials...");
toolMaterialEmerald = EnumHelper.addToolMaterial("toolMaterialEmerald", ConfigIntValues.EMERALD_HARVEST_LEVEL.getValue(), ConfigIntValues.EMERALD_USES.getValue(), ConfigFloatValues.EMERALD_SPEED.getValue(), ConfigFloatValues.EMERALD_MAX_DAMAGE.getValue(), ConfigIntValues.EMERALD_ENCHANTABILITY.getValue());
toolMaterialObsidian = EnumHelper.addToolMaterial("toolMaterialObsidian", ConfigIntValues.OBSIDIAN_HARVEST_LEVEL.getValue(), ConfigIntValues.OBSIDIAN_USES.getValue(), ConfigFloatValues.OBSIDIAN_SPEED.getValue(), ConfigFloatValues.OBSIDIAN_MAX_DAMAGE.getValue(), ConfigIntValues.OBSIDIAN_ENCHANTABILITY.getValue());

View file

@ -13,7 +13,7 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{
@Override
public void loadConfig(){
Util.logInfo("Initializing Not Enough Items Plugin...");
ModUtil.LOGGER.info("Initializing Not Enough Items Plugin...");
API.registerGuiOverlay(GuiCrafter.class, "crafting");
API.registerGuiOverlayHandler(GuiCrafter.class, new DefaultOverlayHandler(), "crafting");

View file

@ -21,7 +21,7 @@ public class ClientProxy implements IProxy{
@Override
public void preInit(){
Util.logInfo("PreInitializing ClientProxy...");
ModUtil.LOGGER.info("PreInitializing ClientProxy...");
if(ConfigBoolValues.DO_UPDATE_CHECK.isEnabled()){
new UpdateChecker().init();
@ -30,7 +30,7 @@ public class ClientProxy implements IProxy{
@Override
public void init(){
Util.logInfo("Initializing ClientProxy...");
ModUtil.LOGGER.info("Initializing ClientProxy...");
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockCompost), new RenderItems(new ModelCompost()));
@ -54,6 +54,6 @@ public class ClientProxy implements IProxy{
@Override
public void postInit(){
Util.logInfo("PostInitializing ClientProxy...");
ModUtil.LOGGER.info("PostInitializing ClientProxy...");
}
}

View file

@ -1,22 +1,22 @@
package ellpeck.actuallyadditions.proxy;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
@SuppressWarnings("unused")
public class ServerProxy implements IProxy{
@Override
public void preInit(){
Util.logInfo("PreInitializing ServerProxy...");
ModUtil.LOGGER.info("PreInitializing ServerProxy...");
}
@Override
public void init(){
Util.logInfo("Initializing ServerProxy...");
ModUtil.LOGGER.info("Initializing ServerProxy...");
}
@Override
public void postInit(){
Util.logInfo("PostInitializing ServerProxy...");
ModUtil.LOGGER.info("PostInitializing ServerProxy...");
}
}

View file

@ -13,10 +13,16 @@ public class CrusherRecipeAutoRegistry{
public final String name;
public final int resultAmount;
public final String replacer;
public SearchCase(String name, int resultAmount){
public SearchCase(String name, int resultAmount, String replacer){
this.name = name;
this.resultAmount = resultAmount;
this.replacer = replacer;
}
public SearchCase(String name, int resultAmount){
this(name, resultAmount, "dust");
}
}
@ -27,18 +33,20 @@ public class CrusherRecipeAutoRegistry{
if(!exceptions.contains(inputName)){
int resultAmount = 1;
String inputNameWithoutPrefix = null;
String replacer = null;
for(SearchCase searchCase : searchCases){
String toSearch = searchCase.name;
if(inputName.length() > toSearch.length() && inputName.substring(0, toSearch.length()).equals(toSearch)){
inputNameWithoutPrefix = inputName.substring(toSearch.length());
resultAmount = searchCase.resultAmount;
replacer = searchCase.replacer;
break;
}
}
if(inputNameWithoutPrefix != null){
String inputWithDustPrefix = "dust" + inputNameWithoutPrefix;
if(inputNameWithoutPrefix != null && replacer != null){
String inputWithDustPrefix = replacer+inputNameWithoutPrefix;
CrusherRecipeManualRegistry.registerRecipe(inputName, inputWithDustPrefix, resultAmount);
}
}

View file

@ -25,7 +25,7 @@ public class CrusherRecipeManualRegistry{
public static void registerRecipe(String input, String outputOne, String outputTwo, int secondChance, int outputOneAmount, int outputTwoAmount){
ArrayList<ItemStack> inputStacks = (ArrayList<ItemStack>)OreDictionary.getOres(input, false);
ArrayList<ItemStack> outputOneStacks = (ArrayList<ItemStack>)OreDictionary.getOres(outputOne, false);
ArrayList<ItemStack> outputTwoStacks = outputTwo.length() <= 0 ? null : (ArrayList<ItemStack>)OreDictionary.getOres(outputTwo, false);
ArrayList<ItemStack> outputTwoStacks = (outputTwo == null || outputTwo.isEmpty()) ? null : (ArrayList<ItemStack>)OreDictionary.getOres(outputTwo, false);
if(inputStacks != null && !inputStacks.isEmpty()){
for(ItemStack anInput : inputStacks){

View file

@ -6,7 +6,7 @@ import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -26,7 +26,7 @@ public class FuelHandler implements IFuelHandler{
}
public static void init(){
Util.logInfo("Initializing Fuelstuffs...");
ModUtil.LOGGER.info("Initializing Fuelstuffs...");
GameRegistry.registerFuelHandler(new FuelHandler());
setFuelValues();

View file

@ -2,7 +2,6 @@ package ellpeck.actuallyadditions.tile;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
@ -26,7 +25,7 @@ public class TileEntityBase extends TileEntity{
}
public static void init(){
Util.logInfo("Registering TileEntities...");
ModUtil.LOGGER.info("Registering TileEntities...");
GameRegistry.registerTileEntity(TileEntityCompost.class, ModUtil.MOD_ID_LOWER + ":tileEntityCompost");
GameRegistry.registerTileEntity(TileEntityFeeder.class, ModUtil.MOD_ID_LOWER + ":tileEntityFeeder");
GameRegistry.registerTileEntity(TileEntityGiantChest.class, ModUtil.MOD_ID_LOWER + ":tileEntityGiantChest");

View file

@ -9,7 +9,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.StatCollector;
import org.apache.logging.log4j.Level;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@ -24,7 +23,7 @@ public class UpdateChecker{
public String changelog;
public void init(){
Util.logInfo("Initializing Update Checker...");
ModUtil.LOGGER.info("Initializing Update Checker...");
Util.registerEvent(this);
new UpdateCheckThread();
}
@ -66,7 +65,7 @@ public class UpdateChecker{
@Override
public void run(){
Util.logInfo("Starting Update Check...");
ModUtil.LOGGER.info("Starting Update Check...");
try{
URL newestURL = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/update/newestVersion.txt");
BufferedReader newestReader = new BufferedReader(new InputStreamReader(newestURL.openStream()));
@ -78,10 +77,10 @@ public class UpdateChecker{
changelog = changeReader.readLine();
changeReader.close();
Util.logInfo("Update Check done!");
ModUtil.LOGGER.info("Update Check done!");
}
catch(Exception e){
ModUtil.LOGGER.log(Level.ERROR, "Update Check failed!");
ModUtil.LOGGER.error("Update Check failed!");
checkFailed = true;
e.printStackTrace();
}

View file

@ -1,21 +1,25 @@
package ellpeck.actuallyadditions.util;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.Level;
@SuppressWarnings("unused")
public class Util{
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
public static void logInfo(String text){
ModUtil.LOGGER.log(Level.INFO, text);
}
public static void registerEvent(Object o){
MinecraftForge.EVENT_BUS.register(o);
FMLCommonHandler.instance().bus().register(o);
}
public static void registerDispenserHandler(Item item, BehaviorDefaultDispenseItem handler){
if(BlockDispenser.dispenseBehaviorRegistry.getObject(item) == null){
BlockDispenser.dispenseBehaviorRegistry.putObject(item, handler);
}
}
}

View file

@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.waila;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.ModUtil;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
@ -53,7 +53,7 @@ public class WailaDataProvider implements IWailaDataProvider{
}
public static void register(IWailaRegistrar registrar){
Util.logInfo("Initializing Waila Plugin...");
ModUtil.LOGGER.info("Initializing Waila Plugin...");
WailaDataProvider provider = new WailaDataProvider();
for(Block theBlock : BlockUtil.wailaRegisterList){