Fix stat additions

This commit is contained in:
tterrag1098 committed 2015-05-29 15:52:03 -04:00
1 parent 8207002465
commit c0f182d7f7
7 files changed
+16 -13

No files matched your search

@@ -11,6 +11,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cricketcraft.chisel.api.ChiselAPIProps;
import com.cricketcraft.chisel.api.Statistics;
import com.cricketcraft.chisel.api.carving.CarvableHelper;
import com.cricketcraft.chisel.block.BlockCarvable;
import com.cricketcraft.chisel.carving.Carving;
@@ -1,4 +1,4 @@
package com.cricketcraft.chisel;
package com.cricketcraft.chisel.api;
import net.minecraft.stats.StatBase;
import net.minecraft.stats.StatBasic;
@@ -6,11 +6,13 @@ import net.minecraftforge.common.util.ForgeDirection;
public interface IChiselMode {
/**
* NOTE: This method is responsible for increasing the "Blocks Chiseled" statistic found in the Statistics class.
*/
void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation);
/**
* Implemented implicitly by enums. If your IChiselMode is not an enum
* constant, this needs to be implemented explicitly.
* Implemented implicitly by enums. If your IChiselMode is not an enum constant, this needs to be implemented explicitly.
*
* @return The name of the mode.
*/
@@ -1,9 +1,7 @@
package com.cricketcraft.chisel.inventory;
import com.cricketcraft.chisel.Statistics;
import com.cricketcraft.chisel.api.IChiselItem;
import com.cricketcraft.chisel.item.chisel.ItemChisel;
import com.cricketcraft.chisel.utils.General;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@@ -11,7 +9,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import java.util.List;
import com.cricketcraft.chisel.api.IChiselItem;
import com.cricketcraft.chisel.item.chisel.ItemChisel;
import com.cricketcraft.chisel.utils.General;
public class InventoryChiselSelection implements IInventory {
@@ -107,8 +107,6 @@ public class InventoryChiselSelection implements IInventory {
public void updateItems() {
ItemStack chiseledItem = inventory[normalSlots];
if(inventory[normalSlots] != null)
container.playerInventory.player.addStat(Statistics.blocksChiseled, inventory[normalSlots].stackSize);
clearItems();
if (chiseledItem == null) {
@@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import com.cricketcraft.chisel.api.IChiselItem;
import com.cricketcraft.chisel.api.Statistics;
import com.cricketcraft.chisel.carving.Carving;
import com.cricketcraft.chisel.utils.General;
import com.cricketcraft.chisel.utils.GeneralClient;
@@ -67,6 +68,8 @@ public class SlotChiselSelection extends Slot {
if (player.worldObj.isRemote) {
String sound = Carving.chisel.getVariationSound(crafted.getItem(), crafted.getItemDamage());
GeneralClient.playChiselSound(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ), sound);
} else {
container.playerInventory.player.addStat(Statistics.blocksChiseled, crafted.stackSize);
}
}
}
@@ -2,7 +2,6 @@ package com.cricketcraft.chisel.item.chisel;
import java.util.List;
import com.cricketcraft.chisel.Statistics;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
@@ -57,8 +56,6 @@ public final class ChiselController {
return;
}
event.entityPlayer.addStat(Statistics.blocksChiseled, 1);
List<ICarvingVariation> list = group.getVariations();
main: for (ItemStack stack : OreDictionary.getOres(group.getOreName())) {
@@ -9,6 +9,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.cricketcraft.chisel.api.IChiselItem;
import com.cricketcraft.chisel.api.Statistics;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
import com.cricketcraft.chisel.api.carving.IChiselMode;
import com.cricketcraft.chisel.network.PacketHandler;
@@ -107,6 +108,7 @@ public enum ChiselMode implements IChiselMode {
} else {
world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3);
}
player.addStat(Statistics.blocksChiseled, 1);
boolean breakChisel = false;
if (((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.getCurrentEquippedItem(), v)) {
player.getCurrentEquippedItem().damageItem(1, player);