@@ -12,11 +12,11 @@
|
||||
+
|
||||
public class EntityCreeper extends EntityMonster implements PowerableMob {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_SWELL_DIR = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.INT);
|
||||
private static final DataWatcherObject<Integer> DATA_SWELL_DIR = DataWatcher.defineId(EntityCreeper.class, DataWatcherRegistry.INT);
|
||||
@@ -219,9 +225,19 @@
|
||||
@Override
|
||||
public void onLightningStrike(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
super.onLightningStrike(worldserver, entitylightning);
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
- this.entityData.set(EntityCreeper.DATA_IS_POWERED, true);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
||||
@@ -32,24 +32,24 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
protected EnumInteractionResult b(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -246,10 +262,18 @@
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
- this.dead = true;
|
||||
- this.level.explode(this, this.locX(), this.locY(), this.locZ(), (float) this.explosionRadius * f, explosion_effect);
|
||||
- this.die();
|
||||
- this.createEffectCloud();
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, explosion_effect);
|
||||
- this.discard();
|
||||
- this.spawnLingeringCloud();
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.dead = true;
|
||||
+ this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.die();
|
||||
+ this.createEffectCloud();
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.discard();
|
||||
+ this.spawnLingeringCloud();
|
||||
+ } else {
|
||||
+ swell = 0;
|
||||
+ }
|
||||
@@ -59,9 +59,9 @@
|
||||
}
|
||||
@@ -260,6 +284,7 @@
|
||||
if (!collection.isEmpty()) {
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level, this.locX(), this.locY(), this.locZ());
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level, this.getX(), this.getY(), this.getZ());
|
||||
|
||||
+ entityareaeffectcloud.setSource(this); // CraftBukkit
|
||||
+ entityareaeffectcloud.setOwner(this); // CraftBukkit
|
||||
entityareaeffectcloud.setRadius(2.5F);
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
@@ -69,8 +69,8 @@
|
||||
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
|
||||
}
|
||||
|
||||
- this.level.addEntity(entityareaeffectcloud);
|
||||
+ this.level.addEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
|
||||
- this.level.addFreshEntity(entityareaeffectcloud);
|
||||
+ this.level.addFreshEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
@@ -105,7 +105,17 @@
|
||||
@@ -110,7 +110,17 @@
|
||||
|
||||
@Override
|
||||
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
||||
- super.setGoalTarget(entityliving);
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
- super.setTarget(entityliving);
|
||||
+ // CraftBukkit start - fire event
|
||||
+ setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ setTarget(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)) {
|
||||
+ public boolean setTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (!super.setTarget(entityliving, reason, fireEvent)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ entityliving = getGoalTarget();
|
||||
+ entityliving = getTarget();
|
||||
+ // CraftBukkit end
|
||||
AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -120,6 +130,7 @@
|
||||
attributemodifiable.b(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
@@ -125,6 +135,7 @@
|
||||
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
}
|
||||
}
|
||||
+ return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -446,9 +457,13 @@
|
||||
@@ -471,9 +482,13 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.b(iblockdata2, (GeneratorAccess) this.enderman.level, blockposition);
|
||||
if (this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
+ // CraftBukkit start - Place event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2).isCancelled()) {
|
||||
world.setTypeAndData(blockposition, iblockdata2, 3);
|
||||
world.a((Entity) this.enderman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
this.enderman.setCarried((IBlockData) null);
|
||||
world.setBlock(blockposition, iblockdata2, 3);
|
||||
world.gameEvent(this.enderman, GameEvent.BLOCK_PLACE, blockposition);
|
||||
this.enderman.setCarriedBlock((IBlockData) null);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -487,9 +502,13 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition);
|
||||
@@ -512,9 +527,13 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
- world.a(blockposition, false);
|
||||
- world.a((Entity) this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
||||
- this.enderman.setCarried(iblockdata.getBlock().getBlockData());
|
||||
if (iblockdata.is((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
- world.removeBlock(blockposition, false);
|
||||
- world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
||||
- this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
|
||||
+ // CraftBukkit start - Pickup event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ world.a(blockposition, false);
|
||||
+ world.a((Entity) this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
||||
+ this.enderman.setCarried(iblockdata.getBlock().getBlockData());
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ world.removeBlock(blockposition, false);
|
||||
+ world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
||||
+ this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
@@ -318,6 +318,8 @@
|
||||
@@ -330,6 +330,8 @@
|
||||
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getPower());
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getExplosionPower());
|
||||
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.explosionPower = 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.chargeTime = -40;
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.explosionPower = this.ghast.getExplosionPower();
|
||||
entitylargefireball.setPos(this.ghast.getX() + vec3d.x * 4.0D, this.ghast.getY(0.5D) + 0.5D, entitylargefireball.getZ() + vec3d.z * 4.0D);
|
||||
world.addFreshEntity(entitylargefireball);
|
||||
this.chargeTime = -40;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityGuardian.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGuardian.java
|
||||
@@ -123,7 +123,7 @@
|
||||
return 80;
|
||||
}
|
||||
|
||||
- void a(int i) {
|
||||
+ public void a(int i) { // PAIL package -> public, rename setLaserTarget
|
||||
this.entityData.set(EntityGuardian.DATA_ID_ATTACK_TARGET, i);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) {
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
|
||||
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
|
||||
- entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), this);
|
||||
+ entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1,29 +1,20 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
@@ -70,7 +70,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));
|
||||
@@ -228,7 +228,7 @@
|
||||
|
||||
@Override
|
||||
protected void j() {
|
||||
protected void performSpellCasting() {
|
||||
- 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
|
||||
@@ -274,7 +274,7 @@
|
||||
@@ -279,7 +279,7 @@
|
||||
|
||||
@Override
|
||||
protected void j() {
|
||||
- EntityIllagerIllusioner.this.getGoalTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), EntityIllagerIllusioner.this);
|
||||
+ EntityIllagerIllusioner.this.getGoalTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), EntityIllagerIllusioner.this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
protected void performSpellCasting() {
|
||||
- EntityIllagerIllusioner.this.getTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), EntityIllagerIllusioner.this);
|
||||
+ EntityIllagerIllusioner.this.getTarget().addEffect(new MobEffect(MobEffects.BLINDNESS, 400), EntityIllagerIllusioner.this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
@@ -161,6 +161,11 @@
|
||||
public void e() {
|
||||
public void tick() {
|
||||
--this.attackWarmupDelay;
|
||||
if (this.attackWarmupDelay == 0) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleEntitySpellCastEvent(EntityIllagerWizard.this, this.getCastSpell())) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleEntitySpellCastEvent(EntityIllagerWizard.this, this.getSpell())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.j();
|
||||
EntityIllagerWizard.this.playSound(EntityIllagerWizard.this.getSoundCastSpell(), 1.0F, 1.0F);
|
||||
this.performSpellCasting();
|
||||
EntityIllagerWizard.this.playSound(EntityIllagerWizard.this.getCastingSoundEvent(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
|
||||
@@ -529,7 +529,7 @@
|
||||
@@ -523,14 +523,14 @@
|
||||
List<EntityHuman> list = EntityPhantom.this.level.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());
|
||||
+ list.sort(Comparator.comparing((Entity e) -> { return e.getY(); }).reversed()); // CraftBukkit - decompile error
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.DEFAULT)) {
|
||||
- EntityPhantom.this.setGoalTarget(entityhuman);
|
||||
+ EntityPhantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
|
||||
if (EntityPhantom.this.canAttack(entityhuman, PathfinderTargetCondition.DEFAULT)) {
|
||||
- EntityPhantom.this.setTarget(entityhuman);
|
||||
+ EntityPhantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +1,44 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
@@ -71,7 +71,7 @@
|
||||
protected void n() {
|
||||
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));
|
||||
}
|
||||
@@ -144,7 +144,7 @@
|
||||
@@ -145,7 +145,7 @@
|
||||
}).filter((entitypigzombie) -> {
|
||||
return !entitypigzombie.p(this.getGoalTarget());
|
||||
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
|
||||
}).forEach((entitypigzombie) -> {
|
||||
- entitypigzombie.setGoalTarget(this.getGoalTarget());
|
||||
+ entitypigzombie.setGoalTarget(this.getGoalTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
|
||||
- entitypigzombie.setTarget(this.getTarget());
|
||||
+ entitypigzombie.setTarget(this.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
|
||||
});
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
@@ -154,7 +154,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.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.a(this.random);
|
||||
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.a(this.random);
|
||||
@@ -163,12 +163,21 @@
|
||||
this.e((EntityHuman) entityliving);
|
||||
- public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
+ public boolean setTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature
|
||||
if (this.getTarget() == null && entityliving != null) {
|
||||
this.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.sample(this.random);
|
||||
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.sample(this.random);
|
||||
@@ -164,12 +164,21 @@
|
||||
this.setLastHurtByPlayer((EntityHuman) entityliving);
|
||||
}
|
||||
|
||||
- super.setGoalTarget(entityliving);
|
||||
+ return super.setGoalTarget(entityliving, reason, fireEvent); // CraftBukkit
|
||||
- super.setTarget(entityliving);
|
||||
+ return super.setTarget(entityliving, reason, fireEvent); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void anger() {
|
||||
- this.setAnger(EntityPigZombie.PERSISTENT_ANGER_TIME.a(this.random));
|
||||
public void startPersistentAngerTimer() {
|
||||
- this.setRemainingPersistentAngerTime(EntityPigZombie.PERSISTENT_ANGER_TIME.sample(this.random));
|
||||
+ // CraftBukkit start
|
||||
+ Entity entity = ((WorldServer) this.level).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.PERSISTENT_ANGER_TIME.a(this.random));
|
||||
+ Entity entity = ((WorldServer) this.level).getEntity(getPersistentAngerTarget());
|
||||
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.PERSISTENT_ANGER_TIME.sample(this.random));
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.setAngerTarget(null);
|
||||
+ this.setPersistentAngerTarget(null);
|
||||
+ return;
|
||||
+ }
|
||||
+ this.setAnger(event.getNewAnger());
|
||||
+ this.setRemainingPersistentAngerTime(event.getNewAnger());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static boolean b(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
|
||||
public static boolean checkZombifiedPiglinSpawnRules(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
@@ -75,7 +75,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));
|
||||
@@ -1,20 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
@@ -78,7 +78,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));
|
||||
@@ -169,7 +169,7 @@
|
||||
IBlockData iblockdata = this.level.getType(blockposition);
|
||||
@@ -168,7 +168,7 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
- if (block instanceof BlockLeaves) {
|
||||
+ if (block instanceof BlockLeaves && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit
|
||||
flag = this.level.a(blockposition, true, this) || flag;
|
||||
+ if (block instanceof BlockLeaves && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit
|
||||
flag = this.level.destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,17 +13,8 @@
|
||||
public class EntityShulker extends EntityGolem implements IMonster {
|
||||
|
||||
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
|
||||
@@ -95,7 +101,7 @@
|
||||
this.goalSelector.a(4, new EntityShulker.a());
|
||||
this.goalSelector.a(7, new EntityShulker.f());
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
||||
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{this.getClass()})).a());
|
||||
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{this.getClass()})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(2, new EntityShulker.e(this));
|
||||
this.targetSelector.a(3, new EntityShulker.c(this));
|
||||
}
|
||||
@@ -405,6 +411,16 @@
|
||||
EnumDirection enumdirection = this.g(blockposition1);
|
||||
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
|
||||
|
||||
if (enumdirection != null) {
|
||||
+ // CraftBukkit start
|
||||
@@ -36,15 +27,15 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.decouple();
|
||||
this.unRide();
|
||||
this.setAttachFace(enumdirection);
|
||||
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
|
||||
@@ -477,7 +493,7 @@
|
||||
}
|
||||
|
||||
entityshulker.d(vec3d);
|
||||
- this.level.addEntity(entityshulker);
|
||||
+ this.level.addEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
|
||||
entityshulker.moveTo(vec3d);
|
||||
- this.level.addFreshEntity(entityshulker);
|
||||
+ this.level.addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,26 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
@@ -46,7 +46,7 @@
|
||||
this.goalSelector.a(3, this.friendsGoal);
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -171,6 +171,11 @@
|
||||
@@ -173,6 +173,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockMonsterEggs) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
world.a(blockposition1, true, this.silverfish);
|
||||
world.destroyBlock(blockposition1, true, this.silverfish);
|
||||
} else {
|
||||
@@ -239,6 +244,11 @@
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
@@ -242,6 +247,11 @@
|
||||
IBlockData iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
if (BlockMonsterEggs.h(iblockdata)) {
|
||||
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, BlockMonsterEggs.n(iblockdata)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, BlockMonsterEggs.n(iblockdata), 3);
|
||||
this.mob.doSpawnEffect();
|
||||
this.mob.die();
|
||||
world.setBlock(blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata), 3);
|
||||
this.mob.spawnAnim();
|
||||
this.mob.discard();
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
|
||||
protected void fy() {
|
||||
- this.a(EntityTypes.STRAY, true);
|
||||
+ this.a(EntityTypes.STRAY, true, 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.a((EntityHuman) null, 1048, this.getChunkCoordinates(), 0);
|
||||
this.level.levelEvent((EntityHuman) null, 1048, this.blockPosition(), 0);
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
@@ -195,8 +195,19 @@
|
||||
@@ -194,8 +194,19 @@
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().a() * 4));
|
||||
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.getItemInMainHand(), null, entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true);
|
||||
+ 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()) {
|
||||
+ level.addEntity(entityarrow);
|
||||
+ level.addFreshEntity(entityarrow);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- this.level.addEntity(entityarrow);
|
||||
+ // this.world.addEntity(entityarrow); // CraftBukkit - moved up
|
||||
- this.level.addFreshEntity(entityarrow);
|
||||
+ // this.level.addFreshEntity(entityarrow); // CraftBukkit - moved up
|
||||
}
|
||||
|
||||
protected EntityArrow b(ItemStack itemstack, float f) {
|
||||
protected EntityArrow getArrow(ItemStack itemstack, float f) {
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
+
|
||||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.a(EntitySlime.class, DataWatcherRegistry.INT);
|
||||
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
|
||||
@@ -186,7 +194,7 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getEntityType() {
|
||||
- return super.getEntityType();
|
||||
+ return (EntityTypes<? extends EntitySlime>) super.getEntityType(); // CraftBukkit - decompile error
|
||||
public EntityTypes<? extends EntitySlime> getType() {
|
||||
- return super.getType();
|
||||
+ return (EntityTypes<? extends EntitySlime>) super.getType(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,7 +35,7 @@
|
||||
+ if (!event.isCancelled() && event.getCount() > 0) {
|
||||
+ k = event.getCount();
|
||||
+ } else {
|
||||
+ super.a(entity_removalreason);
|
||||
+ super.remove(entity_removalreason);
|
||||
+ return;
|
||||
+ }
|
||||
+ List<EntityLiving> slimes = new ArrayList<>(j);
|
||||
@@ -47,20 +47,20 @@
|
||||
@@ -214,8 +235,18 @@
|
||||
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.level.addEntity(entityslime);
|
||||
entityslime.moveTo(this.getX() + (double) f1, this.getY() + 0.5D, this.getZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
- this.level.addFreshEntity(entityslime);
|
||||
+ slimes.add(entityslime); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
|
||||
+ super.a(entity_removalreason);
|
||||
+ super.remove(entity_removalreason);
|
||||
+ return;
|
||||
+ }
|
||||
+ for (EntityLiving living : slimes) {
|
||||
+ this.level.addEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
+ this.level.addFreshEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
super.a(entity_removalreason);
|
||||
super.remove(entity_removalreason);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityStrider.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityStrider.java
|
||||
@@ -321,7 +321,13 @@
|
||||
IBlockData iblockdata1 = this.aU();
|
||||
boolean flag = iblockdata.a((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.a((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || this.b((Tag) TagsFluid.LAVA) > 0.0D;
|
||||
IBlockData iblockdata1 = this.getBlockStateOn();
|
||||
boolean flag = iblockdata.is((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
|
||||
|
||||
- this.setShivering(!flag);
|
||||
- this.setSuffocating(!flag);
|
||||
+ // CraftBukkit start
|
||||
+ if (!flag ^ this.isShivering()) {
|
||||
+ if (!flag ^ this.isSuffocating()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag)) {
|
||||
+ this.setShivering(!flag);
|
||||
+ this.setSuffocating(!flag);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.tick();
|
||||
this.fE();
|
||||
this.checkBlockCollisions();
|
||||
this.floatStrider();
|
||||
this.checkInsideBlocks();
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityVex.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityVex.java
|
||||
@@ -89,7 +89,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));
|
||||
}
|
||||
@@ -355,7 +355,7 @@
|
||||
@@ -368,7 +368,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- EntityVex.this.setGoalTarget(EntityVex.this.owner.getGoalTarget());
|
||||
+ EntityVex.this.setGoalTarget(EntityVex.this.owner.getGoalTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit
|
||||
super.c();
|
||||
public void start() {
|
||||
- EntityVex.this.setTarget(EntityVex.this.owner.getTarget());
|
||||
+ EntityVex.this.setTarget(EntityVex.this.owner.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityWitch.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityWitch.java
|
||||
@@ -132,7 +132,7 @@
|
||||
@@ -131,7 +131,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
MobEffect mobeffect = (MobEffect) iterator.next();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
@@ -70,6 +70,15 @@
|
||||
@@ -66,6 +66,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 UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
|
||||
@@ -89,6 +98,7 @@
|
||||
@@ -85,6 +94,7 @@
|
||||
private boolean canBreakDoors;
|
||||
private int inWaterTime;
|
||||
public int conversionTime;
|
||||
@@ -24,19 +24,19 @@
|
||||
|
||||
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -205,7 +215,10 @@
|
||||
@@ -201,7 +211,10 @@
|
||||
public void tick() {
|
||||
if (!this.level.isClientSide && this.isAlive() && !this.isNoAI()) {
|
||||
if (this.isDrownConverting()) {
|
||||
if (!this.level.isClientSide && this.isAlive() && !this.isNoAi()) {
|
||||
if (this.isUnderWaterConverting()) {
|
||||
- --this.conversionTime;
|
||||
+ // CraftBukkit start - Use wall time instead of ticks for conversion
|
||||
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
|
||||
+ this.conversionTime -= elapsedTicks;
|
||||
+ // CraftBukkit end
|
||||
if (this.conversionTime < 0) {
|
||||
this.fz();
|
||||
this.doUnderWaterConversion();
|
||||
}
|
||||
@@ -222,6 +235,7 @@
|
||||
@@ -218,6 +231,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
@@ -44,24 +44,24 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -254,6 +268,7 @@
|
||||
@@ -250,6 +264,7 @@
|
||||
}
|
||||
|
||||
public void startDrownedConversion(int i) {
|
||||
public void startUnderWaterConversion(int i) {
|
||||
+ this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
||||
this.conversionTime = i;
|
||||
this.getDataWatcher().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
|
||||
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
|
||||
}
|
||||
@@ -267,11 +282,15 @@
|
||||
@@ -263,11 +278,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);
|
||||
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) {
|
||||
entityzombie.z(entityzombie.level.getDamageScaler(entityzombie.getChunkCoordinates()).d());
|
||||
entityzombie.w(entityzombie.p() && this.fE());
|
||||
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);
|
||||
@@ -69,54 +69,54 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -311,9 +330,9 @@
|
||||
if (SpawnerCreature.a(entitypositiontypes_surface, (IWorldReader) this.level, blockposition, entitytypes) && EntityPositionTypes.a(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level.random)) {
|
||||
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
|
||||
if (!this.level.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.level.f((Entity) entityzombie) && this.level.getCubes(entityzombie) && !this.level.containsLiquid(entityzombie.getBoundingBox())) {
|
||||
- entityzombie.setGoalTarget(entityliving);
|
||||
+ entityzombie.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
|
||||
entityzombie.prepare(worldserver, this.level.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
- worldserver.addAllEntities(entityzombie);
|
||||
+ worldserver.addAllEntities(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
this.getAttributeInstance(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
entityzombie.getAttributeInstance(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
@@ -307,9 +326,9 @@
|
||||
if (SpawnerCreature.isSpawnPositionOk(entitypositiontypes_surface, this.level, blockposition, entitytypes) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level.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())) {
|
||||
- entityzombie.setTarget(entityliving);
|
||||
+ entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
|
||||
entityzombie.finalizeSpawn(worldserver, this.level.getCurrentDifficultyAt(entityzombie.blockPosition()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
- worldserver.addFreshEntityWithPassengers(entityzombie);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
break;
|
||||
@@ -334,7 +353,14 @@
|
||||
float f = this.level.getDamageScaler(this.getChunkCoordinates()).b();
|
||||
@@ -330,7 +349,14 @@
|
||||
float f = this.level.getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
|
||||
|
||||
if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) {
|
||||
- entity.setOnFire(2 * (int) f);
|
||||
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
|
||||
- entity.setSecondsOnFire(2 * (int) f);
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * (int) f); // PAIL: fixme
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.setOnFire(event.getDuration(), false);
|
||||
+ entity.setSecondsOnFire(event.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +441,12 @@
|
||||
@@ -411,7 +437,12 @@
|
||||
}
|
||||
|
||||
EntityVillager entityvillager = (EntityVillager) entityliving;
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.a(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
+ // CraftBukkit start
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.a(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, CreatureSpawnEvent.SpawnReason.INFECTION);
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(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.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
|
||||
entityzombievillager.setVillagerData(entityvillager.getVillagerData());
|
||||
@@ -477,7 +508,7 @@
|
||||
entitychicken1.prepare(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
@@ -473,7 +504,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
- worldaccess.addEntity(entitychicken1);
|
||||
+ worldaccess.addEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
- worldaccess.addFreshEntity(entitychicken1);
|
||||
+ worldaccess.addFreshEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityZombieHusk.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombieHusk.java
|
||||
@@ -58,7 +58,7 @@
|
||||
if (flag && this.getItemInMainHand().isEmpty() && entity instanceof EntityLiving) {
|
||||
float f = this.level.getDamageScaler(this.getChunkCoordinates()).b();
|
||||
if (flag && this.getMainHandItem().isEmpty() && entity instanceof EntityLiving) {
|
||||
float f = this.level.getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
|
||||
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.HUNGER, 140 * (int) f), this);
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.HUNGER, 140 * (int) f), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
||||
@@ -49,6 +49,13 @@
|
||||
@@ -47,6 +47,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -13,25 +13,25 @@
|
||||
+
|
||||
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
|
||||
|
||||
public static final DataWatcherObject<Boolean> DATA_CONVERTING_ID = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -62,6 +69,7 @@
|
||||
private NBTBase gossips;
|
||||
public static final DataWatcherObject<Boolean> DATA_CONVERTING_ID = DataWatcher.defineId(EntityZombieVillager.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -63,6 +70,7 @@
|
||||
@Nullable
|
||||
private NBTTagCompound tradeOffers;
|
||||
private int villagerXp;
|
||||
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
||||
|
||||
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -78,7 +86,7 @@
|
||||
@@ -79,7 +87,7 @@
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
super.saveData(nbttagcompound);
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
- DataResult dataresult = VillagerData.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.getVillagerData());
|
||||
+ DataResult<NBTBase> dataresult = VillagerData.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.getVillagerData()); // CraftBukkit - decompile error
|
||||
Logger logger = EntityZombieVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -134,6 +142,10 @@
|
||||
@@ -135,6 +143,10 @@
|
||||
public void tick() {
|
||||
if (!this.level.isClientSide && this.isAlive() && this.isConverting()) {
|
||||
int i = this.getConversionProgress();
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
this.villagerConversionTime -= i;
|
||||
if (this.villagerConversionTime <= 0) {
|
||||
@@ -142,6 +154,7 @@
|
||||
@@ -143,6 +155,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
@@ -50,27 +50,27 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,8 +199,11 @@
|
||||
@@ -187,8 +200,11 @@
|
||||
this.conversionStarter = uuid;
|
||||
this.villagerConversionTime = i;
|
||||
this.getDataWatcher().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
|
||||
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
|
||||
- this.removeEffect(MobEffects.WEAKNESS);
|
||||
- this.addEffect(new MobEffect(MobEffects.DAMAGE_BOOST, i, Math.min(this.level.getDifficulty().a() - 1, 0)));
|
||||
- this.addEffect(new MobEffect(MobEffects.DAMAGE_BOOST, i, Math.min(this.level.getDifficulty().getId() - 1, 0)));
|
||||
+ // CraftBukkit start
|
||||
+ this.setPersistenceRequired(true); // CraftBukkit - SPIGOT-4684 update persistence
|
||||
+ this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
||||
+ this.addEffect(new MobEffect(MobEffects.DAMAGE_BOOST, i, Math.min(this.level.getDifficulty().a() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
||||
+ this.addEffect(new MobEffect(MobEffects.DAMAGE_BOOST, i, Math.min(this.level.getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
||||
+ // CraftBukkit end
|
||||
this.level.broadcastEntityEffect(this, (byte) 16);
|
||||
this.level.broadcastEntityEvent(this, (byte) 16);
|
||||
}
|
||||
|
||||
@@ -204,7 +220,13 @@
|
||||
@@ -205,7 +221,13 @@
|
||||
}
|
||||
|
||||
private void c(WorldServer worldserver) {
|
||||
- EntityVillager entityvillager = (EntityVillager) this.a(EntityTypes.VILLAGER, false);
|
||||
private void finishConversion(WorldServer worldserver) {
|
||||
- EntityVillager entityvillager = (EntityVillager) this.convertTo(EntityTypes.VILLAGER, false);
|
||||
+ // CraftBukkit start
|
||||
+ EntityVillager entityvillager = (EntityVillager) this.a(EntityTypes.VILLAGER, false, EntityTransformEvent.TransformReason.CURED, CreatureSpawnEvent.SpawnReason.CURED);
|
||||
+ 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;
|
||||
@@ -79,22 +79,22 @@
|
||||
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
||||
int i = aenumitemslot.length;
|
||||
|
||||
@@ -219,7 +241,9 @@
|
||||
double d0 = (double) this.e(enumitemslot);
|
||||
@@ -220,7 +242,9 @@
|
||||
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
|
||||
|
||||
if (d0 > 1.0D) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.b(itemstack);
|
||||
this.spawnAtLocation(itemstack);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,7 +269,7 @@
|
||||
@@ -246,7 +270,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);
|
||||
worldserver.levelEvent((EntityHuman) null, 1027, this.blockPosition(), 0);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
@@ -56,6 +56,18 @@
|
||||
@@ -55,6 +55,18 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
+
|
||||
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.a(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -76,6 +88,10 @@
|
||||
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -75,6 +87,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.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{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,76 +30,67 @@
|
||||
|
||||
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -94,6 +110,14 @@
|
||||
@@ -93,6 +109,14 @@
|
||||
}
|
||||
|
||||
nbttagcompound.set("Inventory", this.inventory.g());
|
||||
nbttagcompound.put("Inventory", this.inventory.createTag());
|
||||
+ // CraftBukkit start
|
||||
+ NBTTagList barterList = new NBTTagList();
|
||||
+ allowedBarterItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::a).forEach(barterList::add);
|
||||
+ nbttagcompound.set("Bukkit.BarterList", barterList);
|
||||
+ allowedBarterItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
|
||||
+ nbttagcompound.put("Bukkit.BarterList", barterList);
|
||||
+ NBTTagList interestList = new NBTTagList();
|
||||
+ interestItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::a).forEach(interestList::add);
|
||||
+ nbttagcompound.set("Bukkit.InterestList", interestList);
|
||||
+ interestItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(interestList::add);
|
||||
+ nbttagcompound.put("Bukkit.InterestList", interestList);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,6 +126,10 @@
|
||||
@@ -101,6 +125,10 @@
|
||||
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
|
||||
this.x(nbttagcompound.getBoolean("CannotHunt"));
|
||||
this.inventory.a(nbttagcompound.getList("Inventory", 10));
|
||||
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
|
||||
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
|
||||
+ // CraftBukkit start
|
||||
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::asString).map(MinecraftKey::a).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::asString).map(MinecraftKey::a).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@VisibleForDebug
|
||||
@@ -206,7 +234,7 @@
|
||||
@@ -205,7 +233,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<EntityPiglin> getBehaviorController() {
|
||||
- return super.getBehaviorController();
|
||||
+ return (BehaviorController<EntityPiglin>) super.getBehaviorController(); // CraftBukkit - Decompile error
|
||||
public BehaviorController<EntityPiglin> getBrain() {
|
||||
- return super.getBrain();
|
||||
+ return (BehaviorController<EntityPiglin>) super.getBrain(); // CraftBukkit - Decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -265,7 +293,7 @@
|
||||
@Override
|
||||
protected void mobTick() {
|
||||
this.level.getMethodProfiler().enter("piglinBrain");
|
||||
- this.getBehaviorController().a((WorldServer) this.level, (EntityLiving) this);
|
||||
+ this.getBehaviorController().a((WorldServer) this.level, (EntityPiglin) this); // CraftBukkit - decompile error
|
||||
this.level.getMethodProfiler().exit();
|
||||
PiglinAI.b(this);
|
||||
super.mobTick();
|
||||
@@ -349,7 +377,7 @@
|
||||
@@ -348,7 +376,7 @@
|
||||
}
|
||||
|
||||
protected void p(ItemStack itemstack) {
|
||||
- if (itemstack.a(PiglinAI.BARTERING_ITEM)) {
|
||||
+ if (itemstack.a(PiglinAI.BARTERING_ITEM) || allowedBarterItems.contains(itemstack.getItem())) { // CraftBukkit - Changes to accept custom payment items
|
||||
this.setSlot(EnumItemSlot.OFFHAND, itemstack);
|
||||
this.d(EnumItemSlot.OFFHAND);
|
||||
protected void holdInOffHand(ItemStack itemstack) {
|
||||
- if (itemstack.is(PiglinAI.BARTERING_ITEM)) {
|
||||
+ if (itemstack.is(PiglinAI.BARTERING_ITEM) || allowedBarterItems.contains(itemstack.getItem())) { // CraftBukkit - Changes to accept custom payment items
|
||||
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
|
||||
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
|
||||
} else {
|
||||
@@ -375,8 +403,8 @@
|
||||
if (EnchantmentManager.d(itemstack1)) {
|
||||
@@ -374,8 +402,8 @@
|
||||
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
|
||||
return false;
|
||||
} else {
|
||||
- boolean flag = PiglinAI.a(itemstack) || itemstack.a(Items.CROSSBOW);
|
||||
- boolean flag1 = PiglinAI.a(itemstack1) || itemstack1.a(Items.CROSSBOW);
|
||||
+ boolean flag = PiglinAI.isLovedByPiglin(itemstack, this) || itemstack.a(Items.CROSSBOW); // CraftBukkit
|
||||
+ boolean flag1 = PiglinAI.isLovedByPiglin(itemstack1, this) || itemstack1.a(Items.CROSSBOW); // CraftBukkit
|
||||
- boolean flag = PiglinAI.isLovedItem(itemstack) || itemstack.is(Items.CROSSBOW);
|
||||
- boolean flag1 = PiglinAI.isLovedItem(itemstack1) || itemstack1.is(Items.CROSSBOW);
|
||||
+ 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.fw() && !itemstack.a(Items.CROSSBOW) && itemstack1.a(Items.CROSSBOW) ? false : super.a(itemstack, itemstack1)));
|
||||
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1)));
|
||||
}
|
||||
@@ -405,7 +433,7 @@
|
||||
@@ -404,7 +432,7 @@
|
||||
|
||||
@Override
|
||||
protected SoundEffect getSoundAmbient() {
|
||||
- return this.level.isClientSide ? null : (SoundEffect) PiglinAI.d(this).orElse((Object) null);
|
||||
+ return this.level.isClientSide ? null : (SoundEffect) PiglinAI.d(this).orElse(null); // CraftBukkit - Decompile error
|
||||
protected SoundEffect getAmbientSound() {
|
||||
- return this.level.isClientSide ? null : (SoundEffect) PiglinAI.getSoundForCurrentActivity(this).orElse((Object) null);
|
||||
+ return this.level.isClientSide ? null : (SoundEffect) PiglinAI.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - Decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
@@ -100,7 +100,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
|
||||
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));
|
||||
@@ -117,7 +117,7 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityLiving getGoalTarget() {
|
||||
public EntityLiving getTarget() {
|
||||
- return (EntityLiving) this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
|
||||
+ return (EntityLiving) this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
protected boolean fy() {
|
||||
protected boolean isHoldingMeleeWeapon() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/PiglinAI.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAI.java
|
||||
@@ -73,6 +73,13 @@
|
||||
@@ -72,6 +72,13 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -14,179 +14,131 @@
|
||||
public class PiglinAI {
|
||||
|
||||
public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL = 8;
|
||||
@@ -145,7 +152,8 @@
|
||||
private static void b(EntityPiglin entitypiglin, BehaviorController<EntityPiglin> behaviorcontroller) {
|
||||
behaviorcontroller.a(Activity.FIGHT, 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);
|
||||
}
|
||||
@@ -187,13 +194,13 @@
|
||||
|
||||
private static void c(BehaviorController<EntityPiglin> behaviorcontroller) {
|
||||
@@ -163,7 +171,8 @@
|
||||
}
|
||||
protected static void updateActivity(EntityPiglin entitypiglin) {
|
||||
BehaviorController<EntityPiglin> behaviorcontroller = entitypiglin.getBrain();
|
||||
- Activity activity = (Activity) behaviorcontroller.getActiveNonCoreActivity().orElse((Object) null);
|
||||
+ Activity activity = (Activity) behaviorcontroller.getActiveNonCoreActivity().orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
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() {
|
||||
@@ -171,7 +180,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::f, 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::f, new BehaviorLookWalk(0.6F, 3)), 2), Pair.of(new BehaviorNop(30, 60), 1)));
|
||||
}
|
||||
|
||||
private static BehaviorWalkAway<BlockPosition> c() {
|
||||
@@ -188,13 +198,13 @@
|
||||
|
||||
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.FIGHT, 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
|
||||
behaviorcontroller.setActiveActivityToFirstValid(ImmutableList.of(Activity.ADMIRE_ITEM, Activity.FIGHT, Activity.AVOID, Activity.CELEBRATE, Activity.RIDE, Activity.IDLE));
|
||||
- Activity activity1 = (Activity) behaviorcontroller.getActiveNonCoreActivity().orElse((Object) null);
|
||||
+ Activity activity1 = (Activity) behaviorcontroller.getActiveNonCoreActivity().orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (activity != activity1) {
|
||||
- Optional optional = d(entitypiglin);
|
||||
+ Optional<SoundEffect> optional = d(entitypiglin); // CraftBukkit - decompile error
|
||||
- Optional optional = getSoundForCurrentActivity(entitypiglin);
|
||||
+ Optional<SoundEffect> optional = getSoundForCurrentActivity(entitypiglin); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(entitypiglin);
|
||||
optional.ifPresent(entitypiglin::a);
|
||||
@@ -226,23 +236,27 @@
|
||||
n(entitypiglin);
|
||||
optional.ifPresent(entitypiglin::playSound);
|
||||
@@ -225,23 +232,27 @@
|
||||
stopWalking(entitypiglin);
|
||||
ItemStack itemstack;
|
||||
|
||||
- if (entityitem.getItemStack().a(Items.GOLD_NUGGET)) {
|
||||
- if (entityitem.getItem().is(Items.GOLD_NUGGET)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (entityitem.getItemStack().a(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();
|
||||
+ if (entityitem.getItem().is(Items.GOLD_NUGGET) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(entitypiglin, entityitem, 0, false).isCancelled()) {
|
||||
entitypiglin.take(entityitem, entityitem.getItem().getCount());
|
||||
itemstack = entityitem.getItem();
|
||||
entityitem.discard();
|
||||
- } 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 if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(entitypiglin, entityitem, entityitem.getItem().getCount() - 1, false).isCancelled()) {
|
||||
entitypiglin.take(entityitem, 1);
|
||||
itemstack = removeOneItemFromItemEntity(entityitem);
|
||||
+ } else {
|
||||
+ return;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
- if (a(itemstack)) {
|
||||
+ if (isLovedByPiglin(itemstack, entitypiglin)) { // CraftBukkit - Changes to allow for custom payment in bartering
|
||||
entitypiglin.getBehaviorController().removeMemory(MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM);
|
||||
c(entitypiglin, itemstack);
|
||||
d((EntityLiving) entitypiglin);
|
||||
} else if (c(itemstack) && !u(entitypiglin)) {
|
||||
s(entitypiglin);
|
||||
- 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);
|
||||
admireGoldItem(entitypiglin);
|
||||
} else if (isFood(itemstack) && !hasEatenRecently(entitypiglin)) {
|
||||
eat(entitypiglin);
|
||||
} else {
|
||||
- boolean flag = entitypiglin.j(itemstack);
|
||||
+ boolean flag = entitypiglin.j(itemstack, entityitem); // CraftBukkit
|
||||
- boolean flag = entitypiglin.equipItemIfPossible(itemstack);
|
||||
+ boolean flag = entitypiglin.equipItemIfPossible(itemstack, entityitem); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
d(entitypiglin, itemstack);
|
||||
@@ -278,9 +292,14 @@
|
||||
putInInventory(entitypiglin, itemstack);
|
||||
@@ -277,9 +288,14 @@
|
||||
boolean flag1;
|
||||
|
||||
if (entitypiglin.fw()) {
|
||||
- flag1 = b(itemstack);
|
||||
+ flag1 = isBarterItem(itemstack, entitypiglin); // CraftBukkit - Changes to allow custom payment for bartering
|
||||
if (entitypiglin.isAdult()) {
|
||||
- flag1 = isBarterCurrency(itemstack);
|
||||
+ flag1 = isBarterCurrency(itemstack, entitypiglin); // CraftBukkit - Changes to allow custom payment for bartering
|
||||
if (flag && flag1) {
|
||||
- a(entitypiglin, i(entitypiglin));
|
||||
- throwItems(entitypiglin, getBarterResponseItems(entitypiglin));
|
||||
+ // CraftBukkit start
|
||||
+ PiglinBarterEvent event = CraftEventFactory.callPiglinBarterEvent(entitypiglin, i(entitypiglin), itemstack);
|
||||
+ PiglinBarterEvent event = CraftEventFactory.callPiglinBarterEvent(entitypiglin, getBarterResponseItems(entitypiglin), itemstack);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ a(entitypiglin, event.getOutcome().stream().map(CraftItemStack::asNMSCopy).collect(Collectors.toList()));
|
||||
+ throwItems(entitypiglin, event.getOutcome().stream().map(CraftItemStack::asNMSCopy).collect(Collectors.toList()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (!flag1) {
|
||||
boolean flag2 = entitypiglin.j(itemstack);
|
||||
boolean flag2 = entitypiglin.equipItemIfPossible(itemstack);
|
||||
|
||||
@@ -293,7 +312,7 @@
|
||||
@@ -292,7 +308,7 @@
|
||||
if (!flag1) {
|
||||
ItemStack itemstack1 = entitypiglin.getItemInMainHand();
|
||||
ItemStack itemstack1 = entitypiglin.getMainHandItem();
|
||||
|
||||
- if (a(itemstack1)) {
|
||||
+ if (isLovedByPiglin(itemstack1, entitypiglin)) { // CraftBukkit - Changes to allow for custom payment in bartering
|
||||
d(entitypiglin, itemstack1);
|
||||
- if (isLovedItem(itemstack1)) {
|
||||
+ if (isLovedItem(itemstack1, entitypiglin)) { // CraftBukkit - Changes to allow for custom payment in bartering
|
||||
putInInventory(entitypiglin, itemstack1);
|
||||
} else {
|
||||
a(entitypiglin, Collections.singletonList(itemstack1));
|
||||
@@ -370,7 +389,7 @@
|
||||
throwItems(entitypiglin, Collections.singletonList(itemstack1));
|
||||
@@ -369,7 +385,7 @@
|
||||
return false;
|
||||
} else if (x(entitypiglin) && entitypiglin.getBehaviorController().hasMemory(MemoryModuleType.ATTACK_TARGET)) {
|
||||
} else if (isAdmiringDisabled(entitypiglin) && entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) {
|
||||
return false;
|
||||
- } else if (b(itemstack)) {
|
||||
+ } else if (isBarterItem(itemstack, entitypiglin)) { // CraftBukkit
|
||||
return z(entitypiglin);
|
||||
- } else if (isBarterCurrency(itemstack)) {
|
||||
+ } else if (isBarterCurrency(itemstack, entitypiglin)) { // CraftBukkit
|
||||
return isNotHoldingLovedItemInOffHand(entitypiglin);
|
||||
} else {
|
||||
boolean flag = entitypiglin.n(itemstack);
|
||||
@@ -379,6 +398,12 @@
|
||||
boolean flag = entitypiglin.canAddToInventory(itemstack);
|
||||
@@ -378,6 +394,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Added method to allow checking for custom payment items
|
||||
+ protected static boolean isLovedByPiglin(ItemStack itemstack, EntityPiglin piglin) {
|
||||
+ return a(itemstack) || (piglin.interestItems.contains(itemstack.getItem()) || piglin.allowedBarterItems.contains(itemstack.getItem()));
|
||||
+ protected static boolean isLovedItem(ItemStack itemstack, EntityPiglin piglin) {
|
||||
+ return isLovedItem(itemstack) || (piglin.interestItems.contains(itemstack.getItem()) || piglin.allowedBarterItems.contains(itemstack.getItem()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected static boolean a(ItemStack itemstack) {
|
||||
return itemstack.a((Tag) TagsItem.PIGLIN_LOVED);
|
||||
protected static boolean isLovedItem(ItemStack itemstack) {
|
||||
return itemstack.is((Tag) TagsItem.PIGLIN_LOVED);
|
||||
}
|
||||
@@ -444,7 +469,7 @@
|
||||
@@ -473,7 +495,7 @@
|
||||
}
|
||||
|
||||
public static void a(EntityHuman entityhuman, boolean flag) {
|
||||
- List<EntityPiglin> list = entityhuman.level.a(EntityPiglin.class, entityhuman.getBoundingBox().g(16.0D));
|
||||
+ List<EntityPiglinAbstract> list = (List) entityhuman.level.a(EntityPiglin.class, entityhuman.getBoundingBox().g(16.0D)); // CraftBukkit - decompile error
|
||||
|
||||
list.stream().filter(PiglinAI::d).filter((entitypiglin) -> {
|
||||
return !flag || BehaviorUtil.b((EntityLiving) entitypiglin, entityhuman);
|
||||
@@ -474,7 +499,7 @@
|
||||
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
|
||||
- return !isAdmiringDisabled(entitypiglin) && !isAdmiringItem(entitypiglin) && entitypiglin.isAdult() && isBarterCurrency(itemstack);
|
||||
+ return !isAdmiringDisabled(entitypiglin) && !isAdmiringItem(entitypiglin) && entitypiglin.isAdult() && isBarterCurrency(itemstack, entitypiglin); // CraftBukkit
|
||||
}
|
||||
|
||||
protected static boolean b(EntityPiglin entitypiglin, ItemStack itemstack) {
|
||||
- return !x(entitypiglin) && !v(entitypiglin) && entitypiglin.fw() && b(itemstack);
|
||||
+ return !x(entitypiglin) && !v(entitypiglin) && entitypiglin.fw() && isBarterItem(itemstack, entitypiglin); // CraftBukkit
|
||||
}
|
||||
|
||||
protected static void a(EntityPiglin entitypiglin, EntityLiving entityliving) {
|
||||
@@ -680,7 +705,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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,6 +766,12 @@
|
||||
return entitypiglin.getBehaviorController().hasMemory(MemoryModuleType.ADMIRING_ITEM);
|
||||
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
|
||||
@@ -740,6 +762,12 @@
|
||||
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Changes to allow custom payment for bartering
|
||||
+ private static boolean isBarterItem(ItemStack itemstack, EntityPiglin piglin) {
|
||||
+ return b(itemstack) || piglin.allowedBarterItems.contains(itemstack.getItem());
|
||||
+ private static boolean isBarterCurrency(ItemStack itemstack, EntityPiglin piglin) {
|
||||
+ return isBarterCurrency(itemstack) || piglin.allowedBarterItems.contains(itemstack.getItem());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private static boolean b(ItemStack itemstack) {
|
||||
return itemstack.a(PiglinAI.BARTERING_ITEM);
|
||||
private static boolean isBarterCurrency(ItemStack itemstack) {
|
||||
return itemstack.is(PiglinAI.BARTERING_ITEM);
|
||||
}
|
||||
@@ -778,7 +809,7 @@
|
||||
@@ -777,7 +805,7 @@
|
||||
}
|
||||
|
||||
private static boolean z(EntityPiglin entitypiglin) {
|
||||
- return entitypiglin.getItemInOffHand().isEmpty() || !a(entitypiglin.getItemInOffHand());
|
||||
+ return entitypiglin.getItemInOffHand().isEmpty() || !isLovedByPiglin(entitypiglin.getItemInOffHand(), entitypiglin); // CraftBukkit - Changes to allow custom payment for bartering
|
||||
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {
|
||||
- return entitypiglin.getOffhandItem().isEmpty() || !isLovedItem(entitypiglin.getOffhandItem());
|
||||
+ return entitypiglin.getOffhandItem().isEmpty() || !isLovedItem(entitypiglin.getOffhandItem(), entitypiglin); // CraftBukkit - Changes to allow custom payment for bartering
|
||||
}
|
||||
|
||||
public static boolean a(EntityTypes<?> entitytypes) {
|
||||
public static boolean isZombified(EntityTypes<?> entitytypes) {
|
||||
|
||||
Reference in New Issue
Block a user