Properly sync thrower field for all throwable projectiles, fixes #42 (does not fix vanilla throwables though)

This commit is contained in:
Electroblob
2018-06-04 23:42:12 +01:00
parent 2cd8b46c1f
commit 54bb327fdf
3 changed files with 31 additions and 33 deletions
@@ -9,7 +9,6 @@ import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryParticleType;
import electroblob.wizardry.util.WizardryUtilities;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -20,9 +19,6 @@ import net.minecraft.world.World;
public class EntitySparkBomb extends EntityBomb {
/** For client use, because thrower field is not visible. */
private int casterID;
public EntitySparkBomb(World par1World){
super(par1World);
}
@@ -84,7 +80,7 @@ public class EntitySparkBomb extends EntityBomb {
&& ((EntityPlayer)targets.get(i)).capabilities.isCreativeMode);
// Detects (client side) if target is the thrower, to stop particles being spawned around them.
if(flag && world.isRemote && targets.get(i).getEntityId() == this.casterID) flag = false;
//if(flag && world.isRemote && targets.get(i).getEntityId() == this.casterID) flag = false;
if(flag){
@@ -120,16 +116,4 @@ public class EntitySparkBomb extends EntityBomb {
this.setDead();
}
@Override
public void writeSpawnData(ByteBuf data){
super.writeSpawnData(data);
data.writeInt(this.getThrower().getEntityId());
}
@Override
public void readSpawnData(ByteBuf data){
super.readSpawnData(data);
this.casterID = data.readInt();
}
}