2013-10-18 23:57:56 +00:00
|
|
|
package biomesoplenty.configuration;
|
2013-05-03 13:00:44 +00:00
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-07-03 12:26:06 +00:00
|
|
|
import net.minecraft.item.Item;
|
2013-05-03 13:00:44 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.stats.Achievement;
|
2013-07-03 12:26:06 +00:00
|
|
|
import net.minecraft.util.MathHelper;
|
|
|
|
import net.minecraft.world.World;
|
2013-05-03 13:00:44 +00:00
|
|
|
import net.minecraftforge.common.AchievementPage;
|
|
|
|
import net.minecraftforge.event.ForgeSubscribe;
|
2013-07-03 12:26:06 +00:00
|
|
|
import net.minecraftforge.event.entity.EntityEvent;
|
|
|
|
import biomesoplenty.api.Biomes;
|
2013-05-03 13:00:44 +00:00
|
|
|
import biomesoplenty.api.Blocks;
|
2013-07-09 04:10:57 +00:00
|
|
|
import biomesoplenty.api.Fluids;
|
2013-07-19 22:42:53 +00:00
|
|
|
import biomesoplenty.api.Items;
|
2013-09-14 10:16:39 +00:00
|
|
|
import biomesoplenty.configuration.configfile.BOPConfigurationMisc;
|
2013-05-03 13:00:44 +00:00
|
|
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
|
|
|
|
2013-10-18 23:57:56 +00:00
|
|
|
public class BOPAchievements
|
2013-05-03 13:00:44 +00:00
|
|
|
{
|
2013-05-31 10:34:02 +00:00
|
|
|
// Achievement declaration
|
2013-11-13 01:55:01 +00:00
|
|
|
public static Achievement achFlower;
|
2013-06-25 23:11:07 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
public static Achievement achFlowerBand;
|
|
|
|
public static Achievement achDartBlower;
|
|
|
|
public static Achievement achScythe;
|
|
|
|
public static Achievement achEnderporter;
|
2013-07-04 22:45:11 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
public static Achievement achBerry;
|
|
|
|
public static Achievement achMoss;
|
|
|
|
public static Achievement achThorn;
|
|
|
|
public static Achievement achCoral;
|
2013-07-04 22:45:11 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
public static Achievement achHoney;
|
|
|
|
public static Achievement achWitherWart;
|
|
|
|
public static Achievement achGrave;
|
|
|
|
public static Achievement achPhantom;
|
2013-08-06 22:16:08 +00:00
|
|
|
|
|
|
|
public static Achievement achPromised;
|
2013-11-13 01:55:01 +00:00
|
|
|
public static Achievement achCelestial;
|
|
|
|
public static Achievement achBird;
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-06-23 09:19:48 +00:00
|
|
|
public static AchievementPage pageBiome;
|
2013-07-05 01:20:48 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
static Achievement[] biomesOPlentyAchievementList;
|
2013-05-03 13:00:44 +00:00
|
|
|
|
|
|
|
public static void init()
|
|
|
|
{
|
2013-11-13 01:55:01 +00:00
|
|
|
achFlower = (new Achievement(3080, "bop.achFlower", 0, 0, new ItemStack(Block.plantRed, 1, 0), null)).registerAchievement();
|
2013-07-03 12:26:06 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
achFlowerBand = (new Achievement(3081, "bop.achFlowerBand", 2, -1, new ItemStack(Items.flowerBand.get(), 1, 0), achFlower)).registerAchievement();
|
|
|
|
achDartBlower = (new Achievement(3082, "bop.achDartBlower", 4, -2, new ItemStack(Items.dartBlower.get(), 1, 0), achFlowerBand)).registerAchievement();
|
|
|
|
achScythe = (new Achievement(3083, "bop.achScythe", 3, 1, new ItemStack(Items.scytheIron.get(), 1, 0), achDartBlower)).registerAchievement();
|
|
|
|
achEnderporter = (new Achievement(3084, "bop.achEnderporter", 5, 3, new ItemStack(Items.enderporter.get(), 1, 0), achScythe)).registerAchievement().setSpecial();
|
2013-07-03 12:26:06 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
achBerry = (new Achievement(3085, "bop.achBerry", -2, 0, new ItemStack(Items.food.get(), 1, 0), achFlower)).registerAchievement();
|
|
|
|
achMoss = (new Achievement(3086, "bop.achMoss", -4, 1, new ItemStack(Blocks.moss.get(), 1, 0), achBerry)).registerAchievement();
|
|
|
|
achThorn = (new Achievement(3087, "bop.achThorn", -5, -1, new ItemStack(Blocks.plants.get(), 1, 5), achMoss)).registerAchievement();
|
|
|
|
achCoral = (new Achievement(3088, "bop.achCoral", -3, -2, new ItemStack(Blocks.coral.get(), 1, 4), achThorn)).registerAchievement();
|
2013-07-03 12:26:06 +00:00
|
|
|
|
2013-11-13 09:27:47 +00:00
|
|
|
achHoney = (new Achievement(3089, "bop.achHoney", -1, 2, new ItemStack(Items.food.get(), 1, 9), achFlower)).registerAchievement();
|
2013-11-13 01:55:01 +00:00
|
|
|
achWitherWart = (new Achievement(3090, "bop.achWitherWart", 1, 3, new ItemStack(Blocks.plants.get(), 1, 13), achHoney)).registerAchievement();
|
|
|
|
achGrave = (new Achievement(3091, "bop.achGrave", -2, 4, new ItemStack(Blocks.grave.get(), 1, 0), achWitherWart)).registerAchievement();
|
2013-11-13 09:57:25 +00:00
|
|
|
achPhantom = (new Achievement(3092, "bop.achPhantom", 0, 6, new ItemStack(Items.miscItems.get(), 1, 10), achGrave)).registerAchievement().setSpecial();
|
2013-07-03 12:26:06 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
achPromised = (new Achievement(3093, "bop.achPromised", 1, -3, new ItemStack(Blocks.holyGrass.get(), 1, 0), achFlower)).registerAchievement().setSpecial();
|
|
|
|
achCelestial = (new Achievement(3094, "bop.achCelestial", -1, -4, new ItemStack(Items.miscItems.get(), 1, 4), achPromised)).registerAchievement();
|
|
|
|
achBird = (new Achievement(3095, "bop.achBird", 0, -6, new ItemStack(Item.feather, 1, 0), achCelestial)).registerAchievement();
|
2013-07-03 12:26:06 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
biomesOPlentyAchievementList = new Achievement[] { achFlower, achFlowerBand, achDartBlower, achScythe, achEnderporter, achBerry, achMoss, achThorn, achCoral,
|
|
|
|
achHoney, achWitherWart, achGrave, achPhantom, achPromised, achCelestial, achBird};
|
2013-07-05 03:19:54 +00:00
|
|
|
|
2013-11-13 01:55:01 +00:00
|
|
|
pageBiome = new AchievementPage("Biomes O\' Plenty", biomesOPlentyAchievementList);
|
2013-07-03 12:26:06 +00:00
|
|
|
|
2013-06-23 09:19:48 +00:00
|
|
|
AchievementPage.registerAchievementPage(pageBiome);
|
2013-05-31 10:34:02 +00:00
|
|
|
}
|
2013-07-03 12:26:06 +00:00
|
|
|
|
|
|
|
@ForgeSubscribe
|
|
|
|
public void chunkEntered(EntityEvent.EnteringChunk event)
|
|
|
|
{
|
2013-09-14 10:16:39 +00:00
|
|
|
if (BOPConfigurationMisc.achievements)
|
2013-07-03 12:26:06 +00:00
|
|
|
{
|
2013-07-05 04:05:59 +00:00
|
|
|
if (event.entity != null)
|
2013-07-03 12:26:06 +00:00
|
|
|
{
|
2013-07-05 04:05:59 +00:00
|
|
|
if (event.entity instanceof EntityPlayer)
|
2013-07-05 03:19:54 +00:00
|
|
|
{
|
2013-07-05 04:05:59 +00:00
|
|
|
EntityPlayer player = (EntityPlayer)event.entity;
|
|
|
|
World world = player.worldObj;
|
|
|
|
|
|
|
|
int x = MathHelper.floor_double(player.posX);
|
|
|
|
int y = MathHelper.floor_double(player.boundingBox.minY);
|
|
|
|
int z = MathHelper.floor_double(player.posZ);
|
|
|
|
|
|
|
|
int biomeID = world.getBiomeGenForCoords(x, z).biomeID;
|
2013-08-06 22:16:08 +00:00
|
|
|
|
|
|
|
if (biomeID == Biomes.promisedLandForest.get().biomeID)
|
|
|
|
{
|
2013-10-18 23:57:56 +00:00
|
|
|
player.addStat(BOPAchievements.achPromised, 1);
|
2013-08-06 22:16:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (biomeID == Biomes.promisedLandPlains.get().biomeID)
|
|
|
|
{
|
2013-10-18 23:57:56 +00:00
|
|
|
player.addStat(BOPAchievements.achPromised, 1);
|
2013-08-06 22:16:08 +00:00
|
|
|
}
|
|
|
|
|
2013-11-14 07:50:25 +00:00
|
|
|
if (biomeID == Biomes.promisedLandShrub.get().biomeID)
|
|
|
|
{
|
|
|
|
player.addStat(BOPAchievements.achPromised, 1);
|
|
|
|
}
|
|
|
|
|
2013-08-06 22:16:08 +00:00
|
|
|
if (biomeID == Biomes.promisedLandSwamp.get().biomeID)
|
|
|
|
{
|
2013-10-18 23:57:56 +00:00
|
|
|
player.addStat(BOPAchievements.achPromised, 1);
|
2013-08-06 22:16:08 +00:00
|
|
|
}
|
2013-07-04 22:45:11 +00:00
|
|
|
}
|
2013-07-03 12:26:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2013-07-17 09:42:06 +00:00
|
|
|
}
|