Fixed registering stuff as furnace fuel

This commit is contained in:
Amnet 2013-04-18 14:32:48 +02:00
parent 60e6067961
commit d94a69b0f3
5 changed files with 301 additions and 296 deletions

View File

@ -1,10 +1,12 @@
package biomesoplenty.configuration;
import static com.google.common.base.Preconditions.checkNotNull;
import biomesoplenty.api.Blocks;
import biomesoplenty.blocks.*;
import biomesoplenty.blocks.BlockBOPLog.LogCategory;
import biomesoplenty.blocks.BlockBOPSlab.SlabCategory;
import biomesoplenty.blocks.BlockBOPStairs.Category;
import biomesoplenty.helpers.FurnaceFuel;
import biomesoplenty.items.ItemBOPColorizedLeaves;
import biomesoplenty.items.ItemBOPColorizedSapling;
import biomesoplenty.items.ItemBOPFlower;
@ -990,6 +992,8 @@ public class BOPBlocks {
//Block tool strength, 0 is Wood and Gold, 1 is Stone, 2 is Iron and 3 is Diamond
//Leaves can be obtained from using shears, however they arn't instantly broken by them (unsure how to do this)
GameRegistry.registerFuelHandler(checkNotNull(new FurnaceFuel()));
MinecraftForge.setBlockHarvestLevel(smolderingGrass, "shovel", 0);
MinecraftForge.setBlockHarvestLevel(mud, "shovel", 0);
MinecraftForge.setBlockHarvestLevel(ash, "shovel", 0);

View File

@ -0,0 +1,119 @@
package biomesoplenty.helpers;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraftforge.common.AchievementPage;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import biomesoplenty.configuration.BOPBlocks;
import biomesoplenty.configuration.BOPConfiguration;
import biomesoplenty.configuration.BOPItems;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class AchievementHelper
{
// Achievement declaration
private static Achievement achFlower;
private static Achievement achRedRock;
private static Achievement achThorn;
private static Achievement achAsh;
private static Achievement achOrigin;
private static Achievement achPromised;
private static Achievement achMud;
private static Achievement achShroom;
private static Achievement achBarley;
private static Achievement achMoss;
public static AchievementPage pageBOP;
@ForgeSubscribe
public void EntityItemPickupEvent(EntityItemPickupEvent event)
{
onItemPickup(event.entityPlayer, event.item.getEntityItem());
}
public static void init()
{
achFlower = (new Achievement(3057, "achFlower", 0, 0, Block.plantRed, null)).registerAchievement();
achRedRock = (new Achievement(3058, "achRedRock", -1, 2, BOPBlocks.redRock, achFlower)).registerAchievement();
achThorn = (new Achievement(3059, "achThorn", 2, 1, BOPBlocks.thorn, achFlower)).registerAchievement();
achAsh = (new Achievement(3060, "achAsh", 1, 3, BOPItems.ashes, achFlower)).registerAchievement();
achOrigin = (new Achievement(3061, "achOrigin", 0, 5, BOPBlocks.originGrass, achFlower)).setSpecial().registerAchievement();
achPromised = (new Achievement(3062, "achPromised", 0, -5, BOPBlocks.holyGrass, achFlower)).setSpecial().registerAchievement();
achMud = (new Achievement(3063, "achMud", -2, -1, BOPItems.mudBall, achFlower)).registerAchievement();
achShroom = (new Achievement(3064, "achShroom", 1, -2, BOPBlocks.toadstool, achFlower)).registerAchievement();
achBarley = (new Achievement(3065, "achBarley", -2, 4, BOPItems.barleyItem, achFlower)).registerAchievement();
achMoss = (new Achievement(3066, "achMoss", -1, -3, BOPItems.mossItem, achFlower)).registerAchievement();
pageBOP = new AchievementPage("Biomes O\' Plenty", new Achievement[] {achFlower, achRedRock, achThorn, achAsh, achOrigin, achPromised, achMud, achShroom, achBarley, achMoss});
AchievementPage.registerAchievementPage(pageBOP);
// Add Achievement registration
addAchievementDesc("achFlower", "Flower Child", "Pick some flowers!");
addAchievementDesc("achRedRock", "Red Rocky Mountain High", "Dig out some red rocks.");
addAchievementDesc("achThorn", "Rather Thorny...", "Don\'t get cut!");
addAchievementDesc("achAsh", "Ash-ievement", "Get it? \'Cause it\'s ash.");
addAchievementDesc("achOrigin", "Alpha...", "Get some grass from the Origin Valley.");
addAchievementDesc("achPromised", "...Omega", "Welcome to the Promised Land!");
addAchievementDesc("achMud", "Sticky Situation", "I just had these boots cleaned!");
addAchievementDesc("achShroom", "Trippin\'", "Don\'t try this at home, kids!");
addAchievementDesc("achBarley", "Fields Of Gold", "Upon the fields of barley.");
addAchievementDesc("achMoss", "Mossman", "Mothman's long-lost cousin.");
}
// Achievement checker
private static void onItemPickup(EntityPlayer player, ItemStack item)
{
if (BOPConfiguration.achievements == true)
{
if (item.itemID == BOPBlocks.glowFlower.blockID || item.itemID == BOPBlocks.orangeFlower.blockID || item.itemID == BOPBlocks.blueFlower.blockID || item.itemID == BOPBlocks.purpleFlower.blockID || item.itemID == BOPBlocks.pinkFlower.blockID || item.itemID == BOPBlocks.whiteFlower.blockID || item.itemID == BOPBlocks.tinyFlower.blockID || item.itemID == BOPBlocks.deathbloom.blockID || item.itemID == BOPBlocks.hydrangea.blockID || item.itemID == BOPBlocks.violet.blockID || item.itemID == Block.plantRed.blockID || item.itemID == Block.plantYellow.blockID)
{
player.addStat(achFlower, 1);
}
if (item.itemID == BOPBlocks.redRockCobble.blockID)
{
player.addStat(achRedRock, 1);
}
if (item.itemID == BOPBlocks.thorn.blockID)
{
player.addStat(achThorn, 1);
}
if (item.itemID == BOPItems.ashes.itemID)
{
player.addStat(achAsh, 1);
}
if (item.itemID == BOPBlocks.originGrass.blockID)
{
player.addStat(achOrigin, 1);
}
if (item.itemID == BOPBlocks.holyGrass.blockID || item.itemID == BOPBlocks.holyStone.blockID)
{
player.addStat(achPromised, 1);
}
if (item.itemID == BOPItems.mudBall.itemID)
{
player.addStat(achMud, 1);
}
if (item.itemID == BOPBlocks.toadstool.blockID)
{
player.addStat(achShroom, 1);
}
if (item.itemID == BOPItems.barleyItem.itemID)
{
player.addStat(achBarley, 1);
}
if (item.itemID == BOPItems.mossItem.itemID)
{
player.addStat(achMoss, 1);
}
}
}
private static void addAchievementDesc(String ach, String name, String desc)
{
LanguageRegistry.instance().addStringLocalization("achievement." + ach, "en_US", name);
LanguageRegistry.instance().addStringLocalization("achievement." + ach + ".desc", "en_US", desc);
}
}

View File

@ -1,19 +0,0 @@
package biomesoplenty.helpers;
import biomesoplenty.mod_BiomesOPlenty;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
public class AchievementPickup
{
@SuppressWarnings("unused")
private ItemStack pickupItemStack;
@ForgeSubscribe
public void EntityItemPickupEvent(EntityItemPickupEvent event)
{
mod_BiomesOPlenty.onItemPickup(event.entityPlayer, event.item.getEntityItem());
}
}

View File

@ -1,14 +1,173 @@
package biomesoplenty.helpers;
import biomesoplenty.mod_BiomesOPlenty;
import net.minecraft.item.ItemStack;
import biomesoplenty.configuration.BOPBlocks;
import biomesoplenty.configuration.BOPItems;
import cpw.mods.fml.common.IFuelHandler;
public class FurnaceFuel implements IFuelHandler {
@Override
public int getBurnTime(ItemStack fuel) {
return mod_BiomesOPlenty.addFuel(fuel.itemID, fuel.getItemDamage());
return addFuel(fuel.itemID, fuel.getItemDamage());
}
// Add Fuel rates
private static int addFuel(int par1, int par2)
{
if(par1 == BOPBlocks.redwoodSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.redwoodSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.redwoodStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.willowSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.willowSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.willowStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.firSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.firSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.firStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.acaciaSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.acaciaSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.acaciaStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.pinkSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.whiteSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.orangeSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.yellowSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.redSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.brownSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.appleSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.originSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.cherrySingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.cherryStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.darkSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.darkSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.darkStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.magicSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.magicSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.magicStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.palmSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.palmSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.palmStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.mangroveSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.mangroveSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.mangroveStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.holySapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.holySingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.holyStairs.blockID)
{
return 300;
}
if(par1 == BOPItems.ashes.itemID)
{
return 400;
}
return 0;
}
}

View File

@ -6,12 +6,25 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.Level;
import net.minecraft.block.BlockDispenser;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
import biomesoplenty.api.Biomes;
import biomesoplenty.configuration.BOPBiomes;
import biomesoplenty.configuration.BOPBlocks;
import biomesoplenty.configuration.BOPConfiguration;
import biomesoplenty.configuration.BOPItems;
import biomesoplenty.helpers.AchievementPickup;
import biomesoplenty.helpers.AchievementHelper;
import biomesoplenty.helpers.BonemealUse;
import biomesoplenty.helpers.CreativeTabsBOP;
import biomesoplenty.helpers.WorldProviderPromised;
@ -21,24 +34,6 @@ import biomesoplenty.items.projectiles.DispenserBehaviorMudball;
import biomesoplenty.items.projectiles.EntityMudball;
import biomesoplenty.mobs.EntityJungleSpider;
import biomesoplenty.mobs.EntityRosester;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.AchievementPage;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
@ -117,31 +112,7 @@ public class mod_BiomesOPlenty
// Achievement declaration
if (BOPConfiguration.achievements == true)
{
achFlower2 = (new Achievement(3057, "achFlower2", 0, 0, Block.plantRed, null)).registerAchievement();
achRedRock2 = (new Achievement(3058, "achRedRock2", -1, 2, BOPBlocks.redRock, achFlower2)).registerAchievement();
achThorn2 = (new Achievement(3059, "achThorn2", 2, 1, BOPBlocks.thorn, achFlower2)).registerAchievement();
achAsh2 = (new Achievement(3060, "achAsh2", 1, 3, BOPItems.ashes, achFlower2)).registerAchievement();
achOrigin2 = (new Achievement(3061, "achOrigin2", 0, 5, BOPBlocks.originGrass, achFlower2)).setSpecial().registerAchievement();
achPromised2 = (new Achievement(3062, "achPromised2", 0, -5, BOPBlocks.holyGrass, achFlower2)).setSpecial().registerAchievement();
achMud2 = (new Achievement(3063, "achMud2", -2, -1, BOPItems.mudBall, achFlower2)).registerAchievement();
achShroom2 = (new Achievement(3064, "achShroom2", 1, -2, BOPBlocks.toadstool, achFlower2)).registerAchievement();
achBarley2 = (new Achievement(3065, "achBarley2", -2, 4, BOPItems.barleyItem, achFlower2)).registerAchievement();
achMoss2 = (new Achievement(3066, "achMoss2", -1, -3, BOPItems.mossItem, achFlower2)).registerAchievement();
pageBOP = new AchievementPage("Biomes O\' Plenty", new Achievement[] {achFlower2, achRedRock2, achThorn2, achAsh2, achOrigin2, achPromised2, achMud2, achShroom2, achBarley2, achMoss2});
AchievementPage.registerAchievementPage(pageBOP);
// Add Achievement registration
addAchievementDesc("achFlower2", "Flower Child", "Pick some flowers!");
addAchievementDesc("achRedRock2", "Red Rocky Mountain High", "Dig out some red rocks.");
addAchievementDesc("achThorn2", "Rather Thorny...", "Don\'t get cut!");
addAchievementDesc("achAsh2", "Ash-ievement", "Get it? \'Cause it\'s ash.");
addAchievementDesc("achOrigin2", "Alpha...", "Get some grass from the Origin Valley.");
addAchievementDesc("achPromised2", "...Omega", "Welcome to the Promised Land!");
addAchievementDesc("achMud2", "Sticky Situation", "I just had these boots cleaned!");
addAchievementDesc("achShroom2", "Trippin\'", "Don\'t try this at home, kids!");
addAchievementDesc("achBarley2", "Fields Of Gold", "Upon the fields of barley.");
addAchievementDesc("achMoss2", "Mossman", "Mothman's long-lost cousin.");
AchievementHelper.init();
}
}
@ -156,7 +127,7 @@ public class mod_BiomesOPlenty
// Add helpers for compatibility
MinecraftForge.TERRAIN_GEN_BUS.register(new WorldTypeSize());
MinecraftForge.EVENT_BUS.register(new AchievementPickup());
MinecraftForge.EVENT_BUS.register(new AchievementHelper());
MinecraftForge.EVENT_BUS.register(new BonemealUse());
proxy.registerRenderers();
@ -231,22 +202,6 @@ public class mod_BiomesOPlenty
//Eggs
public static int eggIdCounter = 300;
public static AchievementPage pageBOP;
// Item declaration
// Achievement declaration
public static Achievement achFlower2;
public static Achievement achRedRock2;
public static Achievement achThorn2;
public static Achievement achAsh2;
public static Achievement achOrigin2;
public static Achievement achPromised2;
public static Achievement achMud2;
public static Achievement achShroom2;
public static Achievement achBarley2;
public static Achievement achMoss2;
public static CreativeTabs tabBiomesOPlenty;
public static ChestGenHooks dungeon;
@ -255,219 +210,6 @@ public class mod_BiomesOPlenty
public static ChestGenHooks strongholdCrossing;
public static ChestGenHooks village;
// Add Fuel rates
public static int addFuel(int par1, int par2)
{
if(par1 == BOPBlocks.redwoodSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.redwoodSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.redwoodStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.willowSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.willowSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.willowStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.firSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.firSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.firStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.acaciaSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.acaciaSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.acaciaStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.pinkSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.whiteSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.orangeSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.yellowSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.redSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.brownSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.appleSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.originSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.cherrySingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.cherryStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.darkSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.darkSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.darkStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.magicSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.magicSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.magicStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.palmSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.palmSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.palmStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.mangroveSapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.mangroveSingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.mangroveStairs.blockID)
{
return 300;
}
if(par1 == BOPBlocks.holySapling.blockID)
{
return 100;
}
if(par1 == BOPBlocks.holySingleSlab.blockID)
{
return 150;
}
if(par1 == BOPBlocks.holyStairs.blockID)
{
return 300;
}
if(par1 == BOPItems.ashes.itemID)
{
return 400;
}
return 0;
}
// Achievement checker
public static void onItemPickup(EntityPlayer player, ItemStack item)
{
if (BOPConfiguration.achievements == true)
{
if (item.itemID == BOPBlocks.glowFlower.blockID || item.itemID == BOPBlocks.orangeFlower.blockID || item.itemID == BOPBlocks.blueFlower.blockID || item.itemID == BOPBlocks.purpleFlower.blockID || item.itemID == BOPBlocks.pinkFlower.blockID || item.itemID == BOPBlocks.whiteFlower.blockID || item.itemID == BOPBlocks.tinyFlower.blockID || item.itemID == BOPBlocks.deathbloom.blockID || item.itemID == BOPBlocks.hydrangea.blockID || item.itemID == BOPBlocks.violet.blockID || item.itemID == Block.plantRed.blockID || item.itemID == Block.plantYellow.blockID)
{
player.addStat(achFlower2, 1);
}
if (item.itemID == BOPBlocks.redRockCobble.blockID)
{
player.addStat(achRedRock2, 1);
}
if (item.itemID == BOPBlocks.thorn.blockID)
{
player.addStat(achThorn2, 1);
}
if (item.itemID == BOPItems.ashes.itemID)
{
player.addStat(achAsh2, 1);
}
if (item.itemID == BOPBlocks.originGrass.blockID)
{
player.addStat(achOrigin2, 1);
}
if (item.itemID == BOPBlocks.holyGrass.blockID || item.itemID == BOPBlocks.holyStone.blockID)
{
player.addStat(achPromised2, 1);
}
if (item.itemID == BOPItems.mudBall.itemID)
{
player.addStat(achMud2, 1);
}
if (item.itemID == BOPBlocks.toadstool.blockID)
{
player.addStat(achShroom2, 1);
}
if (item.itemID == BOPItems.barleyItem.itemID)
{
player.addStat(achBarley2, 1);
}
if (item.itemID == BOPItems.mossItem.itemID)
{
player.addStat(achMoss2, 1);
}
}
}
public static void addAchievementDesc(String ach, String name, String desc)
{
LanguageRegistry.instance().addStringLocalization("achievement." + ach, "en_US", name);
LanguageRegistry.instance().addStringLocalization("achievement." + ach + ".desc", "en_US", desc);
}
public static int getLastBiomeID()
{
int x;