Merge remote-tracking branch 'origin/master' into TDK

This commit is contained in:
LemADEC 2014-09-02 00:43:03 +02:00
commit 3b218f6503
5 changed files with 47 additions and 29 deletions

View file

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

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