Added the flower child achievement
This commit is contained in:
parent
91e57c1591
commit
449664a0c4
5 changed files with 77 additions and 0 deletions
|
@ -0,0 +1,16 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2016, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
package biomesoplenty.api.achievement;
|
||||
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public class BOPAchievements
|
||||
{
|
||||
public static Achievement obtain_flowers;
|
||||
|
||||
}
|
|
@ -1,7 +1,17 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2016, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
package biomesoplenty.common.handler;
|
||||
|
||||
import biomesoplenty.api.achievement.BOPAchievements;
|
||||
import biomesoplenty.common.block.BlockBOPFlower;
|
||||
import biomesoplenty.common.block.BlockBOPLog;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.stats.AchievementList;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
@ -14,10 +24,17 @@ public class AchievementEventHandler
|
|||
{
|
||||
Item item = event.pickedUp.getEntityItem().getItem();
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
EntityPlayer player = event.player;
|
||||
|
||||
if (block != null && block instanceof BlockBOPLog)
|
||||
{
|
||||
event.player.addStat(AchievementList.mineWood, 1);
|
||||
}
|
||||
|
||||
//Flower Child Achievement
|
||||
if (block != null && block instanceof BlockBOPFlower)
|
||||
{
|
||||
player.addStat(BOPAchievements.obtain_flowers, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
39
src/main/java/biomesoplenty/common/init/ModAchievements.java
Normal file
39
src/main/java/biomesoplenty/common/init/ModAchievements.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2016, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
package biomesoplenty.common.init;
|
||||
|
||||
import static biomesoplenty.api.achievement.BOPAchievements.*;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
|
||||
public class ModAchievements
|
||||
{
|
||||
public static final AchievementPage achievementPage = new AchievementPage("Biomes O\' Plenty");
|
||||
|
||||
public static void init()
|
||||
{
|
||||
AchievementPage.registerAchievementPage(achievementPage);
|
||||
|
||||
addAchievements();
|
||||
}
|
||||
|
||||
private static void addAchievements()
|
||||
{
|
||||
obtain_flowers = addAchievement("achievement.obtain_flowers", "obtain_flowers", 0, 0, new ItemStack(Blocks.red_flower), null);
|
||||
}
|
||||
|
||||
private static Achievement addAchievement(String unlocalizedName, String identifier, int column, int row, ItemStack iconStack, Achievement parent)
|
||||
{
|
||||
Achievement achievement = new Achievement(unlocalizedName, identifier, column, row, iconStack, parent);
|
||||
achievementPage.getAchievements().add(achievement);
|
||||
return achievement;
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import org.apache.logging.log4j.Logger;
|
|||
|
||||
import biomesoplenty.common.command.BOPCommand;
|
||||
import biomesoplenty.common.handler.GuiHandler;
|
||||
import biomesoplenty.common.init.ModAchievements;
|
||||
import biomesoplenty.common.init.ModBiomes;
|
||||
import biomesoplenty.common.init.ModBlockQueries;
|
||||
import biomesoplenty.common.init.ModBlocks;
|
||||
|
@ -73,6 +74,7 @@ public class BiomesOPlenty
|
|||
ModHandlers.init();
|
||||
|
||||
ModCrafting.init();
|
||||
ModAchievements.init();
|
||||
|
||||
proxy.registerRenderers();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
achievement.obtain_flowers=Flower Child
|
||||
achievement.obtain_flowers.desc=Become one with nature!
|
||||
|
||||
biome_finder.searching=Searching for %s
|
||||
biome_finder.found=Found %s!
|
||||
biome_finder.not_found=Not found, maybe %s is too far away
|
||||
|
|
Loading…
Reference in a new issue