From 5c595e39b152348ab52b7b486a1303a4fcf5f3c0 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Fri, 29 Aug 2014 19:22:39 +0200 Subject: [PATCH 1/2] Integrated last changes --- src/assets/warpdrive/lua/warpcontroller/startup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/assets/warpdrive/lua/warpcontroller/startup b/src/assets/warpdrive/lua/warpcontroller/startup index 0ee1c41a..09c6b665 100644 --- a/src/assets/warpdrive/lua/warpcontroller/startup +++ b/src/assets/warpdrive/lua/warpcontroller/startup @@ -170,12 +170,12 @@ function ShowInfo() Show("Core:") Show(" x, y, z = "..X..", "..Y..", "..Z) local energy = warp.get_energy_level() - local energyMax = 1000000 - if warpcore.get_energy_max ~= nil then - energyMax = warpcore.get_energy_max() + local energyMax = 100000000 + if warp.get_energy_max ~= nil then + energyMax = warp.get_energy_max() if energyMax == nil then energyMax = 1 end end - Show(" Energy = "..math.floor(energy / 1000000).." % ("..energy.."EU)") + Show(" Energy = "..math.floor(energy / energyMax).." % ("..energy.."EU)") Show(" Attached players = "..warp.get_attached_players()) Show("Dimensions:") Show(" Front, Right, Up = "..GFront..", "..GRight..", "..GUp) From 53082abc1e96643c40d6d5c02b905b96e85eda0d Mon Sep 17 00:00:00 2001 From: LemADEC Date: Tue, 2 Sep 2014 00:28:53 +0200 Subject: [PATCH 2/2] Stabilisation fixes Fixed lasercam failing to return result to Computer Added particle booster fail safe mode on right click and jump when invalid tile entity found Added a few logs to investigate jump client/server desync --- src/cr0s/WarpDrive/EntityJump.java | 19 ++++++++----- .../machines/BlockParticleBooster.java | 28 ++++++++++--------- .../WarpDrive/machines/TileEntityLaser.java | 19 +++++++++---- .../WarpDrive/machines/TileEntityReactor.java | 2 ++ 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/src/cr0s/WarpDrive/EntityJump.java b/src/cr0s/WarpDrive/EntityJump.java index 0e795b91..e42ab7ec 100644 --- a/src/cr0s/WarpDrive/EntityJump.java +++ b/src/cr0s/WarpDrive/EntityJump.java @@ -1170,14 +1170,19 @@ public class EntityJump extends Entity newTileEntity = TileEntity.createAndLoadEntity(oldnbt); } - newTileEntity.worldObj = targetWorld; - newTileEntity.validate(); + if (newTileEntity != null) { + newTileEntity.worldObj = targetWorld; + newTileEntity.validate(); - worldObj.removeBlockTileEntity(oldX, oldY, oldZ); - targetWorld.setBlockTileEntity(newX, newY, newZ, newTileEntity); - if (isForgeMultipart) { - WarpDriveConfig.forgeMultipart_tileMultipart_onChunkLoad.invoke(newTileEntity); - WarpDriveConfig.forgeMultipart_helper_sendDescPacket.invoke(null, targetWorld, newTileEntity); + worldObj.removeBlockTileEntity(oldX, oldY, oldZ); + targetWorld.setBlockTileEntity(newX, newY, newZ, newTileEntity); + if (isForgeMultipart) { + WarpDriveConfig.forgeMultipart_tileMultipart_onChunkLoad.invoke(newTileEntity); + WarpDriveConfig.forgeMultipart_helper_sendDescPacket.invoke(null, targetWorld, newTileEntity); + } + } else { + WarpDrive.print(this + " moveBlockSimple failed to create new tile entity at " + shipBlock.x + ", " + shipBlock.y + ", " + shipBlock.z + " blockId " + shipBlock.blockID + ":" + shipBlock.blockMeta); + WarpDrive.print("NBT data was " + ((oldnbt == null) ? "null" : oldnbt.toString())); } } } catch (Exception exception) { diff --git a/src/cr0s/WarpDrive/machines/BlockParticleBooster.java b/src/cr0s/WarpDrive/machines/BlockParticleBooster.java index ce157acb..a10f8e5c 100644 --- a/src/cr0s/WarpDrive/machines/BlockParticleBooster.java +++ b/src/cr0s/WarpDrive/machines/BlockParticleBooster.java @@ -79,17 +79,19 @@ public class BlockParticleBooster extends BlockContainer { * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { - if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { - return false; - } - - WarpEnergyTE te = (WarpEnergyTE)par1World.getBlockTileEntity(par2, par3, par4); - if (te != null && (par5EntityPlayer.getHeldItem() == null)) { - par5EntityPlayer.addChatMessage(te.getStatus()); - return true; - } - - return false; - } + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { + if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { + return false; + } + + if (par5EntityPlayer.getHeldItem() == null) { + TileEntity te = par1World.getBlockTileEntity(par2, par3, par4); + if (te != null && te instanceof WarpEnergyTE) { + par5EntityPlayer.addChatMessage(((WarpEnergyTE) te).getStatus()); + return true; + } + } + + return false; + } } \ No newline at end of file diff --git a/src/cr0s/WarpDrive/machines/TileEntityLaser.java b/src/cr0s/WarpDrive/machines/TileEntityLaser.java index ab662971..ce5fb32e 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityLaser.java +++ b/src/cr0s/WarpDrive/machines/TileEntityLaser.java @@ -515,11 +515,20 @@ public class TileEntityLaser extends WarpTE implements IPeripheral { case 3: // getFirstHit() if (firstHit != null) { - 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, blockResistance }; - return info; + try { + int blockID = worldObj.getBlockId(firstHit.blockX, firstHit.blockY, firstHit.blockZ); + int blockMeta = worldObj.getBlockMetadata(firstHit.blockX, firstHit.blockY, firstHit.blockZ); + float blockResistance = -2; + if (Block.blocksList[blockID] != null) { + blockResistance = Block.blocksList[blockID].blockResistance; + } + Object[] info = { firstHit.blockX, firstHit.blockY, firstHit.blockZ, blockID, blockMeta, blockResistance }; + firstHit = null; + return info; + } catch (Exception e) { + e.printStackTrace(); + return new Integer[] { 0, 0, 0, 0, 0, -3 }; + } } else { return new Integer[] { 0, 0, 0, 0, 0, -1 }; } diff --git a/src/cr0s/WarpDrive/machines/TileEntityReactor.java b/src/cr0s/WarpDrive/machines/TileEntityReactor.java index 6a43c40b..5c3059a8 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityReactor.java +++ b/src/cr0s/WarpDrive/machines/TileEntityReactor.java @@ -234,10 +234,12 @@ public class TileEntityReactor extends WarpEnergyTE messageToAllPlayersOnShip(reason.toString()); return; } + WarpDrive.debugPrint("!!! makePlayersOnShipDrunk targetCooldown " + targetCooldown); makePlayersOnShipDrunk(targetCooldown + WarpDriveConfig.WC_WARMUP_RANDOM_TICKS); } if (!soundPlayed && (soundThreshold > warmupTime)) { + WarpDrive.debugPrint("!!! playSoundEffect soundThreshold " + soundThreshold + " warmupTime " + warmupTime); worldObj.playSoundEffect(xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, soundFile, 4F, 1F); soundPlayed = true; }