Laser gun now consumes energy per tick, also increase cost from 1j to 100j

This commit is contained in:
Robert S 2014-05-05 17:37:35 -04:00
parent 8b2c78ea3e
commit bace43ead9
2 changed files with 8 additions and 4 deletions

View file

@ -43,11 +43,10 @@ import cpw.mods.fml.relauncher.SideOnly;
* mining gear and the player will be simi-stationary when using it * mining gear and the player will be simi-stationary when using it
* *
* @author DarkGuardsman */ * @author DarkGuardsman */
@UniversalClass
public class ItemMiningLaser extends ItemEnergyTool public class ItemMiningLaser extends ItemEnergyTool
{ {
/** Cost per tick of using the item */ /** Cost per tick of using the item */
float wattPerShot = 1; long joulesPerTick = 100;
/** Damage to entities hit by the laser */ /** Damage to entities hit by the laser */
float damageToEntities = 3.3f; float damageToEntities = 3.3f;
/** Range of the laser ray trace */ /** Range of the laser ray trace */
@ -94,8 +93,11 @@ public class ItemMiningLaser extends ItemEnergyTool
//TODO increase break time longer the laser has been running //TODO increase break time longer the laser has been running
//TODO match hardness of block for break time //TODO match hardness of block for break time
//TODO add audio //TODO add audio
if (count > 5) if ((player.capabilities.isCreativeMode || discharge(stack, joulesPerTick, false) > joulesPerTick) && count > 5)
{ {
if(!player.capabilities.isCreativeMode)
discharge(stack, joulesPerTick, true);
Vec3 playerPosition = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ); Vec3 playerPosition = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ);
Vec3 playerLook = RayTraceHelper.getLook(player, 1.0f); Vec3 playerLook = RayTraceHelper.getLook(player, 1.0f);
Vec3 p = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord, playerPosition.yCoord + playerLook.yCoord, playerPosition.zCoord + playerLook.zCoord); Vec3 p = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord, playerPosition.yCoord + playerLook.yCoord, playerPosition.zCoord + playerLook.zCoord);
@ -168,7 +170,7 @@ public class ItemMiningLaser extends ItemEnergyTool
{ {
if (!player.isSneaking()) if (!player.isSneaking())
{ {
if (player.capabilities.isCreativeMode || this.getEnergy(itemStack) > this.wattPerShot) if (player.capabilities.isCreativeMode || this.getEnergy(itemStack) > this.joulesPerTick)
{ {
player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack)); player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
} }

View file

@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import universalelectricity.api.CompatibilityModule; import universalelectricity.api.CompatibilityModule;
import universalelectricity.api.UniversalClass;
import universalelectricity.api.UniversalElectricity; import universalelectricity.api.UniversalElectricity;
import universalelectricity.api.energy.UnitDisplay; import universalelectricity.api.energy.UnitDisplay;
import universalelectricity.api.energy.UnitDisplay.Unit; import universalelectricity.api.energy.UnitDisplay.Unit;
@ -19,6 +20,7 @@ import calclavia.lib.utility.LanguageUtility;
/** Prefab for all eletric based tools /** Prefab for all eletric based tools
* *
* @author DarkGurdsman */ * @author DarkGurdsman */
@UniversalClass
public class ItemEnergyTool extends ItemTool implements IEnergyItem, IVoltageItem public class ItemEnergyTool extends ItemTool implements IEnergyItem, IVoltageItem
{ {
/** Default battery size */ /** Default battery size */