make it give the achievement to the player who places it down, not the one who is the closest

This commit is contained in:
AEnterprise 2014-03-13 20:26:50 +01:00
parent dbc0fe42ad
commit 45d1458ae5
5 changed files with 16 additions and 10 deletions

View file

@ -110,8 +110,9 @@ public class BlockFiller extends BlockContainer {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack){
if (world.getClosestPlayer(i, j, k, 5)!=null){
world.getClosestPlayer(i, j, k, 5).addStat(BuildCraftCore.fasterFillingAchievement, 1);
if (entityliving instanceof EntityPlayer){
EntityPlayer p=(EntityPlayer) entityliving;
p.addStat(BuildCraftCore.fasterFillingAchievement, 1);
}
}
}

View file

@ -80,8 +80,9 @@ public class BlockAutoWorkbench extends BlockBuildCraft {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
if (world.getClosestPlayer(i, j, k, 5)!=null){
world.getClosestPlayer(i, j, k, 5).addStat(BuildCraftCore.aLotOfCraftingAchievement, 1);
if (entityliving instanceof EntityPlayer){
EntityPlayer p=(EntityPlayer) entityliving;
p.addStat(BuildCraftCore.aLotOfCraftingAchievement, 1);
}
}

View file

@ -24,6 +24,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@ -64,8 +65,9 @@ public class BlockMiningWell extends BlockBuildCraft {
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
ForgeDirection orientation = Utils.get2dOrientation(entityliving);
if (world.getClosestPlayer(i, j, k, 5)!=null){
world.getClosestPlayer(i, j, k, 5).addStat(BuildCraftCore.straightDownAchievement, 1);
if (entityliving instanceof EntityPlayer){
EntityPlayer p=(EntityPlayer) entityliving;
p.addStat(BuildCraftCore.straightDownAchievement, 1);
}
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal(),1);
}

View file

@ -52,8 +52,9 @@ public class BlockQuarry extends BlockBuildCraft {
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
super.onBlockPlacedBy(world, i, j, k, entityliving, stack);
if (world.getClosestPlayer(i, j, k, 5)!=null){
world.getClosestPlayer(i, j, k, 5).addStat(BuildCraftCore.chunkDestroyerAchievement, 1);
if (entityliving instanceof EntityPlayer){
EntityPlayer p=(EntityPlayer) entityliving;
p.addStat(BuildCraftCore.chunkDestroyerAchievement, 1);
}
ForgeDirection orientation = Utils.get2dOrientation(entityliving);

View file

@ -137,8 +137,9 @@ public class BlockLaserTable extends BlockContainer {
}
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack){
if (world.getClosestPlayer(i, j, k, 5)!=null){
world.getClosestPlayer(i, j, k, 5).addStat(BuildCraftCore.timeForSomeLogicAchievement, 1);
if (entityliving instanceof EntityPlayer){
EntityPlayer p=(EntityPlayer) entityliving;
p.addStat(BuildCraftCore.timeForSomeLogicAchievement, 1);
}
}
}