Pickaxe now consumes energy even without diamond drill

This commit is contained in:
MachineMuse 2013-01-28 02:05:29 -07:00
parent ee62edb643
commit ee78a97e4e
2 changed files with 10 additions and 3 deletions

View file

@ -15,6 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class EntityPlasmaBolt extends EntityThrowable {
public int lifespan;
public double size;
public static final int SIZE = 24;
public double damagingness;
public double explosiveness;
public Entity shootingEntity;
@ -22,6 +23,7 @@ public class EntityPlasmaBolt extends EntityThrowable {
public EntityPlasmaBolt(World world)
{
super(world);
dataWatcher.addObject(SIZE, Byte.valueOf((byte) this.size));
}
public EntityPlasmaBolt(World world, EntityLiving shootingEntity, double explosiveness, double damagingness, int chargeTicks) {
@ -46,11 +48,13 @@ public class EntityPlasmaBolt extends EntityThrowable {
this.posY = shootingEntity.posY + shootingEntity.getEyeHeight() + direction.yCoord * xoffset + (1 - Math.abs(direction.yCoord)) * yoffset;
this.posZ = shootingEntity.posZ + direction.zCoord * xoffset - direction.yCoord * horzdir.zCoord * yoffset + horzdir.xCoord * zoffset;
this.boundingBox.setBounds(posX - r, posY - r, posZ - r, posX + r, posY + r, posZ + r);
dataWatcher.addObject(SIZE, Byte.valueOf((byte) this.size));
}
@Override
public void onEntityUpdate() {
super.onEntityUpdate();
this.size = dataWatcher.getWatchableObjectByte(SIZE);
if (this.isInWater()) {
this.setDead();
for (int var3 = 0; var3 < this.size; ++var3)

View file

@ -141,12 +141,14 @@ public class ItemPowerTool extends ItemTool
double drain = 1;
Block block = Block.blocksList[blockID];
int meta = 0;
if (useDiamondPickaxe(stack, block, meta)) {
if (useIronPickaxe(stack, block, meta)) {
drain = ModuleManager.computeModularProperty(stack, ModularCommon.PICKAXE_ENERGY_CONSUMPTION);
} else if (useIronShovel(stack, block, meta)) {
drain = ModuleManager.computeModularProperty(stack, ModularCommon.SHOVEL_ENERGY_CONSUMPTION);
} else if (useIronAxe(stack, block, meta)) {
drain = ModuleManager.computeModularProperty(stack, ModularCommon.AXE_ENERGY_CONSUMPTION);
} else if (useDiamondPickaxe(stack, block, meta)) {
drain = ModuleManager.computeModularProperty(stack, ModularCommon.PICKAXE_ENERGY_CONSUMPTION);
} else {
drain = 0;
}
@ -168,7 +170,7 @@ public class ItemPowerTool extends ItemTool
if (ItemUtils.itemHasModule(stack, ModularCommon.MODULE_PICKAXE)) {
if (ForgeHooks.isToolEffective(ironPickaxe, block, meta)) {
return true;
} else if (!ForgeHooks.isToolEffective(diamondPick, block, meta) && (block.blockMaterial == Material.iron
} else if ((!ForgeHooks.isToolEffective(diamondPick, block, meta)) && (block.blockMaterial == Material.iron
|| block.blockMaterial == Material.anvil
|| block.blockMaterial == Material.rock)) {
return true;
@ -353,7 +355,8 @@ public class ItemPowerTool extends ItemTool
EntityPlasmaBolt plasmaBolt = new EntityPlasmaBolt(world, player, explosiveness, damagingness, chargeTicks);
world.spawnEntityInWorld(plasmaBolt);
MusePacketPlasmaBolt packet = new MusePacketPlasmaBolt((Player) player, plasmaBolt.entityId, plasmaBolt.size);
MusePacketPlasmaBolt packet = new MusePacketPlasmaBolt((Player) player, plasmaBolt.entityId,
plasmaBolt.size);
PacketDispatcher.sendPacketToAllPlayers(packet.getPacket250());
}
}