@@ -14,17 +14,17 @@
|
||||
|
||||
public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
+ // CraftBukkit start
|
||||
+ return fall(world, blockposition, iblockdata, false);
|
||||
+ return fall(world, blockposition, iblockdata, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata, boolean isCustom) {
|
||||
+ public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, iblockdata.hasProperty(BlockProperties.WATERLOGGED) ? (IBlockData) iblockdata.setValue(BlockProperties.WATERLOGGED, false) : iblockdata);
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entityfallingblock, blockposition, iblockdata.getFluidState().createLegacyBlock()).isCancelled()) return entityfallingblock; // CraftBukkit
|
||||
|
||||
world.setBlock(blockposition, iblockdata.getFluidState().createLegacyBlock(), 3);
|
||||
- world.addFreshEntity(entityfallingblock);
|
||||
+ world.addFreshEntity(entityfallingblock, (isCustom) ? org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CUSTOM : org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT); // CraftBukkit - keep logic in SpawnReason if the method is use by API
|
||||
+ world.addFreshEntity(entityfallingblock, spawnReason); // CraftBukkit
|
||||
return entityfallingblock;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,12 +103,12 @@
|
||||
EntityVillager entityvillager = (EntityVillager) entityliving;
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
+ // CraftBukkit start
|
||||
+ zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), false);
|
||||
+ zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
+ public static EntityZombieVillager zombifyVillager(WorldServer worldserver, EntityVillager entityvillager, net.minecraft.core.BlockPosition blockPosition, boolean silent, boolean custom) {
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, (custom) ? CreatureSpawnEvent.SpawnReason.CUSTOM : CreatureSpawnEvent.SpawnReason.INFECTION);
|
||||
+ public static EntityZombieVillager zombifyVillager(WorldServer worldserver, EntityVillager entityvillager, net.minecraft.core.BlockPosition blockPosition, boolean silent, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, spawnReason);
|
||||
+ if (entityzombievillager != null) {
|
||||
+ // CraftBukkit end
|
||||
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
|
||||
|
||||
Reference in New Issue
Block a user