@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntityCaveSpider.java
|
||||
+++ b/net/minecraft/server/EntityCaveSpider.java
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0));
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
--- a/net/minecraft/server/EntityCreeper.java
|
||||
+++ b/net/minecraft/server/EntityCreeper.java
|
||||
@@ -3,6 +3,12 @@
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityCreeper extends EntityMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.b);
|
||||
@@ -165,9 +171,19 @@
|
||||
@Override
|
||||
public void onLightningStrike(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
super.onLightningStrike(worldserver, entitylightning);
|
||||
- this.datawatcher.set(EntityCreeper.POWERED, true);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ this.setPowered(true);
|
||||
}
|
||||
|
||||
+ public void setPowered(boolean powered) {
|
||||
+ this.datawatcher.set(EntityCreeper.POWERED, powered);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
protected EnumInteractionResult b(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
@@ -192,10 +208,18 @@
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
- this.killed = true;
|
||||
- this.world.explode(this, this.locX(), this.locY(), this.locZ(), (float) this.explosionRadius * f, explosion_effect);
|
||||
- this.die();
|
||||
- this.createEffectCloud();
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.killed = true;
|
||||
+ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.die();
|
||||
+ this.createEffectCloud();
|
||||
+ } else {
|
||||
+ fuseTicks = 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -206,6 +230,7 @@
|
||||
if (!collection.isEmpty()) {
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX(), this.locY(), this.locZ());
|
||||
|
||||
+ entityareaeffectcloud.setSource(this); // CraftBukkit
|
||||
entityareaeffectcloud.setRadius(2.5F);
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
@@ -219,7 +244,7 @@
|
||||
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
|
||||
}
|
||||
|
||||
- this.world.addEntity(entityareaeffectcloud);
|
||||
+ this.world.addEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
--- a/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/net/minecraft/server/EntityEnderman.java
|
||||
@@ -51,7 +51,17 @@
|
||||
|
||||
@Override
|
||||
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
||||
- super.setGoalTarget(entityliving);
|
||||
+ // CraftBukkit start - fire event
|
||||
+ setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ entityliving = getGoalTarget();
|
||||
+ // CraftBukkit end
|
||||
AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -66,6 +76,7 @@
|
||||
attributemodifiable.b(EntityEnderman.c);
|
||||
}
|
||||
}
|
||||
+ return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -359,8 +370,12 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition);
|
||||
|
||||
if (block.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
- world.a(blockposition, false);
|
||||
- this.enderman.setCarried(iblockdata.getBlock().getBlockData());
|
||||
+ // CraftBukkit start - Pickup event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ world.a(blockposition, false);
|
||||
+ this.enderman.setCarried(iblockdata.getBlock().getBlockData());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -395,8 +410,12 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.b(iblockdata2, (GeneratorAccess) this.a.world, blockposition);
|
||||
if (this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
+ // CraftBukkit start - Place event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, iblockdata2).isCancelled()) {
|
||||
world.setTypeAndData(blockposition, iblockdata2, 3);
|
||||
this.a.setCarried((IBlockData) null);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/net/minecraft/server/EntityGhast.java
|
||||
+++ b/net/minecraft/server/EntityGhast.java
|
||||
@@ -163,7 +163,8 @@
|
||||
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4);
|
||||
|
||||
- entitylargefireball.yield = this.ghast.getPower();
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.yield = this.ghast.getPower();
|
||||
entitylargefireball.setPosition(this.ghast.locX() + vec3d.x * 4.0D, this.ghast.e(0.5D) + 0.5D, entitylargefireball.locZ() + vec3d.z * 4.0D);
|
||||
world.addEntity(entitylargefireball);
|
||||
this.a = -40;
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntityGuardianElder.java
|
||||
+++ b/net/minecraft/server/EntityGuardianElder.java
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.k, this.isSilent() ? 0.0F : 1.0F));
|
||||
- entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2));
|
||||
+ entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
+++ b/net/minecraft/server/EntityIllagerIllusioner.java
|
||||
@@ -30,7 +30,7 @@
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D));
|
||||
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F));
|
||||
this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, (new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)).a(300));
|
||||
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300));
|
||||
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, false)).a(300));
|
||||
@@ -169,7 +169,7 @@
|
||||
|
||||
@Override
|
||||
protected void j() {
|
||||
- EntityIllagerIllusioner.this.getGoalTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400));
|
||||
+ EntityIllagerIllusioner.this.getGoalTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,7 +206,7 @@
|
||||
|
||||
@Override
|
||||
protected void j() {
|
||||
- EntityIllagerIllusioner.this.addEffect(new MobEffect(MobEffects.INVISIBILITY, 1200));
|
||||
+ EntityIllagerIllusioner.this.addEffect(new MobEffect(MobEffects.INVISIBILITY, 1200), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ILLUSION); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/server/EntityIllagerWizard.java
|
||||
+++ b/net/minecraft/server/EntityIllagerWizard.java
|
||||
@@ -145,6 +145,11 @@
|
||||
public void e() {
|
||||
--this.b;
|
||||
if (this.b == 0) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleEntitySpellCastEvent(EntityIllagerWizard.this, this.getCastSpell())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.j();
|
||||
EntityIllagerWizard.this.playSound(EntityIllagerWizard.this.getSoundCastSpell(), 1.0F, 1.0F);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntityPhantom.java
|
||||
+++ b/net/minecraft/server/EntityPhantom.java
|
||||
@@ -207,7 +207,7 @@
|
||||
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.a)) {
|
||||
- EntityPhantom.this.setGoalTarget(entityhuman);
|
||||
+ EntityPhantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
--- a/net/minecraft/server/EntityPigZombie.java
|
||||
+++ b/net/minecraft/server/EntityPigZombie.java
|
||||
@@ -35,7 +35,7 @@
|
||||
protected void m() {
|
||||
this.goalSelector.a(2, new PathfinderGoalZombieAttack(this, 1.0D, false));
|
||||
this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
||||
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::a_));
|
||||
this.targetSelector.a(3, new PathfinderGoalUniversalAngerReset<>(this, true));
|
||||
}
|
||||
@@ -108,7 +108,7 @@
|
||||
}).filter((entitypigzombie) -> {
|
||||
return !entitypigzombie.r(this.getGoalTarget());
|
||||
}).forEach((entitypigzombie) -> {
|
||||
- entitypigzombie.setGoalTarget(this.getGoalTarget());
|
||||
+ entitypigzombie.setGoalTarget(this.getGoalTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
|
||||
});
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
||||
+ public boolean setGoalTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature
|
||||
if (this.getGoalTarget() == null && entityliving != null) {
|
||||
this.bo = EntityPigZombie.d.a(this.random);
|
||||
this.bt = EntityPigZombie.bs.a(this.random);
|
||||
@@ -127,12 +127,21 @@
|
||||
this.e((EntityHuman) entityliving);
|
||||
}
|
||||
|
||||
- super.setGoalTarget(entityliving);
|
||||
+ return super.setGoalTarget(entityliving, reason, fireEvent); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void anger() {
|
||||
- this.setAnger(EntityPigZombie.bp.a(this.random));
|
||||
+ // CraftBukkit start
|
||||
+ Entity entity = ((WorldServer) this.world).getEntity(getAngerTarget());
|
||||
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.bp.a(this.random));
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.setAngerTarget(null);
|
||||
+ return;
|
||||
+ }
|
||||
+ this.setAnger(event.getNewAnger());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static boolean b(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntityPillager.java
|
||||
+++ b/net/minecraft/server/EntityPillager.java
|
||||
@@ -22,7 +22,7 @@
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D));
|
||||
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 15.0F, 1.0F));
|
||||
this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 15.0F));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/EntityRavager.java
|
||||
+++ b/net/minecraft/server/EntityRavager.java
|
||||
@@ -28,7 +28,7 @@
|
||||
this.goalSelector.a(5, new PathfinderGoalRandomStrollLand(this, 0.4D));
|
||||
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
||||
this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
|
||||
- this.targetSelector.a(2, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a());
|
||||
+ this.targetSelector.a(2, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true));
|
||||
this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
|
||||
@@ -119,7 +119,7 @@
|
||||
IBlockData iblockdata = this.world.getType(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
- if (block instanceof BlockLeaves) {
|
||||
+ if (block instanceof BlockLeaves && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit
|
||||
flag = this.world.a(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
--- a/net/minecraft/server/EntityShulker.java
|
||||
+++ b/net/minecraft/server/EntityShulker.java
|
||||
@@ -7,6 +7,11 @@
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityShulker extends EntityGolem implements IMonster {
|
||||
|
||||
private static final UUID bp = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
|
||||
@@ -31,7 +36,7 @@
|
||||
this.goalSelector.a(4, new EntityShulker.a());
|
||||
this.goalSelector.a(7, new EntityShulker.e());
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new EntityShulker.d(this));
|
||||
this.targetSelector.a(3, new EntityShulker.c(this));
|
||||
}
|
||||
@@ -279,6 +284,16 @@
|
||||
EnumDirection enumdirection = this.g(blockposition1);
|
||||
|
||||
if (enumdirection != null) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), new Location(this.world.getWorld(), blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()));
|
||||
+ this.world.getServer().getPluginManager().callEvent(teleport);
|
||||
+ if (!teleport.isCancelled()) {
|
||||
+ Location to = teleport.getTo();
|
||||
+ blockposition1 = new BlockPosition(to.getX(), to.getY(), to.getZ());
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.datawatcher.set(EntityShulker.b, enumdirection);
|
||||
this.playSound(SoundEffects.ENTITY_SHULKER_TELEPORT, 1.0F, 1.0F);
|
||||
this.datawatcher.set(EntityShulker.c, Optional.of(blockposition1));
|
||||
@@ -319,6 +334,7 @@
|
||||
}
|
||||
|
||||
this.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
|
||||
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
--- a/net/minecraft/server/EntitySilverfish.java
|
||||
+++ b/net/minecraft/server/EntitySilverfish.java
|
||||
@@ -18,7 +18,7 @@
|
||||
this.goalSelector.a(3, this.b);
|
||||
this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
||||
this.goalSelector.a(5, new EntitySilverfish.PathfinderGoalSilverfishHideInBlock(this));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
}
|
||||
|
||||
@@ -156,6 +156,11 @@
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
if (BlockMonsterEggs.h(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, BlockMonsterEggs.c(iblockdata.getBlock())).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, BlockMonsterEggs.c(iblockdata.getBlock()), 3);
|
||||
this.a.doSpawnEffect();
|
||||
this.a.die();
|
||||
@@ -202,6 +207,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockMonsterEggs) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
world.a(blockposition1, true, this.silverfish);
|
||||
} else {
|
||||
@@ -0,0 +1,23 @@
|
||||
--- a/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
+++ b/net/minecraft/server/EntitySkeletonAbstract.java
|
||||
@@ -154,8 +154,19 @@
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), null, entityarrow, EnumHand.MAIN_HAND, 0.8F, true);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
+ world.addEntity(entityarrow);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- this.world.addEntity(entityarrow);
|
||||
+ // this.world.addEntity(entityarrow); // CraftBukkit - moved up
|
||||
}
|
||||
|
||||
protected EntityArrow b(ItemStack itemstack, float f) {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntitySkeletonWither.java
|
||||
+++ b/net/minecraft/server/EntitySkeletonWither.java
|
||||
@@ -80,7 +80,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (entity instanceof EntityLiving) {
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 200));
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 200), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -0,0 +1,65 @@
|
||||
--- a/net/minecraft/server/EntitySlime.java
|
||||
+++ b/net/minecraft/server/EntitySlime.java
|
||||
@@ -6,6 +6,14 @@
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+import org.bukkit.event.entity.SlimeSplitEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> bo = DataWatcher.a(EntitySlime.class, DataWatcherRegistry.b);
|
||||
@@ -149,7 +157,7 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getEntityType() {
|
||||
- return super.getEntityType();
|
||||
+ return (EntityTypes<? extends EntitySlime>) super.getEntityType(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,6 +171,19 @@
|
||||
int j = i / 2;
|
||||
int k = 2 + this.random.nextInt(3);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), k);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled() && event.getCount() > 0) {
|
||||
+ k = event.getCount();
|
||||
+ } else {
|
||||
+ super.die();
|
||||
+ return;
|
||||
+ }
|
||||
+ List<EntityLiving> slimes = new ArrayList<>(j);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
for (int l = 0; l < k; ++l) {
|
||||
float f1 = ((float) (l % 2) - 0.5F) * f;
|
||||
float f2 = ((float) (l / 2) - 0.5F) * f;
|
||||
@@ -177,8 +198,17 @@
|
||||
entityslime.setInvulnerable(this.isInvulnerable());
|
||||
entityslime.setSize(j, true);
|
||||
entityslime.setPositionRotation(this.locX() + (double) f1, this.locY() + 0.5D, this.locZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
- this.world.addEntity(entityslime);
|
||||
+ slimes.add(entityslime); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ for (EntityLiving living : slimes) {
|
||||
+ this.world.addEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
super.die();
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntitySpider.java
|
||||
+++ b/net/minecraft/server/EntitySpider.java
|
||||
@@ -136,7 +136,7 @@
|
||||
MobEffectList mobeffectlist = ((EntitySpider.GroupDataSpider) object).a;
|
||||
|
||||
if (mobeffectlist != null) {
|
||||
- this.addEffect(new MobEffect(mobeffectlist, Integer.MAX_VALUE));
|
||||
+ this.addEffect(new MobEffect(mobeffectlist, Integer.MAX_VALUE), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/server/EntityStrider.java
|
||||
+++ b/net/minecraft/server/EntityStrider.java
|
||||
@@ -252,7 +252,12 @@
|
||||
IBlockData iblockdata1 = this.aN();
|
||||
boolean flag = iblockdata.a((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.a((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || this.b((Tag) TagsFluid.LAVA) > 0.0D;
|
||||
|
||||
- this.setShivering(!flag);
|
||||
+ // CraftBukkit start
|
||||
+ if (!flag ^ this.isShivering()) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag);
|
||||
+ this.setShivering(!flag);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.tick();
|
||||
this.eU();
|
||||
this.checkBlockCollisions();
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/EntityVex.java
|
||||
+++ b/net/minecraft/server/EntityVex.java
|
||||
@@ -45,7 +45,7 @@
|
||||
this.goalSelector.a(8, new EntityVex.d());
|
||||
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F));
|
||||
this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new EntityVex.b(this));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
}
|
||||
@@ -186,7 +186,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- EntityVex.this.setGoalTarget(EntityVex.this.c.getGoalTarget());
|
||||
+ EntityVex.this.setGoalTarget(EntityVex.this.c.getGoalTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit
|
||||
super.c();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntityWitch.java
|
||||
+++ b/net/minecraft/server/EntityWitch.java
|
||||
@@ -93,7 +93,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
MobEffect mobeffect = (MobEffect) iterator.next();
|
||||
|
||||
- this.addEffect(new MobEffect(mobeffect));
|
||||
+ this.addEffect(new MobEffect(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
--- a/net/minecraft/server/EntityZombie.java
|
||||
+++ b/net/minecraft/server/EntityZombie.java
|
||||
@@ -9,6 +9,14 @@
|
||||
import java.util.function.Predicate;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.entity.Zombie;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
|
||||
@@ -23,6 +31,7 @@
|
||||
private boolean bs;
|
||||
private int bt;
|
||||
public int drownedConversionTime;
|
||||
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
||||
|
||||
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -139,7 +148,10 @@
|
||||
public void tick() {
|
||||
if (!this.world.isClientSide && this.isAlive() && !this.isNoAI()) {
|
||||
if (this.isDrownConverting()) {
|
||||
- --this.drownedConversionTime;
|
||||
+ // CraftBukkit start - Use wall time instead of ticks for conversion
|
||||
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
|
||||
+ this.drownedConversionTime -= elapsedTicks;
|
||||
+ // CraftBukkit end
|
||||
if (this.drownedConversionTime < 0) {
|
||||
this.eP();
|
||||
}
|
||||
@@ -156,6 +168,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
+ this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,6 +201,7 @@
|
||||
}
|
||||
|
||||
public void startDrownedConversion(int i) {
|
||||
+ this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
||||
this.drownedConversionTime = i;
|
||||
this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true);
|
||||
}
|
||||
@@ -201,11 +215,15 @@
|
||||
}
|
||||
|
||||
protected void b(EntityTypes<? extends EntityZombie> entitytypes) {
|
||||
- EntityZombie entityzombie = (EntityZombie) this.a(entitytypes, true);
|
||||
+ EntityZombie entityzombie = (EntityZombie) this.a(entitytypes, true, EntityTransformEvent.TransformReason.DROWNED, CreatureSpawnEvent.SpawnReason.DROWNED);
|
||||
|
||||
if (entityzombie != null) {
|
||||
entityzombie.y(entityzombie.world.getDamageScaler(entityzombie.getChunkCoordinates()).d());
|
||||
entityzombie.u(entityzombie.eK() && this.eU());
|
||||
+ // CraftBukkit start - SPIGOT-5208: End conversion to stop event spam
|
||||
+ } else {
|
||||
+ ((Zombie) getBukkitEntity()).setConversionTime(-1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -245,9 +263,9 @@
|
||||
if (SpawnerCreature.a(entitypositiontypes_surface, (IWorldReader) this.world, blockposition, entitytypes) && EntityPositionTypes.a(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.world.random)) {
|
||||
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
|
||||
if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.j((Entity) entityzombie) && this.world.getCubes(entityzombie) && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
|
||||
- entityzombie.setGoalTarget(entityliving);
|
||||
+ entityzombie.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
|
||||
entityzombie.prepare(worldserver, this.world.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
- worldserver.addAllEntities(entityzombie);
|
||||
+ worldserver.addAllEntities(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
this.getAttributeInstance(GenericAttributes.SPAWN_REINFORCEMENTS).addModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
entityzombie.getAttributeInstance(GenericAttributes.SPAWN_REINFORCEMENTS).addModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
break;
|
||||
@@ -268,7 +286,14 @@
|
||||
float f = this.world.getDamageScaler(this.getChunkCoordinates()).b();
|
||||
|
||||
if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) {
|
||||
- entity.setOnFire(2 * (int) f);
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * (int) f); // PAIL: fixme
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.setOnFire(event.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +374,12 @@
|
||||
}
|
||||
|
||||
EntityVillager entityvillager = (EntityVillager) entityliving;
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.a(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
+ // CraftBukkit start
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.a(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, CreatureSpawnEvent.SpawnReason.INFECTION);
|
||||
+ if (entityzombievillager == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
entityzombievillager.prepare(worldserver, worldserver.getDamageScaler(entityzombievillager.getChunkCoordinates()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
|
||||
entityzombievillager.setVillagerData(entityvillager.getVillagerData());
|
||||
@@ -406,7 +436,7 @@
|
||||
entitychicken1.prepare(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
- worldaccess.addEntity(entitychicken1);
|
||||
+ worldaccess.addEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/EntityZombieHusk.java
|
||||
+++ b/net/minecraft/server/EntityZombieHusk.java
|
||||
@@ -44,7 +44,7 @@
|
||||
if (flag && this.getItemInMainHand().isEmpty() && entity instanceof EntityLiving) {
|
||||
float f = this.world.getDamageScaler(this.getChunkCoordinates()).b();
|
||||
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.HUNGER, 140 * (int) f));
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.HUNGER, 140 * (int) f), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
|
||||
return flag;
|
||||
@@ -0,0 +1,86 @@
|
||||
--- a/net/minecraft/server/EntityZombieVillager.java
|
||||
+++ b/net/minecraft/server/EntityZombieVillager.java
|
||||
@@ -6,6 +6,12 @@
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.entity.ZombieVillager;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
|
||||
|
||||
public static final DataWatcherObject<Boolean> CONVERTING = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.i);
|
||||
@@ -15,6 +21,7 @@
|
||||
private NBTBase bp;
|
||||
private NBTTagCompound bq;
|
||||
private int br;
|
||||
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
||||
|
||||
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -31,7 +38,7 @@
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
super.saveData(nbttagcompound);
|
||||
- DataResult dataresult = VillagerData.a.encodeStart(DynamicOpsNBT.a, this.getVillagerData());
|
||||
+ DataResult<NBTBase> dataresult = VillagerData.a.encodeStart(DynamicOpsNBT.a, this.getVillagerData()); // CraftBukkit - decompile error
|
||||
Logger logger = EntityZombieVillager.LOGGER;
|
||||
|
||||
logger.getClass();
|
||||
@@ -87,6 +94,10 @@
|
||||
public void tick() {
|
||||
if (!this.world.isClientSide && this.isAlive() && this.isConverting()) {
|
||||
int i = this.getConversionProgress();
|
||||
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
|
||||
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
|
||||
+ i *= elapsedTicks;
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.conversionTime -= i;
|
||||
if (this.conversionTime <= 0) {
|
||||
@@ -95,6 +106,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
+ this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,13 +150,22 @@
|
||||
this.conversionPlayer = uuid;
|
||||
this.conversionTime = i;
|
||||
this.getDataWatcher().set(EntityZombieVillager.CONVERTING, true);
|
||||
- this.removeEffect(MobEffects.WEAKNESS);
|
||||
- this.addEffect(new MobEffect(MobEffects.INCREASE_DAMAGE, i, Math.min(this.world.getDifficulty().a() - 1, 0)));
|
||||
+ // CraftBukkit start
|
||||
+ this.persistent = true; // CraftBukkit - SPIGOT-4684 update persistence
|
||||
+ this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
||||
+ this.addEffect(new MobEffect(MobEffects.INCREASE_DAMAGE, i, Math.min(this.world.getDifficulty().a() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
||||
+ // CraftBukkit end
|
||||
this.world.broadcastEntityEffect(this, (byte) 16);
|
||||
}
|
||||
|
||||
private void c(WorldServer worldserver) {
|
||||
- EntityVillager entityvillager = (EntityVillager) this.a(EntityTypes.VILLAGER, false);
|
||||
+ // CraftBukkit start
|
||||
+ EntityVillager entityvillager = (EntityVillager) this.a(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
|
||||
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
||||
int i = aenumitemslot.length;
|
||||
|
||||
@@ -185,7 +206,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
+ entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
|
||||
if (!this.isSilent()) {
|
||||
worldserver.a((EntityHuman) null, 1027, this.getChunkCoordinates(), 0);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/EntityPiglinAbstract.java
|
||||
+++ b/net/minecraft/server/EntityPiglinAbstract.java
|
||||
@@ -81,7 +81,7 @@
|
||||
}
|
||||
|
||||
protected void c(WorldServer worldserver) {
|
||||
- EntityPigZombie entitypigzombie = (EntityPigZombie) this.a(EntityTypes.ZOMBIFIED_PIGLIN, true);
|
||||
+ EntityPigZombie entitypigzombie = (EntityPigZombie) this.a(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));
|
||||
@@ -96,7 +96,7 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityLiving getGoalTarget() {
|
||||
- return (EntityLiving) this.bg.getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
|
||||
+ return (EntityLiving) this.bg.getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
protected boolean eO() {
|
||||
@@ -0,0 +1,102 @@
|
||||
--- a/net/minecraft/server/PiglinAI.java
|
||||
+++ b/net/minecraft/server/PiglinAI.java
|
||||
@@ -52,7 +52,8 @@
|
||||
private static void b(EntityPiglin entitypiglin, BehaviorController<EntityPiglin> behaviorcontroller) {
|
||||
behaviorcontroller.a(Activity.FLIGHT, 10, ImmutableList.of(new BehaviorAttackTargetForget<>((entityliving) -> {
|
||||
return !b(entitypiglin, entityliving);
|
||||
- }), new BehaviorRunIf<>(PiglinAI::c, new BehaviorRetreat<>(5, 0.75F)), new BehaviorWalkAwayOutOfRange(1.0F), new BehaviorAttack(20), new BehaviorCrossbowAttack<>(), new BehaviorRememberHuntedHoglin<>(), new BehaviorRemoveMemory<>(PiglinAI::j, MemoryModuleType.ATTACK_TARGET)), MemoryModuleType.ATTACK_TARGET);
|
||||
+ // CraftBukkit - decompile error
|
||||
+ }), new BehaviorRunIf<>((l) -> PiglinAI.c((EntityLiving) l), new BehaviorRetreat<>(5, 0.75F)), new BehaviorWalkAwayOutOfRange(1.0F), new BehaviorAttack(20), new BehaviorCrossbowAttack<>(), new BehaviorRememberHuntedHoglin<>(), new BehaviorRemoveMemory<>(PiglinAI::j, MemoryModuleType.ATTACK_TARGET)), MemoryModuleType.ATTACK_TARGET);
|
||||
}
|
||||
|
||||
private static void c(BehaviorController<EntityPiglin> behaviorcontroller) {
|
||||
@@ -70,7 +71,8 @@
|
||||
}
|
||||
|
||||
private static void f(BehaviorController<EntityPiglin> behaviorcontroller) {
|
||||
- behaviorcontroller.a(Activity.RIDE, 10, ImmutableList.of(new BehaviorStartRiding<>(0.8F), new BehaviorLookTarget(PiglinAI::b, 8.0F), new BehaviorRunIf<>(Entity::isPassenger, a()), new BehaviorStopRiding<>(8, PiglinAI::a)), MemoryModuleType.RIDE_TARGET);
|
||||
+ // CraftBukkit - decompile error
|
||||
+ behaviorcontroller.a(Activity.RIDE, 10, ImmutableList.of(new BehaviorStartRiding<>(0.8F), new BehaviorLookTarget(PiglinAI::b, 8.0F), new BehaviorRunIf<>(Entity::isPassenger, a()), new BehaviorStopRiding<EntityPiglin, Entity>(8, PiglinAI::a)), MemoryModuleType.RIDE_TARGET);
|
||||
}
|
||||
|
||||
private static BehaviorGateSingle<EntityPiglin> a() {
|
||||
@@ -78,7 +80,8 @@
|
||||
}
|
||||
|
||||
private static BehaviorGateSingle<EntityPiglin> b() {
|
||||
- return new BehaviorGateSingle<>(ImmutableList.of(Pair.of(new BehaviorStrollRandomUnconstrained(0.6F), 2), Pair.of(BehaviorInteract.a(EntityTypes.PIGLIN, 8, MemoryModuleType.INTERACTION_TARGET, 0.6F, 2), 2), Pair.of(new BehaviorRunIf<>(PiglinAI::g, new BehaviorLookWalk(0.6F, 3)), 2), Pair.of(new BehaviorNop(30, 60), 1)));
|
||||
+ // CraftBukkit - decompile error
|
||||
+ return new BehaviorGateSingle<>(ImmutableList.of(Pair.of(new BehaviorStrollRandomUnconstrained(0.6F), 2), Pair.of(BehaviorInteract.a(EntityTypes.PIGLIN, 8, MemoryModuleType.INTERACTION_TARGET, 0.6F, 2), 2), Pair.of(new BehaviorRunIf<>((java.util.function.Predicate<EntityLiving>) PiglinAI::g, new BehaviorLookWalk(0.6F, 3)), 2), Pair.of(new BehaviorNop(30, 60), 1)));
|
||||
}
|
||||
|
||||
private static BehaviorWalkAway<BlockPosition> c() {
|
||||
@@ -95,10 +98,10 @@
|
||||
|
||||
protected static void b(EntityPiglin entitypiglin) {
|
||||
BehaviorController<EntityPiglin> behaviorcontroller = entitypiglin.getBehaviorController();
|
||||
- Activity activity = (Activity) behaviorcontroller.f().orElse((Object) null);
|
||||
+ Activity activity = (Activity) behaviorcontroller.f().orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
behaviorcontroller.a((List) ImmutableList.of(Activity.ADMIRE_ITEM, Activity.FLIGHT, Activity.AVOID, Activity.CELEBRATE, Activity.RIDE, Activity.IDLE));
|
||||
- Activity activity1 = (Activity) behaviorcontroller.f().orElse((Object) null);
|
||||
+ Activity activity1 = (Activity) behaviorcontroller.f().orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (activity != activity1) {
|
||||
d(entitypiglin).ifPresent(entitypiglin::a);
|
||||
@@ -130,14 +133,18 @@
|
||||
n(entitypiglin);
|
||||
ItemStack itemstack;
|
||||
|
||||
- if (entityitem.getItemStack().getItem() == Items.GOLD_NUGGET) {
|
||||
+ // CraftBukkit start
|
||||
+ if (entityitem.getItemStack().getItem() == Items.GOLD_NUGGET && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(entitypiglin, entityitem, 0, false).isCancelled()) {
|
||||
entitypiglin.receive(entityitem, entityitem.getItemStack().getCount());
|
||||
itemstack = entityitem.getItemStack();
|
||||
entityitem.die();
|
||||
- } else {
|
||||
+ } else if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(entitypiglin, entityitem, entityitem.getItemStack().getCount() - 1, false).isCancelled()) {
|
||||
entitypiglin.receive(entityitem, 1);
|
||||
itemstack = a(entityitem);
|
||||
+ } else {
|
||||
+ return;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
@@ -148,7 +155,7 @@
|
||||
} else if (c(item) && !u(entitypiglin)) {
|
||||
s(entitypiglin);
|
||||
} else {
|
||||
- boolean flag = entitypiglin.g(itemstack);
|
||||
+ boolean flag = entitypiglin.g(itemstack, entityitem); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
d(entitypiglin, itemstack);
|
||||
@@ -350,7 +357,7 @@
|
||||
}
|
||||
|
||||
public static void a(EntityHuman entityhuman, boolean flag) {
|
||||
- List<EntityPiglin> list = entityhuman.world.a(EntityPiglin.class, entityhuman.getBoundingBox().g(16.0D));
|
||||
+ List<EntityPiglinAbstract> list = entityhuman.world.a(EntityPiglin.class, entityhuman.getBoundingBox().g(16.0D)); // CraftBukkit - decompile error
|
||||
|
||||
list.stream().filter(PiglinAI::d).filter((entitypiglin) -> {
|
||||
return !flag || BehaviorUtil.c(entitypiglin, entityhuman);
|
||||
@@ -586,7 +593,7 @@
|
||||
EntityLiving entityliving = (EntityLiving) behaviorcontroller.getMemory(MemoryModuleType.AVOID_TARGET).get();
|
||||
EntityTypes<?> entitytypes = entityliving.getEntityType();
|
||||
|
||||
- return entitytypes == EntityTypes.HOGLIN ? p(entitypiglin) : (a(entitytypes) ? !behaviorcontroller.b(MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, (Object) entityliving) : false);
|
||||
+ return entitytypes == EntityTypes.HOGLIN ? p(entitypiglin) : (a(entitytypes) ? !behaviorcontroller.b(MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, entityliving) : false); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,7 +675,7 @@
|
||||
}
|
||||
|
||||
public static boolean b(EntityLiving entityliving) {
|
||||
- return entityliving.getEntityType() == EntityTypes.PLAYER && entityliving.a(PiglinAI::a);
|
||||
+ return entityliving.getEntityType() == EntityTypes.PLAYER && entityliving.a((java.util.function.Predicate<Item>) PiglinAI::a); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static boolean x(EntityPiglin entitypiglin) {
|
||||
Reference in New Issue
Block a user