@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/monster/Bogged.java
|
||||
+++ b/net/minecraft/world/entity/monster/Bogged.java
|
||||
@@ -79,6 +79,12 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
+ this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
if (!this.level().isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
+ this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.shear(worldserver, SoundCategory.PLAYERS, itemstack);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityCaveSpider.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityCaveSpider.java
|
||||
@@ -39,7 +39,7 @@
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityCreeper.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityCreeper.java
|
||||
@@ -43,6 +43,13 @@
|
||||
@@ -42,6 +42,13 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityCreeper extends EntityMonster implements PowerableMob {
|
||||
public class EntityCreeper extends EntityMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_SWELL_DIR = DataWatcher.defineId(EntityCreeper.class, DataWatcherRegistry.INT);
|
||||
@@ -53,6 +60,7 @@
|
||||
@@ -52,6 +59,7 @@
|
||||
public int maxSwell = 30;
|
||||
public int explosionRadius = 3;
|
||||
private int droppedSkulls;
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
public EntityCreeper(EntityTypes<? extends EntityCreeper> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -216,9 +224,20 @@
|
||||
@@ -214,9 +222,20 @@
|
||||
@Override
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
@@ -43,7 +43,7 @@
|
||||
@Override
|
||||
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -228,8 +247,9 @@
|
||||
@@ -226,8 +245,9 @@
|
||||
|
||||
this.level().playSound(entityhuman, this.getX(), this.getY(), this.getZ(), soundeffect, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -55,7 +55,7 @@
|
||||
} else {
|
||||
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
||||
@@ -246,11 +266,20 @@
|
||||
if (!this.level().isClientSide) {
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -63,10 +63,10 @@
|
||||
+ if (!event.isCancelled()) {
|
||||
+ // CraftBukkit end
|
||||
this.dead = true;
|
||||
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, World.a.MOB);
|
||||
+ this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customCausingEntityDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB); // CraftBukkit
|
||||
- worldserver.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, World.a.MOB);
|
||||
+ worldserver.explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customCausingEntityDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB); // CraftBukkit
|
||||
this.spawnLingeringCloud();
|
||||
this.triggerOnDeathMobEffects(Entity.RemovalReason.KILLED);
|
||||
this.triggerOnDeathMobEffects(worldserver, Entity.RemovalReason.KILLED);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityDrowned.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityDrowned.java
|
||||
@@ -247,7 +247,7 @@
|
||||
|
||||
@Override
|
||||
public void performRangedAttack(EntityLiving entityliving, float f) {
|
||||
- EntityThrownTrident entitythrowntrident = new EntityThrownTrident(this.level(), this, new ItemStack(Items.TRIDENT));
|
||||
+ EntityThrownTrident entitythrowntrident = new EntityThrownTrident(this.level(), this, this.getItemInHand(net.minecraft.world.entity.projectile.ProjectileHelper.getWeaponHoldingHand(this, Items.TRIDENT))); // CraftBukkit - Use Trident in hand like skeletons (SPIGOT-7025)
|
||||
double d0 = entityliving.getX() - this.getX();
|
||||
double d1 = entityliving.getY(0.3333333333333333D) - entitythrowntrident.getY();
|
||||
double d2 = entityliving.getZ() - this.getZ();
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -479,9 +495,11 @@
|
||||
@@ -466,9 +482,11 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -520,9 +538,11 @@
|
||||
@@ -507,9 +525,11 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityEvoker.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEvoker.java
|
||||
@@ -213,7 +213,7 @@
|
||||
@@ -212,7 +212,7 @@
|
||||
worldserver.getScoreboard().addPlayerToTeam(entityvex.getScoreboardName(), scoreboardteam);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
@@ -332,6 +332,8 @@
|
||||
@@ -333,6 +333,8 @@
|
||||
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, vec3d1.normalize(), this.ghast.getExplosionPower());
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityGuardian.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGuardian.java
|
||||
@@ -59,6 +59,7 @@
|
||||
@@ -60,6 +60,7 @@
|
||||
private boolean clientSideTouchedGround;
|
||||
@Nullable
|
||||
public PathfinderGoalRandomStroll randomStrollGoal;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public EntityGuardian(EntityTypes<? extends EntityGuardian> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -74,7 +75,7 @@
|
||||
@@ -75,7 +76,7 @@
|
||||
PathfinderGoalMoveTowardsRestriction pathfindergoalmovetowardsrestriction = new PathfinderGoalMoveTowardsRestriction(this, 1.0D);
|
||||
|
||||
this.randomStrollGoal = new PathfinderGoalRandomStroll(this, 1.0D, 80);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityGuardianElder.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGuardianElder.java
|
||||
@@ -67,7 +67,7 @@
|
||||
super.customServerAiStep();
|
||||
super.customServerAiStep(worldserver);
|
||||
if ((this.tickCount + this.getId()) % 1200 == 0) {
|
||||
MobEffect mobeffect = new MobEffect(MobEffects.DIG_SLOWDOWN, 6000, 2);
|
||||
- List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level(), this, this.position(), 50.0D, mobeffect, 1200);
|
||||
+ List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
- List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround(worldserver, this, this.position(), 50.0D, mobeffect, 1200);
|
||||
+ List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround(worldserver, this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
|
||||
list.forEach((entityplayer) -> {
|
||||
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
@@ -217,7 +217,7 @@
|
||||
@@ -218,7 +218,7 @@
|
||||
|
||||
@Override
|
||||
protected void performSpellCasting() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -268,7 +268,7 @@
|
||||
@@ -269,7 +269,7 @@
|
||||
|
||||
@Override
|
||||
protected void performSpellCasting() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
@@ -17,6 +17,10 @@
|
||||
@@ -18,6 +18,10 @@
|
||||
import net.minecraft.world.entity.ai.goal.PathfinderGoal;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public abstract class EntityIllagerWizard extends EntityIllagerAbstract {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_SPELL_CASTING_ID = DataWatcher.defineId(EntityIllagerWizard.class, DataWatcherRegistry.BYTE);
|
||||
@@ -158,6 +162,11 @@
|
||||
@@ -159,6 +163,11 @@
|
||||
public void tick() {
|
||||
--this.attackWarmupDelay;
|
||||
if (this.attackWarmupDelay == 0) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
|
||||
@@ -521,14 +521,14 @@
|
||||
List<EntityHuman> list = EntityPhantom.this.level().getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
|
||||
@@ -522,14 +522,14 @@
|
||||
List<EntityHuman> list = worldserver.getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
- list.sort(Comparator.comparing(Entity::getY).reversed());
|
||||
@@ -11,7 +11,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
if (EntityPhantom.this.canAttack(entityhuman, PathfinderTargetCondition.DEFAULT)) {
|
||||
if (EntityPhantom.this.canAttack(worldserver, entityhuman, PathfinderTargetCondition.DEFAULT)) {
|
||||
- EntityPhantom.this.setTarget(entityhuman);
|
||||
+ EntityPhantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
|
||||
return true;
|
||||
|
||||
@@ -41,4 +41,4 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static boolean checkZombifiedPiglinSpawnRules(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, RandomSource randomsource) {
|
||||
public static boolean checkZombifiedPiglinSpawnRules(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EntitySpawnReason entityspawnreason, BlockPosition blockposition, RandomSource randomsource) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
@@ -48,6 +48,10 @@
|
||||
@@ -50,6 +50,10 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.WorldAccess;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class EntityPillager extends EntityIllagerAbstract implements ICrossbow, InventoryCarrier {
|
||||
|
||||
private static final DataWatcherObject<Boolean> IS_CHARGING_CROSSBOW = DataWatcher.defineId(EntityPillager.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -195,7 +199,7 @@
|
||||
@@ -198,7 +202,7 @@
|
||||
ItemStack itemstack1 = this.inventory.addItem(itemstack);
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
@@ -43,6 +43,10 @@
|
||||
@@ -45,6 +45,10 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
+
|
||||
public class EntityRavager extends EntityRaider {
|
||||
|
||||
private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (entity) -> {
|
||||
@@ -147,6 +151,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
private static final Predicate<Entity> ROAR_TARGET_WITH_GRIEFING = (entity) -> {
|
||||
@@ -161,6 +165,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockLeaves) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
flag = this.level().destroyBlock(blockposition, true, this) || flag;
|
||||
if (block instanceof BlockLeaves) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
flag = worldserver.destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityShulker.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
|
||||
@@ -58,6 +58,12 @@
|
||||
@@ -59,6 +59,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, IMonster {
|
||||
|
||||
private static final MinecraftKey COVERED_ARMOR_MODIFIER_ID = MinecraftKey.withDefaultNamespace("covered");
|
||||
@@ -401,6 +407,14 @@
|
||||
@@ -402,6 +408,14 @@
|
||||
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
|
||||
|
||||
if (enumdirection != null) {
|
||||
@@ -28,7 +28,7 @@
|
||||
this.unRide();
|
||||
this.setAttachFace(enumdirection);
|
||||
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
|
||||
@@ -471,7 +485,7 @@
|
||||
@@ -472,7 +486,7 @@
|
||||
if (entityshulker != null) {
|
||||
entityshulker.setVariant(this.getVariant());
|
||||
entityshulker.moveTo(vec3d);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
@@ -30,6 +30,11 @@
|
||||
@@ -31,6 +31,11 @@
|
||||
import net.minecraft.world.level.block.BlockMonsterEggs;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class EntitySilverfish extends EntityMonster {
|
||||
|
||||
@Nullable
|
||||
@@ -157,6 +162,11 @@
|
||||
@@ -160,6 +165,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockMonsterEggs) {
|
||||
@@ -21,10 +21,10 @@
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
if (getServerLevel(world).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
world.destroyBlock(blockposition1, true, this.silverfish);
|
||||
} else {
|
||||
@@ -226,9 +236,14 @@
|
||||
@@ -229,9 +239,14 @@
|
||||
IBlockData iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
@@ -91,7 +91,7 @@
|
||||
@@ -99,7 +99,7 @@
|
||||
this.level().levelEvent((EntityHuman) null, 1048, this.blockPosition(), 0);
|
||||
}
|
||||
|
||||
- });
|
||||
+ }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons
|
||||
}
|
||||
|
||||
protected void doFreezeConversion() {
|
||||
- this.convertTo(EntityTypes.STRAY, true);
|
||||
+ this.convertTo(EntityTypes.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons
|
||||
if (!this.isSilent()) {
|
||||
this.level().levelEvent((EntityHuman) null, 1048, this.blockPosition(), 0);
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
@@ -204,8 +204,19 @@
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
@@ -207,7 +207,17 @@
|
||||
World world = this.level();
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
- IProjectile.spawnProjectileUsingShoot(entityarrow, worldserver, itemstack1, d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - worldserver.getDifficulty().getId() * 4));
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
+ this.level().addFreshEntity(entityarrow);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- this.level().addFreshEntity(entityarrow);
|
||||
+ // this.level().addFreshEntity(entityarrow); // CraftBukkit - moved up
|
||||
}
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
+ IProjectile.spawnProjectileUsingShoot(entityarrow, worldserver, itemstack1, d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - worldserver.getDifficulty().getId() * 4));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected EntityArrow getArrow(ItemStack itemstack, float f, @Nullable ItemStack itemstack1) {
|
||||
this.playSound(SoundEffects.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
@@ -45,6 +45,15 @@
|
||||
import net.minecraft.world.level.levelgen.SeededRandom;
|
||||
@@ -47,6 +47,15 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.ArrayList;
|
||||
@@ -16,7 +16,7 @@
|
||||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
|
||||
@@ -195,11 +204,18 @@
|
||||
@@ -197,11 +206,18 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getType() {
|
||||
@@ -36,9 +36,9 @@
|
||||
int i = this.getSize();
|
||||
|
||||
if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) {
|
||||
@@ -210,6 +226,19 @@
|
||||
int j = i / 2;
|
||||
@@ -211,18 +227,45 @@
|
||||
int k = 2 + this.random.nextInt(3);
|
||||
ScoreboardTeam scoreboardteam = this.getTeam();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), k);
|
||||
@@ -56,19 +56,24 @@
|
||||
for (int l = 0; l < k; ++l) {
|
||||
float f2 = ((float) (l % 2) - 0.5F) * f1;
|
||||
float f3 = ((float) (l / 2) - 0.5F) * f1;
|
||||
@@ -225,12 +254,21 @@
|
||||
entityslime.setInvulnerable(this.isInvulnerable());
|
||||
|
||||
- this.convertTo(this.getType(), new ConversionParams(ConversionType.SPLIT_ON_DEATH, false, false, scoreboardteam), EntitySpawnReason.TRIGGERED, (entityslime) -> {
|
||||
+ EntitySlime converted = this.convertTo(this.getType(), new ConversionParams(ConversionType.SPLIT_ON_DEATH, false, false, scoreboardteam), EntitySpawnReason.TRIGGERED, (entityslime) -> { // CraftBukkit
|
||||
entityslime.setSize(j, true);
|
||||
entityslime.moveTo(this.getX() + (double) f2, this.getY() + 0.5D, this.getZ() + (double) f3, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
- this.level().addFreshEntity(entityslime);
|
||||
+ slimes.add(entityslime); // CraftBukkit
|
||||
}
|
||||
}
|
||||
- });
|
||||
+ // CraftBukkit start
|
||||
+ }, null, null);
|
||||
+ if (converted != null) {
|
||||
+ slimes.add(converted);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
|
||||
+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
+ for (EntityLiving living : slimes) {
|
||||
+ this.level().addFreshEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityStrider.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityStrider.java
|
||||
@@ -351,7 +351,14 @@
|
||||
@@ -350,7 +350,14 @@
|
||||
|
||||
boolean flag2 = flag1;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityVex.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityVex.java
|
||||
@@ -383,7 +383,7 @@
|
||||
@@ -381,7 +381,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityWitch.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityWitch.java
|
||||
@@ -125,7 +125,7 @@
|
||||
@@ -126,7 +126,7 @@
|
||||
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
|
||||
|
||||
if (itemstack.is(Items.POTION) && potioncontents != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
@@ -65,6 +65,15 @@
|
||||
@@ -67,6 +67,15 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
private static final MinecraftKey SPEED_MODIFIER_BABY_ID = MinecraftKey.withDefaultNamespace("baby");
|
||||
@@ -89,6 +98,7 @@
|
||||
@@ -91,6 +100,7 @@
|
||||
private boolean canBreakDoors;
|
||||
private int inWaterTime;
|
||||
public int conversionTime;
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -205,7 +215,10 @@
|
||||
@@ -203,7 +213,10 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.isAlive() && !this.isNoAi()) {
|
||||
if (this.isUnderWaterConverting()) {
|
||||
@@ -36,7 +36,7 @@
|
||||
if (this.conversionTime < 0) {
|
||||
this.doUnderWaterConversion();
|
||||
}
|
||||
@@ -222,6 +235,7 @@
|
||||
@@ -220,6 +233,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -256,6 +270,7 @@
|
||||
@@ -254,6 +268,7 @@
|
||||
}
|
||||
|
||||
public void startUnderWaterConversion(int i) {
|
||||
@@ -52,36 +52,65 @@
|
||||
this.conversionTime = i;
|
||||
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
|
||||
}
|
||||
@@ -269,11 +284,15 @@
|
||||
@@ -267,26 +282,39 @@
|
||||
}
|
||||
|
||||
protected void convertToZombieType(EntityTypes<? extends EntityZombie> entitytypes) {
|
||||
- EntityZombie entityzombie = (EntityZombie) this.convertTo(entitytypes, true);
|
||||
+ EntityZombie entityzombie = (EntityZombie) this.convertTo(entitytypes, true, EntityTransformEvent.TransformReason.DROWNED, CreatureSpawnEvent.SpawnReason.DROWNED);
|
||||
|
||||
if (entityzombie != null) {
|
||||
- this.convertTo(entitytypes, ConversionParams.single(this, true, true), (entityzombie) -> {
|
||||
+ EntityZombie converted = this.convertTo(entitytypes, ConversionParams.single(this, true, true), (entityzombie) -> { // CraftBukkit
|
||||
entityzombie.handleAttributes(entityzombie.level().getCurrentDifficultyAt(entityzombie.blockPosition()).getSpecialMultiplier());
|
||||
entityzombie.setCanBreakDoors(entityzombie.supportsBreakDoorGoal() && this.canBreakDoors());
|
||||
+ // CraftBukkit start - SPIGOT-5208: End conversion to stop event spam
|
||||
+ } else {
|
||||
+ ((Zombie) getBukkitEntity()).setConversionTime(-1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- });
|
||||
+ // CraftBukkit start
|
||||
+ }, EntityTransformEvent.TransformReason.DROWNED, CreatureSpawnEvent.SpawnReason.DROWNED);
|
||||
+ if (converted == null) {
|
||||
+ ((Zombie) getBukkitEntity()).setConversionTime(-1); // CraftBukkit - SPIGOT-5208: End conversion to stop event spam
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
@@ -312,9 +331,9 @@
|
||||
if (EntityPositionTypes.isSpawnPositionOk(entitytypes, this.level(), blockposition) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level().random)) {
|
||||
|
||||
@VisibleForTesting
|
||||
public boolean convertVillagerToZombieVillager(WorldServer worldserver, EntityVillager entityvillager) {
|
||||
+ // CraftBukkit start
|
||||
+ return convertVillagerToZombieVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), EntityTransformEvent.TransformReason.INFECTION, CreatureSpawnEvent.SpawnReason.INFECTION) != null;
|
||||
+ }
|
||||
+
|
||||
+ public static EntityZombieVillager convertVillagerToZombieVillager(WorldServer worldserver, EntityVillager entityvillager, net.minecraft.core.BlockPosition blockPosition, boolean silent, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, ConversionParams.single(entityvillager, true, true), (entityzombievillager1) -> {
|
||||
entityzombievillager1.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager1.blockPosition()), EntitySpawnReason.CONVERSION, new EntityZombie.GroupDataZombie(false, true));
|
||||
entityzombievillager1.setVillagerData(entityvillager.getVillagerData());
|
||||
entityzombievillager1.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
|
||||
entityzombievillager1.setTradeOffers(entityvillager.getOffers().copy());
|
||||
entityzombievillager1.setVillagerXp(entityvillager.getVillagerXp());
|
||||
- if (!this.isSilent()) {
|
||||
- worldserver.levelEvent((EntityHuman) null, 1026, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start
|
||||
+ if (!silent) {
|
||||
+ worldserver.levelEvent((EntityHuman) null, 1026, blockPosition, 0);
|
||||
}
|
||||
|
||||
- });
|
||||
+ }, transformReason, spawnReason);
|
||||
|
||||
- return entityzombievillager != null;
|
||||
+ return entityzombievillager;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected boolean isSunSensitive() {
|
||||
@@ -324,9 +352,9 @@
|
||||
if (EntityPositionTypes.isSpawnPositionOk(entitytypes, worldserver, blockposition) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EntitySpawnReason.REINFORCEMENT, blockposition, worldserver.random)) {
|
||||
entityzombie.setPos((double) i1, (double) j1, (double) k1);
|
||||
if (!this.level().hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) {
|
||||
if (!worldserver.hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && worldserver.isUnobstructed(entityzombie) && worldserver.noCollision((Entity) entityzombie) && (entityzombie.canSpawnInLiquids() || !worldserver.containsAnyLiquid(entityzombie.getBoundingBox()))) {
|
||||
- entityzombie.setTarget(entityliving);
|
||||
+ entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
|
||||
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null);
|
||||
entityzombie.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombie.blockPosition()), EntitySpawnReason.REINFORCEMENT, (GroupDataEntity) null);
|
||||
- worldserver.addFreshEntityWithPassengers(entityzombie);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE);
|
||||
AttributeModifier attributemodifier = attributemodifiable.getModifier(EntityZombie.REINFORCEMENT_CALLER_CHARGE_ID);
|
||||
double d0 = attributemodifier != null ? attributemodifier.amount() : 0.0D;
|
||||
@@ -340,7 +359,14 @@
|
||||
@@ -352,7 +380,14 @@
|
||||
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
|
||||
|
||||
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
|
||||
@@ -97,50 +126,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,8 +441,17 @@
|
||||
if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
||||
return flag;
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ flag = zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
|
||||
+ }
|
||||
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
+ return flag;
|
||||
+ }
|
||||
+
|
||||
+ 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);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entityzombievillager != null) {
|
||||
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true));
|
||||
@@ -424,15 +459,17 @@
|
||||
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
|
||||
entityzombievillager.setTradeOffers(entityvillager.getOffers().copy());
|
||||
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
|
||||
- if (!this.isSilent()) {
|
||||
- worldserver.levelEvent((EntityHuman) null, 1026, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start
|
||||
+ if (!silent) {
|
||||
+ worldserver.levelEvent((EntityHuman) null, 1026, blockPosition, 0);
|
||||
}
|
||||
|
||||
- flag = false;
|
||||
+ // flag = false;
|
||||
}
|
||||
- }
|
||||
|
||||
- return flag;
|
||||
+ return entityzombievillager;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
@@ -385,7 +420,7 @@
|
||||
|
||||
@Override
|
||||
@@ -483,7 +520,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null);
|
||||
public EntityTypes<? extends EntityZombie> getType() {
|
||||
- return super.getType();
|
||||
+ return (EntityTypes<? extends EntityZombie>) super.getType(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
protected boolean canSpawnInLiquids() {
|
||||
@@ -496,7 +531,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EntitySpawnReason.JOCKEY, (GroupDataEntity) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
- worldaccess.addFreshEntity(entitychicken1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityZombieHusk.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombieHusk.java
|
||||
@@ -58,7 +58,7 @@
|
||||
@@ -59,7 +59,7 @@
|
||||
if (flag && this.getMainHandItem().isEmpty() && entity instanceof EntityLiving) {
|
||||
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
||||
@@ -51,6 +51,13 @@
|
||||
@@ -52,6 +52,14 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.world.entity.npc.EntityVillager;
|
||||
+import org.bukkit.entity.ZombieVillager;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
@@ -14,7 +15,7 @@
|
||||
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -68,6 +75,7 @@
|
||||
@@ -69,6 +77,7 @@
|
||||
@Nullable
|
||||
private MerchantRecipeList tradeOffers;
|
||||
private int villagerXp;
|
||||
@@ -22,7 +23,7 @@
|
||||
|
||||
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -86,7 +94,7 @@
|
||||
@@ -87,7 +96,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -31,7 +32,7 @@
|
||||
Logger logger = EntityZombieVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -121,7 +129,7 @@
|
||||
@@ -122,7 +131,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("Offers")) {
|
||||
@@ -40,7 +41,7 @@
|
||||
Logger logger1 = EntityZombieVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -148,6 +156,10 @@
|
||||
@@ -149,6 +158,10 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.isAlive() && this.isConverting()) {
|
||||
int i = this.getConversionProgress();
|
||||
@@ -51,7 +52,7 @@
|
||||
|
||||
this.villagerConversionTime -= i;
|
||||
if (this.villagerConversionTime <= 0) {
|
||||
@@ -156,6 +168,7 @@
|
||||
@@ -157,6 +170,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
@@ -59,7 +60,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -196,8 +209,10 @@
|
||||
@@ -197,8 +211,10 @@
|
||||
this.conversionStarter = uuid;
|
||||
this.villagerConversionTime = i;
|
||||
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
|
||||
@@ -72,29 +73,20 @@
|
||||
this.level().broadcastEntityEvent(this, (byte) 16);
|
||||
}
|
||||
|
||||
@@ -214,12 +229,20 @@
|
||||
@@ -215,10 +231,11 @@
|
||||
}
|
||||
|
||||
private void finishConversion(WorldServer worldserver) {
|
||||
- EntityVillager entityvillager = (EntityVillager) this.convertTo(EntityTypes.VILLAGER, false);
|
||||
+ // CraftBukkit start
|
||||
+ EntityVillager entityvillager = (EntityVillager) this.convertTo(EntityTypes.VILLAGER, false, EntityTransformEvent.TransformReason.CURED, CreatureSpawnEvent.SpawnReason.CURED);
|
||||
+ if (entityvillager == null) {
|
||||
+ ((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entityvillager != null) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
Iterator iterator = this.dropPreservedEquipment((itemstack) -> {
|
||||
- this.convertTo(EntityTypes.VILLAGER, ConversionParams.single(this, false, false), (entityvillager) -> {
|
||||
+ EntityVillager converted = this.convertTo(EntityTypes.VILLAGER, ConversionParams.single(this, false, false), (entityvillager) -> { // CraftBukkit
|
||||
Iterator iterator = this.dropPreservedEquipment(worldserver, (itemstack) -> {
|
||||
return !EnchantmentManager.has(itemstack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE);
|
||||
}).iterator();
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EnumItemSlot enumitemslot = (EnumItemSlot) iterator.next();
|
||||
@@ -249,7 +272,7 @@
|
||||
@@ -248,12 +265,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,3 +95,14 @@
|
||||
if (!this.isSilent()) {
|
||||
worldserver.levelEvent((EntityHuman) null, 1027, this.blockPosition(), 0);
|
||||
}
|
||||
-
|
||||
- });
|
||||
+ // CraftBukkit start
|
||||
+ }, EntityTransformEvent.TransformReason.CURED, CreatureSpawnEvent.SpawnReason.CURED);
|
||||
+ if (converted == null) {
|
||||
+ ((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/world/entity/monster/creaking/CreakingTransient.java
|
||||
+++ b/net/minecraft/world/entity/monster/creaking/CreakingTransient.java
|
||||
@@ -97,7 +97,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.setRemoved(Entity.RemovalReason.DISCARDED);
|
||||
+ this.setRemoved(Entity.RemovalReason.DISCARDED, null); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ this.remove(Entity.RemovalReason.DISCARDED, null); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
@@ -54,6 +54,18 @@
|
||||
@@ -57,6 +57,18 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -73,6 +85,10 @@
|
||||
@@ -76,6 +88,10 @@
|
||||
public boolean cannotHunt;
|
||||
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_SPECIFIC_SENSOR);
|
||||
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, new MemoryModuleType[]{MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -91,6 +107,14 @@
|
||||
@@ -94,6 +110,14 @@
|
||||
}
|
||||
|
||||
this.writeInventoryToTag(nbttagcompound, this.registryAccess());
|
||||
@@ -45,18 +45,18 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,6 +123,10 @@
|
||||
@@ -102,6 +126,10 @@
|
||||
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
|
||||
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
|
||||
this.readInventoryFromTag(nbttagcompound, this.registryAccess());
|
||||
+ // CraftBukkit start
|
||||
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::getValue).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::getValue).collect(Collectors.toCollection(HashSet::new));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@VisibleForDebug
|
||||
@@ -216,7 +244,7 @@
|
||||
@@ -221,7 +249,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<EntityPiglin> getBrain() {
|
||||
@@ -65,7 +65,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -349,7 +377,7 @@
|
||||
@@ -366,7 +394,7 @@
|
||||
}
|
||||
|
||||
protected void holdInOffHand(ItemStack itemstack) {
|
||||
@@ -74,7 +74,7 @@
|
||||
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
|
||||
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
|
||||
} else {
|
||||
@@ -375,8 +403,8 @@
|
||||
@@ -392,8 +420,8 @@
|
||||
if (EnchantmentManager.has(itemstack1, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -83,9 +83,9 @@
|
||||
+ boolean flag = PiglinAI.isLovedItem(itemstack, this) || itemstack.is(Items.CROSSBOW); // CraftBukkit
|
||||
+ boolean flag1 = PiglinAI.isLovedItem(itemstack1, this) || itemstack1.is(Items.CROSSBOW); // CraftBukkit
|
||||
|
||||
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1)));
|
||||
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1, enumitemslot)));
|
||||
}
|
||||
@@ -405,7 +433,7 @@
|
||||
@@ -422,7 +450,7 @@
|
||||
|
||||
@Override
|
||||
protected SoundEffect getAmbientSound() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
|
||||
@@ -94,7 +94,7 @@
|
||||
@@ -102,7 +102,7 @@
|
||||
protected void finishConversion(WorldServer worldserver) {
|
||||
this.convertTo(EntityTypes.ZOMBIFIED_PIGLIN, ConversionParams.single(this, true, true), (entitypigzombie) -> {
|
||||
entitypigzombie.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
- });
|
||||
+ }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED); // CraftBukkit - add spawn and transform reasons
|
||||
}
|
||||
|
||||
protected void finishConversion(WorldServer worldserver) {
|
||||
- EntityPigZombie entitypigzombie = (EntityPigZombie) this.convertTo(EntityTypes.ZOMBIFIED_PIGLIN, true);
|
||||
+ EntityPigZombie entitypigzombie = (EntityPigZombie) this.convertTo(EntityTypes.ZOMBIFIED_PIGLIN, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED); // CraftBukkit - add spawn and transform reasons
|
||||
|
||||
if (entitypigzombie != null) {
|
||||
entitypigzombie.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
public boolean isAdult() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/PiglinAI.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAI.java
|
||||
@@ -74,6 +74,14 @@
|
||||
@@ -72,6 +72,14 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class PiglinAI {
|
||||
|
||||
public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL = 8;
|
||||
@@ -164,7 +172,8 @@
|
||||
@@ -166,7 +174,8 @@
|
||||
}
|
||||
|
||||
private static void initRideHoglinActivity(BehaviorController<EntityPiglin> behaviorcontroller) {
|
||||
@@ -25,7 +25,7 @@
|
||||
return true;
|
||||
}), 1)).build())), BehaviorStopRiding.create(8, PiglinAI::wantsToStopRiding)), MemoryModuleType.RIDE_TARGET);
|
||||
}
|
||||
@@ -174,7 +183,7 @@
|
||||
@@ -176,7 +185,7 @@
|
||||
}
|
||||
|
||||
private static BehaviorGateSingle<EntityLiving> createIdleLookBehaviors() {
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
|
||||
private static BehaviorGateSingle<EntityPiglin> createIdleMovementBehaviors() {
|
||||
@@ -195,13 +204,13 @@
|
||||
@@ -197,13 +206,13 @@
|
||||
|
||||
protected static void updateActivity(EntityPiglin entitypiglin) {
|
||||
BehaviorController<EntityPiglin> behaviorcontroller = entitypiglin.getBrain();
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
Objects.requireNonNull(entitypiglin);
|
||||
optional.ifPresent(entitypiglin::makeSound);
|
||||
@@ -233,23 +242,27 @@
|
||||
@@ -235,23 +244,27 @@
|
||||
stopWalking(entitypiglin);
|
||||
ItemStack itemstack;
|
||||
|
||||
@@ -74,17 +74,17 @@
|
||||
- if (isLovedItem(itemstack)) {
|
||||
+ if (isLovedItem(itemstack, entitypiglin)) { // CraftBukkit - Changes to allow for custom payment in bartering
|
||||
entitypiglin.getBrain().eraseMemory(MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM);
|
||||
holdInOffhand(entitypiglin, itemstack);
|
||||
holdInOffhand(worldserver, entitypiglin, itemstack);
|
||||
admireGoldItem(entitypiglin);
|
||||
} else if (isFood(itemstack) && !hasEatenRecently(entitypiglin)) {
|
||||
eat(entitypiglin);
|
||||
} else {
|
||||
- boolean flag = !entitypiglin.equipItemIfPossible(itemstack).equals(ItemStack.EMPTY);
|
||||
+ boolean flag = !entitypiglin.equipItemIfPossible(itemstack, entityitem).equals(ItemStack.EMPTY); // CraftBukkit
|
||||
- boolean flag = !entitypiglin.equipItemIfPossible(worldserver, itemstack).equals(ItemStack.EMPTY);
|
||||
+ boolean flag = !entitypiglin.equipItemIfPossible(worldserver, itemstack, entityitem).equals(ItemStack.EMPTY); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
putInInventory(entitypiglin, itemstack);
|
||||
@@ -270,7 +283,7 @@
|
||||
@@ -272,7 +285,7 @@
|
||||
ItemStack itemstack1 = itemstack.split(1);
|
||||
|
||||
if (itemstack.isEmpty()) {
|
||||
@@ -93,7 +93,7 @@
|
||||
} else {
|
||||
entityitem.setItem(itemstack);
|
||||
}
|
||||
@@ -285,9 +298,14 @@
|
||||
@@ -287,9 +300,14 @@
|
||||
boolean flag1;
|
||||
|
||||
if (entitypiglin.isAdult()) {
|
||||
@@ -108,9 +108,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (!flag1) {
|
||||
boolean flag2 = !entitypiglin.equipItemIfPossible(itemstack).isEmpty();
|
||||
boolean flag2 = !entitypiglin.equipItemIfPossible(worldserver, itemstack).isEmpty();
|
||||
|
||||
@@ -300,7 +318,7 @@
|
||||
@@ -302,7 +320,7 @@
|
||||
if (!flag1) {
|
||||
ItemStack itemstack1 = entitypiglin.getMainHandItem();
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
putInInventory(entitypiglin, itemstack1);
|
||||
} else {
|
||||
throwItems(entitypiglin, Collections.singletonList(itemstack1));
|
||||
@@ -377,7 +395,7 @@
|
||||
@@ -379,7 +397,7 @@
|
||||
return false;
|
||||
} else if (isAdmiringDisabled(entitypiglin) && entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) {
|
||||
return false;
|
||||
@@ -128,7 +128,7 @@
|
||||
return isNotHoldingLovedItemInOffHand(entitypiglin);
|
||||
} else {
|
||||
boolean flag = entitypiglin.canAddToInventory(itemstack);
|
||||
@@ -386,6 +404,12 @@
|
||||
@@ -388,6 +406,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
protected static boolean isLovedItem(ItemStack itemstack) {
|
||||
return itemstack.is(TagsItem.PIGLIN_LOVED);
|
||||
}
|
||||
@@ -479,7 +503,7 @@
|
||||
@@ -481,7 +505,7 @@
|
||||
}
|
||||
|
||||
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
|
||||
@@ -149,8 +149,8 @@
|
||||
+ return !isAdmiringDisabled(entitypiglin) && !isAdmiringItem(entitypiglin) && entitypiglin.isAdult() && isBarterCurrency(itemstack, entitypiglin); // CraftBukkit
|
||||
}
|
||||
|
||||
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
|
||||
@@ -736,6 +760,12 @@
|
||||
protected static void wasHurtBy(WorldServer worldserver, EntityPiglin entitypiglin, EntityLiving entityliving) {
|
||||
@@ -735,6 +759,12 @@
|
||||
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
private static boolean isBarterCurrency(ItemStack itemstack) {
|
||||
return itemstack.is(PiglinAI.BARTERING_ITEM);
|
||||
}
|
||||
@@ -773,7 +803,7 @@
|
||||
@@ -772,7 +802,7 @@
|
||||
}
|
||||
|
||||
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -372,7 +372,7 @@
|
||||
@@ -375,7 +375,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Warden> getBrain() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -409,7 +409,7 @@
|
||||
@@ -412,7 +412,7 @@
|
||||
public static void applyDarknessAround(WorldServer worldserver, Vec3D vec3d, @Nullable Entity entity, int i) {
|
||||
MobEffect mobeffect = new MobEffect(MobEffects.DARKNESS, 260, 0, false, false);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -544,7 +544,7 @@
|
||||
@@ -547,7 +547,7 @@
|
||||
|
||||
public void setAttackTarget(EntityLiving entityliving) {
|
||||
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);
|
||||
@@ -27,7 +27,7 @@
|
||||
this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
SonicBoom.setCooldown(this, 200);
|
||||
}
|
||||
@@ -579,12 +579,12 @@
|
||||
@@ -582,12 +582,12 @@
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract createNavigation(World world) {
|
||||
|
||||
Reference in New Issue
Block a user