Fix oninitialspawn not being called in some places e.g. guardian fight, so local difficulty wouldn't be considered.

This commit is contained in:
Vincent Lee committed 2017-01-23 15:23:53 -06:00
1 parent 1671435c0c
commit 8dc94ba27c
7 files changed
+17 -4

No files matched your search

@@ -82,6 +82,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
EntityBlaze blaze = new EntityBlaze(world);
blaze.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() - 1.95D, pos.getZ() + 0.5D, 0.0F, 0.0F);
blaze.getEntityData().setBoolean(TAG_FEL_SPAWNED, true);
blaze.onInitialSpawn(world.getDifficultyForLocation(pos), null);
world.spawnEntity(blaze);
world.notifyNeighborsOfStateChange(pos, Blocks.AIR, false);
world.notifyNeighborsOfStateChange(pos.down(), Blocks.AIR, false);
@@ -135,9 +135,9 @@ public class SubTileLoonuim extends SubTileFunctional {
NBTTagCompound cmp = stack.writeToNBT(new NBTTagCompound());
entity.getEntityData().setTag(TAG_ITEMSTACK_TO_DROP, cmp);
world.spawnEntity(entity);
entity.onInitialSpawn(world.getDifficultyForLocation(pos), null);
world.spawnEntity(entity);
SubTileSpectranthemum.spawnExplosionParticles(entity, 5);
mana -= COST;
@@ -109,6 +109,7 @@ public class TileCocoon extends TileMod {
entity.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
if(entity instanceof EntityAgeable)
((EntityAgeable) entity).setGrowingAge(-24000);
entity.onInitialSpawn(world.getDifficultyForLocation(getPos()), null);
world.spawnEntity(entity);
entity.spawnExplosionParticle();
}
@@ -7,6 +7,7 @@ import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.items.IItemHandler;
@@ -54,6 +55,7 @@ public final class PixieHandler {
dmg += 2;
pixie.setProps((EntityLivingBase) event.getSource().getEntity(), player, 0, dmg);
pixie.onInitialSpawn(player.world.getDifficultyForLocation(new BlockPos(pixie)), null);
player.world.spawnEntity(pixie);
}
}
@@ -226,6 +226,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
e.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ARMOR).setBaseValue(15);
e.playSound(SoundEvents.ENTITY_ENDERDRAGON_GROWL, 10F, 0.1F);
e.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(e)), null);
world.spawnEntity(e);
return true;
}
@@ -681,10 +682,8 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
}
case 1 : {
entity = new EntitySkeleton(world);
entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.BOW));
if(world.rand.nextInt(8) == 0) {
entity = new EntityWitherSkeleton(world);
entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(hard ? ModItems.elementiumSword : Items.STONE_SWORD));
}
break;
}
@@ -694,6 +693,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
EntityPixie pixie = new EntityPixie(world);
pixie.setProps(players.get(rand.nextInt(players.size())), this, 1, 8);
pixie.setPosition(posX + width / 2, posY + 2, posZ + width / 2);
pixie.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(pixie)), null);
world.spawnEntity(pixie);
}
}
@@ -704,6 +704,10 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
entity.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 600, 0));
range = 6F;
entity.setPosition(posX + 0.5 + Math.random() * range - range / 2, posY - 1, posZ + 0.5 + Math.random() * range - range / 2);
entity.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity)), null);
if (entity instanceof EntityWitherSkeleton && hard) {
entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ModItems.elementiumSword));
}
world.spawnEntity(entity);
}
}
@@ -750,6 +754,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss {
EntityPixie pixie = new EntityPixie(world);
pixie.setProps(players.get(rand.nextInt(players.size())), this, 1, 8);
pixie.setPosition(posX + width / 2, posY + 2, posZ + width / 2);
pixie.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(pixie)), null);
world.spawnEntity(pixie);
}
@@ -24,6 +24,7 @@ import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -51,6 +52,7 @@ public class ItemPinkinator extends ItemMod {
wither.setDead();
EntityPinkWither pink = new EntityPinkWither(world);
pink.setLocationAndAngles(wither.posX, wither.posY, wither.posZ, wither.rotationYaw, wither.rotationPitch);
pink.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(pink)), null);
world.spawnEntity(pink);
pink.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 4F, (1F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
}
@@ -33,6 +33,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -100,6 +101,7 @@ public class ItemVirus extends ItemMod {
jumpHeight.applyModifier(new AttributeModifier("Ermergerd Virus D:", jumpHeight.getBaseValue() * 0.5, 0));
newHorse.playSound(SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0F + living.world.rand.nextFloat(), living.world.rand.nextFloat() * 0.7F + 1.3F);
newHorse.onInitialSpawn(player.world.getDifficultyForLocation(new BlockPos(newHorse)), null);
player.world.spawnEntity(newHorse);
newHorse.spawnExplosionParticle();