From 7401f87b8b80302e71ea73898493a5bf5d63f8f1 Mon Sep 17 00:00:00 2001 From: drpepper240 Date: Fri, 25 Jul 2014 21:34:29 +0400 Subject: [PATCH 1/3] scanning laser fix --- src/cr0s/WarpDrive/TileEntityLaser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cr0s/WarpDrive/TileEntityLaser.java b/src/cr0s/WarpDrive/TileEntityLaser.java index a8fb2d68..a94496d7 100644 --- a/src/cr0s/WarpDrive/TileEntityLaser.java +++ b/src/cr0s/WarpDrive/TileEntityLaser.java @@ -85,7 +85,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral } } - if (isEmitting && (frequency != 1420 && ++delayTicks > WarpDriveConfig.i.LE_EMIT_DELAY_TICKS) || ((frequency == 1420) && ++delayTicks > WarpDriveConfig.i.LE_EMIT_SCAN_DELAY_TICKS)) + if (isEmitting && ((frequency != 1420 && ++delayTicks > WarpDriveConfig.i.LE_EMIT_DELAY_TICKS) || ((frequency == 1420) && ++delayTicks > WarpDriveConfig.i.LE_EMIT_SCAN_DELAY_TICKS))) { delayTicks = 0; isEmitting = false; From e22dd05dacd7e6a4e751ad54e4ac3ca75436403b Mon Sep 17 00:00:00 2001 From: drPepper Date: Sat, 26 Jul 2014 16:25:29 +0400 Subject: [PATCH 2/3] scanning laser minor fix --- src/cr0s/WarpDrive/TileEntityLaser.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cr0s/WarpDrive/TileEntityLaser.java b/src/cr0s/WarpDrive/TileEntityLaser.java index a94496d7..e3fed5b1 100644 --- a/src/cr0s/WarpDrive/TileEntityLaser.java +++ b/src/cr0s/WarpDrive/TileEntityLaser.java @@ -160,7 +160,9 @@ public class TileEntityLaser extends TileEntity implements IPeripheral if (firstHit != null) { - sendLaserPacket(beamVector, new Vector3(firstHit), r, g, b, 50, energy, 200); + sendLaserPacket(beamVector, new Vector3(firstHit.hitVec), r, g, b, 50, energy, 200); + } else { + sendLaserPacket(beamVector, reachPoint, r, g, b, 50, energy, 200); } return; From 3c63085eefb6bc5405f3c412255c3131d83d38a8 Mon Sep 17 00:00:00 2001 From: drPepper Date: Sat, 26 Jul 2014 17:10:42 +0400 Subject: [PATCH 3/3] kostylee --- src/cr0s/WarpDrive/TileEntityLaser.java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/cr0s/WarpDrive/TileEntityLaser.java b/src/cr0s/WarpDrive/TileEntityLaser.java index e3fed5b1..f0973455 100644 --- a/src/cr0s/WarpDrive/TileEntityLaser.java +++ b/src/cr0s/WarpDrive/TileEntityLaser.java @@ -56,7 +56,13 @@ public class TileEntityLaser extends TileEntity implements IPeripheral public int delayTicks = 0; private int energyFromOtherBeams = 0; - private MovingObjectPosition firstHit; + private MovingObjectPosition firstHit = null; + private int hitX = 0; + private int hitY = 0; + private int hitZ = 0; + private int hitBlockId = 0; + private int hitBlockMeta = 0; + private float hitBlockResistance = 0; private int camUpdateTicks = 20; private int registryUpdateTicks = 20 * 10; @@ -65,7 +71,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral public void updateEntity() { // Frequency is not set - if (frequency <= 0) + if (frequency <= 0 || frequency > 65000) { return; } @@ -160,6 +166,12 @@ public class TileEntityLaser extends TileEntity implements IPeripheral if (firstHit != null) { + hitBlockId = worldObj.getBlockId(firstHit.blockX, firstHit.blockY, firstHit.blockZ); + hitBlockMeta = worldObj.getBlockMetadata(firstHit.blockX, firstHit.blockY, firstHit.blockZ); + hitBlockResistance = Block.blocksList[hitBlockId].blockResistance; + hitX = firstHit.blockX; + hitY = firstHit.blockY; + hitZ = firstHit.blockZ; sendLaserPacket(beamVector, new Vector3(firstHit.hitVec), r, g, b, 50, energy, 200); } else { sendLaserPacket(beamVector, reachPoint, r, g, b, 50, energy, 200); @@ -598,7 +610,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral { double dx = (Double)arguments[0]; double dy = (Double)arguments[1]; - double dz = (Double)arguments[2]; + double dz = -(Double)arguments[2]; //FIXME kostyl double targetX = xCoord + dx; double targetY = yCoord + dy; double targetZ = zCoord + dz; @@ -629,8 +641,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral int blockID = worldObj.getBlockId(firstHit.blockX, firstHit.blockY, firstHit.blockZ); int blockMeta = worldObj.getBlockMetadata(firstHit.blockX, firstHit.blockY, firstHit.blockZ); float blockResistance = Block.blocksList[blockID].blockResistance; - Object[] info = { firstHit.blockX, firstHit.blockY, firstHit.blockZ, blockID, blockMeta, (Float)blockResistance }; - firstHit = null; + Object[] info = { hitX, hitY, hitZ, hitBlockId, hitBlockMeta, (Float)hitBlockResistance }; return info; } else