Laser gun consumes less energy per mode its in
This commit is contained in:
parent
4de939dcff
commit
434ee0cbc3
1 changed files with 12 additions and 3 deletions
|
@ -54,7 +54,7 @@ public class ItemMiningLaser extends ItemEnergyTool
|
||||||
HashMap<EntityPlayer, Long> energyUsedMap = new HashMap<EntityPlayer, Long>();
|
HashMap<EntityPlayer, Long> energyUsedMap = new HashMap<EntityPlayer, Long>();
|
||||||
|
|
||||||
public static final int MODE_REMOVE = 0, MODE_SMELT = 1, MODE_DAMAGE = 2;
|
public static final int MODE_REMOVE = 0, MODE_SMELT = 1, MODE_DAMAGE = 2;
|
||||||
|
|
||||||
public ItemMiningLaser(int id)
|
public ItemMiningLaser(int id)
|
||||||
{
|
{
|
||||||
super(id);
|
super(id);
|
||||||
|
@ -99,7 +99,16 @@ public class ItemMiningLaser extends ItemEnergyTool
|
||||||
if (!player.capabilities.isCreativeMode)
|
if (!player.capabilities.isCreativeMode)
|
||||||
{
|
{
|
||||||
long energyUsed = this.energyUsedMap.containsKey(player) ? this.energyUsedMap.get(player) : 0;
|
long energyUsed = this.energyUsedMap.containsKey(player) ? this.energyUsedMap.get(player) : 0;
|
||||||
energyUsed += joulesPerTick;
|
|
||||||
|
switch (getMode(stack))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
energyUsed += joulesPerTick;
|
||||||
|
case 1:
|
||||||
|
energyUsed += joulesPerTick / 2;
|
||||||
|
case 2:
|
||||||
|
energyUsed += joulesPerTick / 3;
|
||||||
|
}
|
||||||
this.energyUsedMap.put(player, energyUsed);
|
this.energyUsedMap.put(player, energyUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +144,7 @@ public class ItemMiningLaser extends ItemEnergyTool
|
||||||
mined = true;
|
mined = true;
|
||||||
miningMap.remove(player);
|
miningMap.remove(player);
|
||||||
}
|
}
|
||||||
else if(this.getMode(stack) == MODE_REMOVE || this.getMode(stack) == MODE_SMELT)
|
else if (this.getMode(stack) == MODE_REMOVE || this.getMode(stack) == MODE_SMELT)
|
||||||
{
|
{
|
||||||
//TODO get the actual hit side from the angle of the ray trace
|
//TODO get the actual hit side from the angle of the ray trace
|
||||||
LaserEvent.onLaserHitBlock(player.worldObj, player, new Vector3(hit), ForgeDirection.UP);
|
LaserEvent.onLaserHitBlock(player.worldObj, player, new Vector3(hit), ForgeDirection.UP);
|
||||||
|
|
Loading…
Reference in a new issue