From bace43ead9fc9fbf7112fe5fbedc3ee07e64deaf Mon Sep 17 00:00:00 2001 From: Robert S Date: Mon, 5 May 2014 17:37:35 -0400 Subject: [PATCH] Laser gun now consumes energy per tick, also increase cost from 1j to 100j --- .../electrical/laser/gun/ItemMiningLaser.java | 10 ++++++---- .../core/prefab/items/ItemEnergyTool.java | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/electrical/src/main/scala/resonantinduction/electrical/laser/gun/ItemMiningLaser.java b/electrical/src/main/scala/resonantinduction/electrical/laser/gun/ItemMiningLaser.java index 4e2edfec..48e69c9a 100644 --- a/electrical/src/main/scala/resonantinduction/electrical/laser/gun/ItemMiningLaser.java +++ b/electrical/src/main/scala/resonantinduction/electrical/laser/gun/ItemMiningLaser.java @@ -43,11 +43,10 @@ import cpw.mods.fml.relauncher.SideOnly; * mining gear and the player will be simi-stationary when using it * * @author DarkGuardsman */ -@UniversalClass public class ItemMiningLaser extends ItemEnergyTool { /** Cost per tick of using the item */ - float wattPerShot = 1; + long joulesPerTick = 100; /** Damage to entities hit by the laser */ float damageToEntities = 3.3f; /** 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 match hardness of block for break time //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 playerLook = RayTraceHelper.getLook(player, 1.0f); 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.capabilities.isCreativeMode || this.getEnergy(itemStack) > this.wattPerShot) + if (player.capabilities.isCreativeMode || this.getEnergy(itemStack) > this.joulesPerTick) { player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack)); } diff --git a/src/main/scala/resonantinduction/core/prefab/items/ItemEnergyTool.java b/src/main/scala/resonantinduction/core/prefab/items/ItemEnergyTool.java index de4e9061..f19c342f 100644 --- a/src/main/scala/resonantinduction/core/prefab/items/ItemEnergyTool.java +++ b/src/main/scala/resonantinduction/core/prefab/items/ItemEnergyTool.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import universalelectricity.api.CompatibilityModule; +import universalelectricity.api.UniversalClass; import universalelectricity.api.UniversalElectricity; import universalelectricity.api.energy.UnitDisplay; import universalelectricity.api.energy.UnitDisplay.Unit; @@ -19,6 +20,7 @@ import calclavia.lib.utility.LanguageUtility; /** Prefab for all eletric based tools * * @author DarkGurdsman */ +@UniversalClass public class ItemEnergyTool extends ItemTool implements IEnergyItem, IVoltageItem { /** Default battery size */