mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 05:02:39 +00:00
Achievement stuffs
- Implemented 'Dual Convenience' achievement
This commit is contained in:
1 parent
3ec1f4860f
commit
b6be3e87ff
8 files changed
+63
-16
No files matched your search
@@ -571,7 +571,7 @@ achievement.tconstruct.proTinkerer=Pro Tinkerer
|
||||
achievement.tconstruct.smelteryMaker=Smeltery Creator
|
||||
achievement.tconstruct.preparedFight=Prepared to Fight
|
||||
achievement.tconstruct.enemySlayer=Enemy Slayer
|
||||
achievement.tconstruct.convenientDuo=Convenient Duo(NYI)
|
||||
achievement.tconstruct.dualConvenience=Dual Convenience
|
||||
|
||||
achievement.tconstruct.beginner.desc=Open the "Materials and You" manual
|
||||
achievement.tconstruct.pattern.desc=Craft your first blank pattern
|
||||
@@ -579,5 +579,5 @@ achievement.tconstruct.tinkerer.desc=Create your first tool
|
||||
achievement.tconstruct.proTinkerer.desc=Craft your first tier 2 tool
|
||||
achievement.tconstruct.smelteryMaker.desc=Craft a smeltery component
|
||||
achievement.tconstruct.preparedFight.desc=Create your first weapon
|
||||
achievement.tconstruct.enemySlayer.desc=Slay an enemy
|
||||
achievement.tconstruct.convenientDuo=Kill an enemy with a frying pan, and then cook their meat in it
|
||||
achievement.tconstruct.enemySlayer.desc=Slay a mob
|
||||
achievement.tconstruct.dualConvenience.desc=Kill a mob with a frying pan, and then cook their meat in it
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -287,7 +287,7 @@ public class FrypanLogic extends EquipLogic implements IActiveLogic
|
||||
@Override
|
||||
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
|
||||
{
|
||||
return new FrypanContainer(inventoryplayer, this);
|
||||
return new FrypanContainer(inventoryplayer.player, this);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
|
||||
@@ -2415,8 +2415,9 @@ public class TContent implements IFuelHandler
|
||||
achievements.put("tconstruct.pattern", new Achievement(2002, "tconstruct.pattern", 2, 1, blankPattern, achievements.get("tconstruct.beginner")).registerAchievement());
|
||||
achievements.put("tconstruct.tinkerer", new Achievement(2003, "tconstruct.tinkerer", 2, 2, new ItemStack(titleIcon, 1, 4096), achievements.get("tconstruct.pattern")).registerAchievement());
|
||||
achievements.put("tconstruct.preparedFight", new Achievement(2004, "tconstruct.preparedFight", 1, 3, new ItemStack(titleIcon, 1, 4097), achievements.get("tconstruct.tinkerer")).registerAchievement());
|
||||
achievements.put("tconstruct.proTinkerer", new Achievement(2005, "tconstruct.proTinkerer", 4, 3, new ItemStack(titleIcon, 1, 4098), achievements.get("tconstruct.tinkerer")).setSpecial().registerAchievement());
|
||||
achievements.put("tconstruct.proTinkerer", new Achievement(2005, "tconstruct.proTinkerer", 4, 4, new ItemStack(titleIcon, 1, 4098), achievements.get("tconstruct.tinkerer")).setSpecial().registerAchievement());
|
||||
achievements.put("tconstruct.smelteryMaker", new Achievement(2006, "tconstruct.smelteryMaker", -2, -1, smeltery, achievements.get("tconstruct.beginner")).registerAchievement());
|
||||
achievements.put("tconstruct.enemySlayer", new Achievement(2007, "tconstruct.enemySlayer", 0, 5, new ItemStack(titleIcon, 1, 4099), achievements.get("tconstruct.preparedFight")).registerAchievement());
|
||||
achievements.put("tconstruct.dualConvenience", new Achievement(2008, "tconstruct.dualConvenience", 0, 7, new ItemStack(titleIcon, 1, 4100), achievements.get("tconstruct.enemySlayer")).setSpecial().registerAchievement());
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
package tconstruct.inventory;
|
||||
|
||||
import tconstruct.blocks.logic.FrypanLogic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.blocks.logic.FrypanLogic;
|
||||
|
||||
public class FrypanContainer extends Container
|
||||
{
|
||||
@@ -15,13 +12,14 @@ public class FrypanContainer extends Container
|
||||
public int fuel = 0;
|
||||
public int fuelGague = 0;
|
||||
|
||||
public FrypanContainer(InventoryPlayer inventoryplayer, FrypanLogic frypan)
|
||||
public FrypanContainer(EntityPlayer player, FrypanLogic frypan)
|
||||
{
|
||||
InventoryPlayer inventoryplayer = player.inventory;
|
||||
logic = frypan;
|
||||
this.addSlotToContainer(new Slot(frypan, 1, 26, 45));
|
||||
for (int y = 0; y < 2; y++)
|
||||
for (int x = 0; x < 4; x++)
|
||||
this.addSlotToContainer(new Slot(frypan, 2 + x + y * 4, 70 + x * 18, 27 + y * 18));
|
||||
this.addSlotToContainer(new SlotFrypan(frypan, 2 + x + y * 4, 70 + x * 18, 27 + y * 18, player));
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package tconstruct.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.achievements.TAchievements;
|
||||
|
||||
public class SlotFrypan extends Slot{
|
||||
|
||||
public EntityPlayer player;
|
||||
|
||||
public SlotFrypan(IInventory par1IInventory, int par2, int par3, int par4, EntityPlayer player) {
|
||||
super(par1IInventory, par2, par3, par4);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack par1ItemStack){
|
||||
super.putStack(par1ItemStack);
|
||||
if(par1ItemStack != null && par1ItemStack.getItem() != null && par1ItemStack.getItem() instanceof ItemFood && par1ItemStack.hasTagCompound()){
|
||||
NBTTagCompound stackTagCompound = par1ItemStack.getTagCompound();
|
||||
if(stackTagCompound == null || !stackTagCompound.getBoolean("frypanKill")){
|
||||
return;
|
||||
}
|
||||
player.addStat(TAchievements.achievements.get("tconstruct.dualConvenience"), 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class TitleIcon extends Item
|
||||
int[] secondaryColor = { 0x1567BF, 0xFFEC6E };
|
||||
String[] mobNames = { "TConstruct.EdibleSlime", "TConstruct.KingSlime" };
|
||||
|
||||
String[] achievementIconNames = new String[] {"tinkerer", "preparedFight", "proTinkerer", "enemySlayer"};
|
||||
String[] achievementIconNames = new String[] {"tinkerer", "preparedFight", "proTinkerer", "enemySlayer", "dualConvenience"};
|
||||
Icon[] achievementIcons = new Icon[achievementIconNames.length];
|
||||
|
||||
public TitleIcon(int par1)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import tconstruct.achievements.TAchievements;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
@@ -23,8 +22,10 @@ import net.minecraftforge.event.entity.player.*;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.achievements.TAchievements;
|
||||
import tconstruct.blocks.*;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.items.tools.FryingPan;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.event.*;
|
||||
@@ -223,6 +224,23 @@ public class TEventHandler
|
||||
@ForgeSubscribe
|
||||
public void onLivingDrop (LivingDropsEvent event)
|
||||
{
|
||||
if(event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer){
|
||||
EntityPlayer player = (EntityPlayer)event.source.getEntity();
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof FryingPan){
|
||||
for(int i = 0; i < event.drops.size(); i++){
|
||||
ItemStack is = event.drops.get(i).getEntityItem();
|
||||
if(FurnaceRecipes.smelting().getSmeltingResult(is) != null && FurnaceRecipes.smelting().getSmeltingResult(is).getItem() instanceof ItemFood){
|
||||
NBTTagCompound stackCompound = is.getTagCompound();
|
||||
if(stackCompound == null){
|
||||
stackCompound = new NBTTagCompound();
|
||||
}
|
||||
stackCompound.setBoolean("frypanKill", true);
|
||||
is.setTagCompound(stackCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (random.nextInt(500) == 0 && event.entityLiving instanceof IMob && event.entityLiving.dimension == 0)
|
||||
{
|
||||
ItemStack dropStack = new ItemStack(TContent.heartCanister, 1, 1);
|
||||
|
||||
Reference in new issue
Block a user