[Bleeding] Add many missing SpawnReasons.

Adds BUKKIT-5370, BUKKIT-5377, BUKKIT-5378, BUKKIT-5379, BUKKIT-5380,
BUKKIT-5381, BUKKIT-5382. Adds reasons for zombies infecting villagers and
zombie villagers being cured. Readds reason for a skeleton being spawned as
a spider jockey. Adds reason to distinguish ocelot babies from the parent
they spawned with. Adds reasons for chunk generation causing the ender
dragon, villagers, and witches to spawn. And finally, adds a reason for
spawning a chicken mount for a baby zombie.
This commit is contained in:
GJ 2014-02-05 11:42:44 -05:00 committed by Travis Watkins
parent b6831792ec
commit 729df1a734
7 changed files with 14 additions and 11 deletions

View file

@ -22,7 +22,7 @@ public class BiomeTheEndDecorator extends BiomeDecorator {
EntityEnderDragon entityenderdragon = new EntityEnderDragon(this.a);
entityenderdragon.setPositionRotation(0.0D, 128.0D, 0.0D, this.b.nextFloat() * 360.0F, 0.0F);
this.a.addEntity(entityenderdragon);
this.a.addEntity(entityenderdragon, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}
}
}

View file

@ -4,6 +4,8 @@ import java.util.Random;
import net.minecraft.util.org.apache.commons.lang3.tuple.ImmutablePair;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit
public class BlockMonsterEggs extends Block {
public static final String[] a = new String[] { "stone", "cobble", "brick", "mossybrick", "crackedbrick", "chiseledbrick"};
@ -19,7 +21,7 @@ public class BlockMonsterEggs extends Block {
EntitySilverfish entitysilverfish = new EntitySilverfish(world);
entitysilverfish.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F);
world.addEntity(entitysilverfish);
world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
entitysilverfish.s();
}
@ -108,7 +110,7 @@ public class BlockMonsterEggs extends Block {
EntitySilverfish entitysilverfish = new EntitySilverfish(world);
entitysilverfish.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F);
world.addEntity(entitysilverfish);
world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
entitysilverfish.s();
}
}

View file

@ -221,7 +221,7 @@ public class EntityOcelot extends EntityTameableAnimal {
entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityocelot.setAge(-24000);
this.world.addEntity(entityocelot);
this.world.addEntity(entityocelot, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OCELOT_BABY); // CraftBukkit - add SpawnReason
}
}

View file

@ -156,7 +156,7 @@ public class EntitySpider extends EntityMonster {
entityskeleton.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityskeleton.a((GroupDataEntity) null);
this.world.addEntity(entityskeleton);
this.world.addEntity(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit - add SpawnReason
entityskeleton.mount(this);
}

View file

@ -7,6 +7,7 @@ import java.util.UUID;
//CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.entity.EntityCombustEvent;
//CraftBukkit end
@ -186,7 +187,7 @@ public class EntityZombie extends EntityMonster {
if (World.a((IBlockAccess) this.world, i1, j1 - 1, k1) && this.world.getLightLevel(i1, j1, k1) < 10) {
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
if (this.world.b(entityzombie.boundingBox) && this.world.getCubes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.world.containsLiquid(entityzombie.boundingBox)) {
this.world.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
entityzombie.setGoalTarget(entityliving);
entityzombie.a((GroupDataEntity) null);
this.getAttributeInstance(bp).a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
@ -341,7 +342,7 @@ public class EntityZombie extends EntityMonster {
entityzombie.setBaby(true);
}
this.world.addEntity(entityzombie);
this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
this.world.a((EntityHuman) null, 1016, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
}
@ -379,7 +380,7 @@ public class EntityZombie extends EntityMonster {
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.a((GroupDataEntity) null);
entitychicken1.i(true);
this.world.addEntity(entitychicken1);
this.world.addEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT);
this.mount(entitychicken1);
}
}
@ -462,7 +463,7 @@ public class EntityZombie extends EntityMonster {
}
this.world.kill(this);
this.world.addEntity(entityvillager);
this.world.addEntity(entityvillager, CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason
entityvillager.addEffect(new MobEffect(MobEffectList.CONFUSION.id, 200, 0));
this.world.a((EntityHuman) null, 1017, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}

View file

@ -107,7 +107,7 @@ abstract class WorldGenVillagePiece extends StructurePiece {
EntityVillager entityvillager = new EntityVillager(world, this.b(i1));
entityvillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F);
world.addEntity(entityvillager);
world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}
}
}

View file

@ -77,7 +77,7 @@ public class WorldGenWitchHut extends WorldGenScatteredPiece {
entitywitch.setPositionRotation((double) i1 + 0.5D, (double) j1, (double) k1 + 0.5D, 0.0F, 0.0F);
entitywitch.a((GroupDataEntity) null);
world.addEntity(entitywitch);
world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}
}