mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Two new chieves
This commit is contained in:
parent
9f36b42d30
commit
6a80b6d988
9 changed files with 37 additions and 26 deletions
|
@ -17,9 +17,9 @@ import net.minecraftforge.common.AchievementPage;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class InitAchievements{
|
||||
public final class InitAchievements{
|
||||
|
||||
public static final ArrayList<Achievement> achievementList = new ArrayList<Achievement>();
|
||||
public static final ArrayList<Achievement> ACHIEVEMENT_LIST = new ArrayList<Achievement>();
|
||||
public static int pageNumber;
|
||||
public static AchievementPage theAchievementPage;
|
||||
|
||||
|
@ -27,10 +27,10 @@ public class InitAchievements{
|
|||
ModUtil.LOGGER.info("Initializing Achievements...");
|
||||
|
||||
for(int i = 0; i < TheAchievements.values().length; i++){
|
||||
achievementList.add(TheAchievements.values()[i].ach);
|
||||
ACHIEVEMENT_LIST.add(TheAchievements.values()[i].chieve);
|
||||
}
|
||||
|
||||
theAchievementPage = new AchievementPage(StringUtil.localize("achievement.page."+ModUtil.MOD_ID), achievementList.toArray(new Achievement[achievementList.size()]));
|
||||
theAchievementPage = new AchievementPage(StringUtil.localize("achievement.page."+ModUtil.MOD_ID), ACHIEVEMENT_LIST.toArray(new Achievement[ACHIEVEMENT_LIST.size()]));
|
||||
pageNumber = AchievementPage.getAchievementPages().size();
|
||||
AchievementPage.registerAchievementPage(theAchievementPage);
|
||||
}
|
||||
|
|
|
@ -10,17 +10,19 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.achievement;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements.Type;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public enum TheAchievements{
|
||||
|
||||
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),
|
||||
OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemBooklet), null, Type.MISC),
|
||||
NAME_SMILEY_CLOUD("nameSmileyCloud", 4, 2, new ItemStack(InitBlocks.blockSmileyCloud), null, Type.MISC, true),
|
||||
OPEN_TREASURE_CHEST("openTreasureChest", 1, -3, new ItemStack(InitBlocks.blockTreasureChest), OPEN_BOOKLET, 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),
|
||||
|
@ -29,29 +31,31 @@ public enum TheAchievements{
|
|||
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);
|
||||
PICK_UP_COFFEE("pickUpCoffee", -4, 2, new ItemStack(InitItems.itemCoffeeBean), CRAFT_RECONSTRUCTOR, Type.PICK_UP),
|
||||
CRAFT_COFFEE_MACHINE("craftCoffeeMachine", -3, 3, new ItemStack(InitBlocks.blockCoffeeMachine), PICK_UP_COFFEE),
|
||||
OBSCURED("obscured", 5, -5, new ItemStack(Items.RECORD_11), null, Type.MISC, true),
|
||||
CRAFT_FIREWORK_BOX("craftFireworkBox", -6, -4, new ItemStack(InitBlocks.blockFireworkBox), null, Type.CRAFTING, true);
|
||||
|
||||
public final Achievement ach;
|
||||
public final InitAchievements.Type type;
|
||||
public final Achievement chieve;
|
||||
public final Type type;
|
||||
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore){
|
||||
this(name, x, y, displayStack, hasToHaveBefore, InitAchievements.Type.CRAFTING, false);
|
||||
this(name, x, y, displayStack, hasToHaveBefore, Type.CRAFTING, 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+"."+name, ModUtil.MOD_ID+"."+name, x, y, displayStack, hasToHaveBefore == null ? null : hasToHaveBefore.ach);
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, Type type, boolean special){
|
||||
this.chieve = new Achievement("achievement."+ModUtil.MOD_ID+"."+name, ModUtil.MOD_ID+"."+name, x, y, displayStack, hasToHaveBefore == null ? null : hasToHaveBefore.chieve);
|
||||
if(hasToHaveBefore == null){
|
||||
this.ach.initIndependentStat();
|
||||
this.chieve.initIndependentStat();
|
||||
}
|
||||
if(special){
|
||||
this.ach.setSpecial();
|
||||
this.chieve.setSpecial();
|
||||
}
|
||||
this.ach.registerStat();
|
||||
this.chieve.registerStat();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, InitAchievements.Type type){
|
||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, Type type){
|
||||
this(name, x, y, displayStack, hasToHaveBefore, type, false);
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||
|
@ -81,6 +82,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
|||
else if(item == Items.RECORD_11){
|
||||
reconstructor.counter++;
|
||||
reconstructor.markDirty();
|
||||
player.addStat(TheAchievements.OBSCURED.chieve);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -80,7 +80,7 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
|||
if(tile instanceof TileEntitySmileyCloud){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
player.addStat(TheAchievements.NAME_SMILEY_CLOUD.ach);
|
||||
player.addStat(TheAchievements.NAME_SMILEY_CLOUD.chieve);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -73,7 +73,7 @@ public class BlockTreasureChest extends BlockBase{
|
|||
this.dropItems(world, pos);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
player.addStat(TheAchievements.OPEN_TREASURE_CHEST.ach);
|
||||
player.addStat(TheAchievements.OPEN_TREASURE_CHEST.chieve);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class BookletUtils{
|
|||
if(page != null && page.getItemStacksForPage() != null){
|
||||
for(ItemStack stack : page.getItemStacksForPage()){
|
||||
if(stack != null){
|
||||
for(Achievement achievement : InitAchievements.achievementList){
|
||||
for(Achievement achievement : InitAchievements.ACHIEVEMENT_LIST){
|
||||
if(achievement.theItemStack != null && ItemUtil.areItemsEqual(stack, achievement.theItemStack, true)){
|
||||
if(pre){
|
||||
booklet.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
||||
|
|
|
@ -19,7 +19,6 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
|
||||
|
@ -30,9 +29,9 @@ public class PlayerObtainEvents{
|
|||
public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){
|
||||
for(TheAchievements ach : TheAchievements.values()){
|
||||
if(ach.type == type){
|
||||
if(gotten != null && ach.ach.theItemStack != null && gotten.getItem() == ach.ach.theItemStack.getItem()){
|
||||
if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){
|
||||
player.addStat(ach.ach, 1);
|
||||
if(gotten != null && ach.chieve.theItemStack != null && gotten.getItem() == ach.chieve.theItemStack.getItem()){
|
||||
if(gotten.getItemDamage() == ach.chieve.theItemStack.getItemDamage()){
|
||||
player.addStat(ach.chieve, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
|
|||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
|
||||
|
||||
if(!world.isRemote){
|
||||
player.addStat(TheAchievements.OPEN_BOOKLET.ach);
|
||||
player.addStat(TheAchievements.OPEN_BOOKLET.chieve);
|
||||
}
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
|
|
@ -636,6 +636,12 @@ achievement.actuallyadditions.pickUpCoffee.desc=Harvest some coffee
|
|||
achievement.actuallyadditions.craftCoffeeMachine=Addiction in cups
|
||||
achievement.actuallyadditions.craftCoffeeMachine.desc=Craft a Coffee Machine
|
||||
|
||||
achievement.actuallyadditions.obscured=§ksome chieve name
|
||||
achievement.actuallyadditions.obscured.desc=§klolwut y u actually look over meow
|
||||
|
||||
achievement.actuallyadditions.craftFireworkBox=Bang Boom Bang
|
||||
achievement.actuallyadditions.craftFireworkBox.desc=Craft a Firework Box
|
||||
|
||||
#Booklet Recipe Names
|
||||
booklet.actuallyadditions.shapelessRecipe=Shapeless Recipe
|
||||
booklet.actuallyadditions.shapedRecipe=Shaped Recipe
|
||||
|
|
Loading…
Reference in a new issue