Fixed Quantum Gates unregistering and spam-teleporting player

This commit is contained in:
Calclavia 2014-03-10 07:58:55 +08:00
parent 94eccc606a
commit 27a32e97eb
2 changed files with 11 additions and 6 deletions

View file

@ -76,7 +76,7 @@ public class PartQuantumGlyph extends JCuboidPart implements TSlottedPart, JNorm
}
@Override
public void onWorldSeparate()
public void preRemove()
{
FrequencyGrid.instance().unregister((IQuantumGate) tile());
}
@ -272,13 +272,17 @@ public class PartQuantumGlyph extends JCuboidPart implements TSlottedPart, JNorm
{
nbt.setByte("side", slot);
nbt.setByte("number", number);
int frequency = ((IQuantumGate) tile()).getFrequency();
nbt.setInteger("frequency", frequency);
if (frequency != -1)
if (tile() != null)
{
getInventory().save(nbt);
getQuantumTank().writeToNBT(nbt);
int frequency = ((IQuantumGate) tile()).getFrequency();
nbt.setInteger("frequency", frequency);
if (frequency != -1)
{
getInventory().save(nbt);
getQuantumTank().writeToNBT(nbt);
}
}
}

View file

@ -45,6 +45,7 @@ public class QuantumGateManager
{
teleportEntity.setLocationAndAngles(location.x, location.y, location.z, teleportEntity.rotationYaw, 0.0F);
teleportEntity.motionX = teleportEntity.motionY = teleportEntity.motionZ = 0.0D;
teleportEntity.setSneaking(false);
}
};