From 2cac51952b1d5169c6b5d93ab6ab3a50e5ce5653 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 9 Dec 2015 15:47:57 +0100 Subject: [PATCH] More chieves --- .../achievement/InitAchievements.java | 10 +++--- .../achievement/TheAchievements.java | 34 ++++++++++++++----- .../event/PlayerObtainEvents.java | 8 ++--- .../assets/actuallyadditions/lang/en_US.lang | 27 +++++++++++++++ 4 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java b/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java index c2397bae7..1021620e5 100644 --- a/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java +++ b/src/main/java/ellpeck/actuallyadditions/achievement/InitAchievements.java @@ -19,10 +19,12 @@ import java.util.ArrayList; public class InitAchievements{ - public static final int MISC_ACH = -1; - public static final int CRAFTING_ACH = 0; - public static final int SMELTING_ACH = 1; - public static final int PICKUP_ACH = 2; + public enum Type{ + CRAFTING, + SMELTING, + PICK_UP, + MISC + } public static int pageNumber; diff --git a/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java b/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java index 289d7bb74..e5b5437c5 100644 --- a/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java +++ b/src/main/java/ellpeck/actuallyadditions/achievement/TheAchievements.java @@ -18,23 +18,39 @@ import net.minecraft.stats.Achievement; public enum TheAchievements{ - OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemBooklet), null, InitAchievements.MISC_ACH), - NAME_SMILEY_CLOUD("nameSmileyCloud", 2, 0, new ItemStack(InitBlocks.blockSmileyCloud), OPEN_BOOKLET.ach, InitAchievements.MISC_ACH), - CRAFT_PHANTOMFACE("craftPhantomface", -2, 0, new ItemStack(InitBlocks.blockPhantomface), OPEN_BOOKLET.ach), - OPEN_TREASURE_CHEST("openTreasureChest", 0, -2, new ItemStack(InitBlocks.blockTreasureChest), OPEN_BOOKLET.ach, InitAchievements.MISC_ACH); + OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemBooklet), null, InitAchievements.Type.MISC), + NAME_SMILEY_CLOUD("nameSmileyCloud", 4, 2, new ItemStack(InitBlocks.blockSmileyCloud), null, InitAchievements.Type.MISC, true), + OPEN_TREASURE_CHEST("openTreasureChest", 1, -3, new ItemStack(InitBlocks.blockTreasureChest), OPEN_BOOKLET, InitAchievements.Type.MISC), + CRAFT_COAL_GEN("craftCoalGen", -2, 0, new ItemStack(InitBlocks.blockCoalGenerator), OPEN_BOOKLET), + CRAFT_LEAF_GEN("craftLeafGen", -3, -2, new ItemStack(InitBlocks.blockLeafGenerator), CRAFT_COAL_GEN), + CRAFT_RECONSTRUCTOR("craftReconstructor", -5, 0, new ItemStack(InitBlocks.blockAtomicReconstructor), CRAFT_COAL_GEN), + CRAFT_PHANTOMFACE("craftPhantomface", 2, 0, new ItemStack(InitBlocks.blockPhantomface), OPEN_BOOKLET), + CRAFT_LIQUIFACE("craftLiquiface", 2, 2, new ItemStack(InitBlocks.blockPhantomLiquiface), CRAFT_PHANTOMFACE), + CRAFT_ENERGYFACE("craftEnergyface", 2, -2, new ItemStack(InitBlocks.blockPhantomEnergyface), CRAFT_PHANTOMFACE), + CRAFT_LASER_RELAY("craftLaserRelay", -7, -2, new ItemStack(InitBlocks.blockLaserRelay), CRAFT_RECONSTRUCTOR), + CRAFT_CRUSHER("craftCrusher", -8, 0, new ItemStack(InitBlocks.blockGrinder), CRAFT_RECONSTRUCTOR), + PICK_UP_COFFEE("pickUpCoffee", -4, 2, new ItemStack(InitItems.itemCoffeeBean), CRAFT_RECONSTRUCTOR, InitAchievements.Type.PICK_UP), + CRAFT_COFFEE_MACHINE("craftCoffeeMachine", -3, 3, new ItemStack(InitBlocks.blockCoffeeMachine), PICK_UP_COFFEE); public final Achievement ach; - public final int type; + public final InitAchievements.Type type; - TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){ - this(name, x, y, displayStack, hasToHaveBefore, InitAchievements.CRAFTING_ACH); + TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore){ + this(name, x, y, displayStack, hasToHaveBefore, InitAchievements.Type.CRAFTING, false); } - TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore, int type){ - this.ach = new Achievement("achievement."+ModUtil.MOD_ID_LOWER+"."+name, ModUtil.MOD_ID_LOWER+"."+name, x, y, displayStack, hasToHaveBefore); + TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, InitAchievements.Type type){ + this(name, x, y, displayStack, hasToHaveBefore, type, false); + } + + TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, InitAchievements.Type type, boolean special){ + this.ach = new Achievement("achievement."+ModUtil.MOD_ID_LOWER+"."+name, ModUtil.MOD_ID_LOWER+"."+name, x, y, displayStack, hasToHaveBefore == null ? null : hasToHaveBefore.ach); if(hasToHaveBefore == null){ this.ach.initIndependentStat(); } + if(special){ + this.ach.setSpecial(); + } this.ach.registerStat(); this.type = type; } diff --git a/src/main/java/ellpeck/actuallyadditions/event/PlayerObtainEvents.java b/src/main/java/ellpeck/actuallyadditions/event/PlayerObtainEvents.java index 634f24950..50638ce8d 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/PlayerObtainEvents.java +++ b/src/main/java/ellpeck/actuallyadditions/event/PlayerObtainEvents.java @@ -32,7 +32,7 @@ public class PlayerObtainEvents{ @SubscribeEvent public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){ - checkAchievements(event.crafting, event.player, InitAchievements.CRAFTING_ACH); + checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING); if(ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()){ if(!event.player.worldObj.isRemote && event.crafting.getItem() != InitItems.itemBooklet){ @@ -55,7 +55,7 @@ public class PlayerObtainEvents{ } } - public static void checkAchievements(ItemStack gotten, EntityPlayer player, int type){ + public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){ for(int i = 0; i < TheAchievements.values().length; i++){ TheAchievements ach = TheAchievements.values()[i]; if(ach.type == type){ @@ -70,11 +70,11 @@ public class PlayerObtainEvents{ @SubscribeEvent public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){ - checkAchievements(event.smelting, event.player, InitAchievements.SMELTING_ACH); + checkAchievements(event.smelting, event.player, InitAchievements.Type.SMELTING); } @SubscribeEvent public void onPickupEvent(PlayerEvent.ItemPickupEvent event){ - checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.PICKUP_ACH); + checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.Type.PICK_UP); } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 43ef205e3..531119783 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -419,6 +419,33 @@ achievement.actuallyadditions.craftPhantomface.desc=Craft a Phantomface achievement.actuallyadditions.openTreasureChest=Underwater Dungeon achievement.actuallyadditions.openTreasureChest.desc=Open a Treasure Chest +achievement.actuallyadditions.craftLiquiface=Zoom, Zoom, Fluids! +achievement.actuallyadditions.craftLiquiface.desc=Craft a Phantom Liquiface + +achievement.actuallyadditions.craftEnergyface=Zoom, Zoom, RF! +achievement.actuallyadditions.craftEnergyface.desc=Craft a Phantom Energyface + +achievement.actuallyadditions.craftCoalGen=Furnace for cools +achievement.actuallyadditions.craftCoalGen.desc=Craft a Coal Generator + +achievement.actuallyadditions.craftLeafGen=Munch, dude! +achievement.actuallyadditions.craftLeafGen.desc=Craft a Leaf-Eating Generator + +achievement.actuallyadditions.craftReconstructor=Bzrrrrt something else +achievement.actuallyadditions.craftReconstructor.desc=Craft an Atomic Reconstructor + +achievement.actuallyadditions.craftLaserRelay=Relayed, not delayed +achievement.actuallyadditions.craftLaserRelay.desc=Craft a Laser Relay + +achievement.actuallyadditions.craftCrusher=Doublin' up! +achievement.actuallyadditions.craftCrusher.desc=Craft a Crusher + +achievement.actuallyadditions.pickUpCoffee=Makes you addicted +achievement.actuallyadditions.pickUpCoffee.desc=Harvest some coffee + +achievement.actuallyadditions.craftCoffeeMachine=Addiction in cups +achievement.actuallyadditions.craftCoffeeMachine.desc=Craft a Coffee Machine + #Booklet Recipe Names booklet.actuallyadditions.shapelessRecipe=Shapeless Recipe booklet.actuallyadditions.shapedRecipe=Shaped Recipe