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
This commit is contained in:
LemADEC 2014-09-02 00:28:53 +02:00
parent 5c595e39b1
commit 53082abc1e
4 changed files with 43 additions and 25 deletions

View file

@ -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) {

View file

@ -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;
}
}

View file

@ -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 };
}

View file

@ -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;
}