More chieves

This commit is contained in:
Ellpeck 2015-12-09 15:47:57 +01:00
parent 7fed9e6e81
commit 2cac51952b
4 changed files with 62 additions and 17 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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