fix: EMP tower properly deletes missiles

This commit is contained in:
LordMZTE 2022-11-12 10:16:34 +01:00
parent dece854363
commit 9a42fed16c
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
3 changed files with 5 additions and 4 deletions

View File

@ -7,6 +7,5 @@
- flying blocks dont properly render
- black hole doesn't suck in blocks
- remote detonator doesnt work
- emp tower only deletes missiles on client
- see `// TODO: WTF`

View File

@ -576,7 +576,7 @@ public class EMissile extends Entity
public void explode() {
try {
if (!this.exploded) {
if (!this.exploded && !this.isDead) {
if (this.missileId == 0) {
if (!super.worldObj.isRemote) {
super.worldObj.createExplosion(

View File

@ -82,7 +82,8 @@ public class TLauncherControlPanel
nbt.setInteger("frequency", this.getFrequency());
nbt.setShort("height", this.height);
nbt.setInteger("disabledTicks", this.disabledTicks);
nbt.setTag("target", super.target.writeToNBT(new NBTTagCompound()));
if (super.target != null)
nbt.setTag("target", super.target.writeToNBT(new NBTTagCompound()));
return new S35PacketUpdateTileEntity(
this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt
@ -106,7 +107,8 @@ public class TLauncherControlPanel
this.setFrequency(nbt.getInteger("frequency"));
this.height = nbt.getShort("height");
this.disabledTicks = nbt.getInteger("disabledTicks");
super.target = Vector3.readFromNBT(nbt.getCompoundTag("target"));
if (nbt.hasKey("target"))
super.target = Vector3.readFromNBT(nbt.getCompoundTag("target"));
}
// TODO: WTF