@@ -3,13 +3,13 @@
|
||||
@@ -72,6 +72,12 @@
|
||||
}
|
||||
|
||||
if (this.breakTime == this.f() && this.a(this.mob.level.getDifficulty())) {
|
||||
if (this.breakTime == this.getDoorBreakTime() && this.isValidDifficulty(this.mob.level.getDifficulty())) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.mob, this.doorPos).isCancelled()) {
|
||||
+ this.c();
|
||||
+ this.start();
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.mob.level.a(this.doorPos, false);
|
||||
this.mob.level.triggerEffect(1021, this.doorPos, 0);
|
||||
this.mob.level.triggerEffect(2001, this.doorPos, Block.getCombinedId(this.mob.level.getType(this.doorPos)));
|
||||
this.mob.level.removeBlock(this.doorPos, false);
|
||||
this.mob.level.levelEvent(1021, this.doorPos, 0);
|
||||
this.mob.level.levelEvent(2001, this.doorPos, Block.getId(this.mob.level.getBlockState(this.doorPos)));
|
||||
|
||||
@@ -12,22 +12,22 @@
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -65,7 +69,8 @@
|
||||
BlockPosition blockposition = this.mob.getChunkCoordinates();
|
||||
BlockPosition blockposition = this.mob.blockPosition();
|
||||
|
||||
if (PathfinderGoalEatTile.IS_TALL_GRASS.test(this.level.getType(blockposition))) {
|
||||
if (PathfinderGoalEatTile.IS_TALL_GRASS.test(this.level.getBlockState(blockposition))) {
|
||||
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ // CraftBukkit
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.getBlockData(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.b(blockposition, false);
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.destroyBlock(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -75,7 +80,8 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
BlockPosition blockposition1 = blockposition.below();
|
||||
|
||||
if (this.level.getType(blockposition1).a(Blocks.GRASS_BLOCK)) {
|
||||
if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) {
|
||||
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ // CraftBukkit
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.getBlockData(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData()));
|
||||
this.level.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
|
||||
this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
@@ -15,6 +15,12 @@
|
||||
@@ -14,6 +14,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
public class PathfinderGoalFollowOwner extends PathfinderGoal {
|
||||
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
|
||||
@@ -121,7 +127,18 @@
|
||||
} else if (!this.a(new BlockPosition(i, j, k))) {
|
||||
@@ -120,7 +126,18 @@
|
||||
} else if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
- this.tamable.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
- this.tamable.moveTo((double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
+ // CraftBukkit start
|
||||
+ CraftEntity entity = this.tamable.getBukkitEntity();
|
||||
+ Location to = new Location(entity.getWorld(), (double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
@@ -28,8 +28,8 @@
|
||||
+ }
|
||||
+ to = event.getTo();
|
||||
+
|
||||
+ this.tamable.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ this.tamable.moveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ // CraftBukkit end
|
||||
this.navigation.o();
|
||||
this.navigation.stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,17 +10,25 @@
|
||||
+
|
||||
public class PathfinderGoalPanic extends PathfinderGoal {
|
||||
|
||||
protected final EntityCreature mob;
|
||||
@@ -76,6 +80,12 @@
|
||||
public static final int WATER_CHECK_DISTANCE_VERTICAL = 1;
|
||||
@@ -77,6 +81,12 @@
|
||||
|
||||
@Override
|
||||
public boolean b() {
|
||||
public boolean canContinueToUse() {
|
||||
+ // CraftBukkit start - introduce a temporary timeout hack until this is fixed properly
|
||||
+ if ((this.mob.tickCount - this.mob.lastHurtByMobTimestamp) > 100) {
|
||||
+ this.mob.setLastDamager((EntityLiving) null);
|
||||
+ this.mob.setLastHurtByMob((EntityLiving) null);
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return !this.mob.getNavigation().m();
|
||||
return !this.mob.getNavigation().isDone();
|
||||
}
|
||||
|
||||
@@ -86,6 +96,6 @@
|
||||
|
||||
return !iblockaccess.getBlockState(blockposition).getCollisionShape(iblockaccess, blockposition).isEmpty() ? null : (BlockPosition) BlockPosition.findClosestMatch(entity.blockPosition(), i, 1, (blockposition1) -> {
|
||||
return iblockaccess.getFluidState(blockposition1).is((Tag) TagsFluid.WATER);
|
||||
- }).orElse((Object) null);
|
||||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.a(blockposition1, false);
|
||||
world.removeBlock(blockposition1, false);
|
||||
if (!world.isClientSide) {
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalSit.java
|
||||
@@ -22,7 +22,7 @@
|
||||
@Override
|
||||
public boolean a() {
|
||||
if (!this.mob.isTamed()) {
|
||||
public boolean canUse() {
|
||||
if (!this.mob.isTame()) {
|
||||
- return false;
|
||||
+ return this.mob.isWillSit() && this.mob.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
||||
} else if (this.mob.aO()) {
|
||||
+ return this.mob.isOrderedToSit() && this.mob.getTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
||||
} else if (this.mob.isInWaterOrBubble()) {
|
||||
return false;
|
||||
} else if (!this.mob.isOnGround()) {
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
|
||||
@@ -62,7 +62,8 @@
|
||||
int i = this.horse.getTemper();
|
||||
int j = this.horse.getMaxDomestication();
|
||||
int j = this.horse.getMaxTemper();
|
||||
|
||||
- if (j > 0 && this.horse.getRandom().nextInt(j) < i) {
|
||||
+ // CraftBukkit - fire EntityTameEvent
|
||||
+ if (j > 0 && this.horse.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horse, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) {
|
||||
this.horse.i((EntityHuman) entity);
|
||||
this.horse.tameWithName((EntityHuman) entity);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
|
||||
@@ -8,6 +8,13 @@
|
||||
@@ -9,6 +9,13 @@
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.item.crafting.RecipeItemStack;
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
+
|
||||
public class PathfinderGoalTempt extends PathfinderGoal {
|
||||
|
||||
private static final PathfinderTargetCondition TEMP_TARGETING = PathfinderTargetCondition.b().a(10.0D).d();
|
||||
@@ -19,7 +26,7 @@
|
||||
private double pz;
|
||||
private static final PathfinderTargetCondition TEMP_TARGETING = PathfinderTargetCondition.forNonCombat().range(10.0D).ignoreLineOfSight();
|
||||
@@ -21,7 +28,7 @@
|
||||
private double pRotX;
|
||||
private double pRotY;
|
||||
@Nullable
|
||||
- protected EntityHuman player;
|
||||
+ protected EntityLiving player; // CraftBukkit
|
||||
private int calmDown;
|
||||
private boolean isRunning;
|
||||
private final RecipeItemStack items;
|
||||
@@ -41,6 +48,15 @@
|
||||
@@ -43,6 +50,15 @@
|
||||
return false;
|
||||
} else {
|
||||
this.player = this.mob.level.a(this.targetingConditions, (EntityLiving) this.mob);
|
||||
this.player = this.mob.level.getNearestPlayer(this.targetingConditions, this.mob);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player != null) {
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this.mob, this.player, EntityTargetEvent.TargetReason.TEMPT);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalDefendVillage.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalDefendVillage.java
|
||||
@@ -56,7 +56,7 @@
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.golem.setGoalTarget(this.potentialTarget);
|
||||
+ this.golem.setGoalTarget(this.potentialTarget, org.bukkit.event.entity.EntityTargetEvent.TargetReason.DEFEND_VILLAGE, true); // CraftBukkit - reason
|
||||
super.c();
|
||||
public void start() {
|
||||
- this.golem.setTarget(this.potentialTarget);
|
||||
+ this.golem.setTarget(this.potentialTarget, org.bukkit.event.entity.EntityTargetEvent.TargetReason.DEFEND_VILLAGE, true); // CraftBukkit - reason
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalHurtByTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalHurtByTarget.java
|
||||
@@ -64,7 +64,7 @@
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.mob.setGoalTarget(this.mob.getLastDamager());
|
||||
+ this.mob.setGoalTarget(this.mob.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
|
||||
this.targetMob = this.mob.getGoalTarget();
|
||||
this.timestamp = this.mob.dH();
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.mob.getLastHurtByMob());
|
||||
+ this.mob.setTarget(this.mob.getLastHurtByMob(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
|
||||
this.targetMob = this.mob.getTarget();
|
||||
this.timestamp = this.mob.getLastHurtByMobTimestamp();
|
||||
this.unseenMemoryTicks = 300;
|
||||
@@ -111,6 +111,6 @@
|
||||
@@ -114,6 +114,6 @@
|
||||
}
|
||||
|
||||
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
- entityinsentient.setGoalTarget(entityliving);
|
||||
+ entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
- entityinsentient.setTarget(entityliving);
|
||||
+ entityinsentient.setTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
|
||||
@@ -61,7 +61,7 @@
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.mob.setGoalTarget(this.target);
|
||||
+ this.mob.setGoalTarget(this.target, target instanceof EntityPlayer ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit - reason
|
||||
super.c();
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.target);
|
||||
+ this.mob.setTarget(this.target, target instanceof EntityPlayer ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit - reason
|
||||
super.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.mob.setGoalTarget(this.ownerLastHurtBy);
|
||||
+ this.mob.setGoalTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit - reason
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.ownerLastHurtBy);
|
||||
+ this.mob.setTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit - reason
|
||||
EntityLiving entityliving = this.tameAnimal.getOwner();
|
||||
|
||||
if (entityliving != null) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.mob.setGoalTarget(this.ownerLastHurt);
|
||||
+ this.mob.setGoalTarget(this.ownerLastHurt, org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit - reason
|
||||
public void start() {
|
||||
- this.mob.setTarget(this.ownerLastHurt);
|
||||
+ this.mob.setTarget(this.ownerLastHurt, org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit - reason
|
||||
EntityLiving entityliving = this.tameAnimal.getOwner();
|
||||
|
||||
if (entityliving != null) {
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
public abstract class PathfinderGoalTarget extends PathfinderGoal {
|
||||
|
||||
private static final int EMPTY_REACH_CACHE = 0;
|
||||
@@ -68,7 +70,7 @@
|
||||
@@ -69,7 +71,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.mob.setGoalTarget(entityliving);
|
||||
+ this.mob.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit
|
||||
- this.mob.setTarget(entityliving);
|
||||
+ this.mob.setTarget(entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +90,7 @@
|
||||
@@ -89,7 +91,7 @@
|
||||
|
||||
@Override
|
||||
public void d() {
|
||||
- this.mob.setGoalTarget((EntityLiving) null);
|
||||
+ this.mob.setGoalTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||
public void stop() {
|
||||
- this.mob.setTarget((EntityLiving) null);
|
||||
+ this.mob.setTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||
this.targetMob = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user