Possible fix for #343

This commit is contained in:
Vincent Lee committed 2016-07-13 21:44:10 -05:00
1 parent 611f33a133
commit 124fdeeee3
2 files changed
+18 -17

No files matched your search

@@ -89,7 +89,7 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
InvWithLocation inv = getSparkInventory();
if(inv == null) {
if(!worldObj.isRemote)
setDead();
dropAndKill();
return;
}
@@ -116,11 +116,14 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
setItemDisplayTicks(displayTicks + 1);
}
private void dropAndKill() {
entityDropItem(new ItemStack(ModItems.corporeaSpark, 1, isMaster() ? 1 : 0), 0F);
setDead();
}
@Override
public void setDead() {
super.setDead();
if(!worldObj.isRemote)
entityDropItem(new ItemStack(ModItems.corporeaSpark, 1, isMaster() ? 1 : 0), 0F);
connections.remove(this);
connectionsClient.remove(this);
restartNetwork();
@@ -272,7 +275,8 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
if(stack != null) {
if(stack.getItem() == ModItems.twigWand) {
if(player.isSneaking()) {
setDead();
if(!player.worldObj.isRemote)
dropAndKill();
if(isMaster())
restartNetwork();
if(player.worldObj.isRemote)
@@ -88,7 +88,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
ISparkAttachable tile = getAttachedTile();
if(tile == null) {
setDead();
dropAndKill();
return;
}
@@ -223,6 +223,14 @@ public class EntitySpark extends Entity implements ISparkEntity {
}
}
private void dropAndKill() {
SparkUpgradeType upgrade = getUpgrade();
entityDropItem(new ItemStack(ModItems.spark), 0F);
if(upgrade != SparkUpgradeType.NONE)
entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade.ordinal() - 1), 0F);
setDead();
}
@Override
public boolean canBeCollidedWith() {
return true;
@@ -244,7 +252,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
transfers.clear();
removeTransferants = 2;
} else setDead();
} else dropAndKill();
player.swingArm(hand);
return true;
} else {
@@ -281,17 +289,6 @@ public class EntitySpark extends Entity implements ISparkEntity {
cmp.setInteger(TAG_INVIS, dataManager.get(INVISIBILITY));
}
@Override
public void setDead() {
super.setDead();
if(!worldObj.isRemote) {
SparkUpgradeType upgrade = getUpgrade();
entityDropItem(new ItemStack(ModItems.spark), 0F);
if(upgrade != SparkUpgradeType.NONE)
entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade.ordinal() - 1), 0F);
}
}
@Override
public ISparkAttachable getAttachedTile() {
int x = MathHelper.floor_double(posX);