@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/attributes/AttributeRanged.java
|
||||
+++ b/net/minecraft/world/entity/ai/attributes/AttributeRanged.java
|
||||
@@ -22,6 +22,8 @@
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
@Override
|
||||
public double a(double d0) {
|
||||
+ if (d0 != d0) return getDefault(); // CraftBukkit
|
||||
+
|
||||
d0 = MathHelper.a(d0, this.a, this.maximum);
|
||||
d0 = MathHelper.a(d0, this.minValue, this.maxValue);
|
||||
return d0;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
package net.minecraft.world.entity.ai.attributes;
|
||||
|
||||
import net.minecraft.core.IRegistry;
|
||||
@@ -19,6 +20,6 @@
|
||||
public static final AttributeBase JUMP_STRENGTH = a("horse.jump_strength", (new AttributeRanged("attribute.name.horse.jump_strength", 0.7D, 0.0D, 2.0D)).a(true));
|
||||
@@ -21,6 +22,6 @@
|
||||
public GenericAttributes() {}
|
||||
|
||||
private static AttributeBase a(String s, AttributeBase attributebase) {
|
||||
- return (AttributeBase) IRegistry.a(IRegistry.ATTRIBUTE, s, (Object) attributebase);
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
+
|
||||
public class BehaviorAttackTargetForget<E extends EntityInsentient> extends Behavior<E> {
|
||||
|
||||
private final Predicate<EntityLiving> b;
|
||||
@@ -60,6 +66,17 @@
|
||||
private static final int TIMEOUT_TO_GET_WITHIN_ATTACK_RANGE = 200;
|
||||
@@ -77,6 +83,17 @@
|
||||
}
|
||||
|
||||
private void d(E e0) {
|
||||
protected void a(E e0) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
@@ -28,6 +28,6 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.onTargetErased.accept(e0);
|
||||
e0.getBehaviorController().removeMemory(MemoryModuleType.ATTACK_TARGET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
+
|
||||
public class BehaviorAttackTargetSet<E extends EntityInsentient> extends Behavior<E> {
|
||||
|
||||
private final Predicate<E> b;
|
||||
private final Predicate<E> canAttackPredicate;
|
||||
@@ -38,13 +45,21 @@
|
||||
}
|
||||
|
||||
protected void a(WorldServer worldserver, E e0, long i) {
|
||||
- ((Optional) this.c.apply(e0)).ifPresent((entityliving) -> {
|
||||
+ (this.c.apply(e0)).ifPresent((entityliving) -> { // CraftBukkit - decompile error
|
||||
- ((Optional) this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> {
|
||||
+ (this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> { // CraftBukkit - decompile error
|
||||
this.a(e0, entityliving);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
|
||||
@@ -78,8 +78,8 @@
|
||||
@@ -80,8 +80,8 @@
|
||||
|
||||
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
if (i > this.c && this.farmBlock != null) {
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.farmBlock)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.farmBlock), 0.5F, 1)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.farmBlock))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.farmBlock), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
if (i > this.nextOkStartTime && this.aboveFarmlandPos != null) {
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.aboveFarmlandPos)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.aboveFarmlandPos))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,7 +99,11 @@
|
||||
Block block1 = worldserver.getType(this.farmBlock.down()).getBlock();
|
||||
@@ -101,7 +101,11 @@
|
||||
Block block1 = worldserver.getType(this.aboveFarmlandPos.down()).getBlock();
|
||||
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata)) {
|
||||
- worldserver.a(this.farmBlock, true, entityvillager);
|
||||
- worldserver.a(this.aboveFarmlandPos, true, entityvillager);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.farmBlock, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ worldserver.a(this.farmBlock, true, entityvillager);
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ worldserver.a(this.aboveFarmlandPos, true, entityvillager);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.canPlant()) {
|
||||
@@ -110,19 +114,28 @@
|
||||
@@ -112,19 +116,28 @@
|
||||
boolean flag = false;
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ Block planted = null;
|
||||
if (itemstack.getItem() == Items.WHEAT_SEEDS) {
|
||||
- worldserver.setTypeAndData(this.farmBlock, Blocks.WHEAT.getBlockData(), 3);
|
||||
if (itemstack.a(Items.WHEAT_SEEDS)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.WHEAT.getBlockData(), 3);
|
||||
+ planted = Blocks.WHEAT;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.POTATO) {
|
||||
- worldserver.setTypeAndData(this.farmBlock, Blocks.POTATOES.getBlockData(), 3);
|
||||
} else if (itemstack.a(Items.POTATO)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.POTATOES.getBlockData(), 3);
|
||||
+ planted = Blocks.POTATOES;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.CARROT) {
|
||||
- worldserver.setTypeAndData(this.farmBlock, Blocks.CARROTS.getBlockData(), 3);
|
||||
} else if (itemstack.a(Items.CARROT)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.CARROTS.getBlockData(), 3);
|
||||
+ planted = Blocks.CARROTS;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.BEETROOT_SEEDS) {
|
||||
- worldserver.setTypeAndData(this.farmBlock, Blocks.BEETROOTS.getBlockData(), 3);
|
||||
} else if (itemstack.a(Items.BEETROOT_SEEDS)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.BEETROOTS.getBlockData(), 3);
|
||||
+ planted = Blocks.BEETROOTS;
|
||||
flag = true;
|
||||
}
|
||||
+
|
||||
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.farmBlock, planted.getBlockData()).isCancelled()) {
|
||||
+ worldserver.setTypeAndData(this.farmBlock, planted.getBlockData(), 3);
|
||||
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, planted.getBlockData()).isCancelled()) {
|
||||
+ worldserver.setTypeAndData(this.aboveFarmlandPos, planted.getBlockData(), 3);
|
||||
+ } else {
|
||||
+ flag = false;
|
||||
+ }
|
||||
@@ -57,14 +57,14 @@
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -141,8 +154,8 @@
|
||||
this.farmBlock = this.a(worldserver);
|
||||
if (this.farmBlock != null) {
|
||||
this.c = i + 20L;
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.farmBlock), 0.5F, 1)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.farmBlock)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.farmBlock), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.farmBlock))); // CraftBukkit - decompile error
|
||||
@@ -143,8 +156,8 @@
|
||||
this.aboveFarmlandPos = this.a(worldserver);
|
||||
if (this.aboveFarmlandPos != null) {
|
||||
this.nextOkStartTime = i + 20L;
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.aboveFarmlandPos)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.aboveFarmlandPos))); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorInteractDoor.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorInteractDoor.java
|
||||
@@ -66,6 +66,13 @@
|
||||
@@ -69,6 +69,13 @@
|
||||
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
|
||||
|
||||
if (!blockdoor.h(iblockdata)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition));
|
||||
+ entityliving.world.getServer().getPluginManager().callEvent(event);
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
|
||||
+ entityliving.level.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor.setDoor(worldserver, iblockdata, blockposition, true);
|
||||
blockdoor.setDoor(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
}
|
||||
|
||||
@@ -79,6 +86,13 @@
|
||||
@@ -82,6 +89,13 @@
|
||||
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
|
||||
|
||||
if (!blockdoor1.h(iblockdata1)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition));
|
||||
+ entityliving.world.getServer().getPluginManager().callEvent(event);
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
|
||||
+ entityliving.level.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor1.setDoor(worldserver, iblockdata1, blockposition1, true);
|
||||
blockdoor1.setDoor(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
this.c(worldserver, entityliving, blockposition1);
|
||||
}
|
||||
@@ -127,7 +141,7 @@
|
||||
@@ -130,7 +144,7 @@
|
||||
private static boolean a(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController();
|
||||
|
||||
- return !behaviorcontroller.hasMemory(MemoryModuleType.MOBS) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.MOBS).get()).stream().filter((entityliving1) -> {
|
||||
+ return !behaviorcontroller.hasMemory(MemoryModuleType.MOBS) ? false : (behaviorcontroller.getMemory(MemoryModuleType.MOBS).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
- return !behaviorcontroller.hasMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> {
|
||||
+ return !behaviorcontroller.hasMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : (behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
return entityliving1.getEntityType() == entityliving.getEntityType();
|
||||
}).filter((entityliving1) -> {
|
||||
return blockposition.a((IPosition) entityliving1.getPositionVector(), 2.0D);
|
||||
@@ -169,7 +183,7 @@
|
||||
@@ -172,7 +186,7 @@
|
||||
if (behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).isPresent()) {
|
||||
((Set) behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).get()).add(globalpos);
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorMakeLove.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorMakeLove.java
|
||||
@@ -110,11 +110,16 @@
|
||||
@@ -112,11 +112,16 @@
|
||||
if (entityvillager2 == null) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -20,7 +20,7 @@
|
||||
worldserver.broadcastEntityEffect(entityvillager2, (byte) 12);
|
||||
return Optional.of(entityvillager2);
|
||||
}
|
||||
@@ -123,6 +128,6 @@
|
||||
@@ -125,6 +130,6 @@
|
||||
private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
|
||||
GlobalPos globalpos = GlobalPos.create(worldserver.getDimensionKey(), blockposition);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
@@ -54,7 +54,7 @@
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
private static void b(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -67,18 +67,19 @@
|
||||
@@ -75,18 +75,19 @@
|
||||
public static void a(EntityLiving entityliving, Entity entity, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entity, false), f, i);
|
||||
|
||||
@@ -31,20 +31,20 @@
|
||||
public static void a(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
|
||||
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-4940: no empty loot
|
||||
double d0 = entityliving.getHeadY() - 0.30000001192092896D;
|
||||
EntityItem entityitem = new EntityItem(entityliving.world, entityliving.locX(), d0, entityliving.locZ(), itemstack);
|
||||
EntityItem entityitem = new EntityItem(entityliving.level, entityliving.locX(), d0, entityliving.locZ(), itemstack);
|
||||
float f = 0.3F;
|
||||
@@ -87,12 +88,19 @@
|
||||
@@ -95,12 +96,19 @@
|
||||
vec3d1 = vec3d1.d().a(0.30000001192092896D);
|
||||
entityitem.setMot(vec3d1);
|
||||
entityitem.defaultPickupDelay();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(entityliving.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ entityitem.world.getServer().getPluginManager().callEvent(event);
|
||||
+ entityitem.level.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityliving.world.addEntity(entityitem);
|
||||
entityliving.level.addEntity(entityitem);
|
||||
}
|
||||
|
||||
public static SectionPosition a(WorldServer worldserver, SectionPosition sectionposition, int i) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
|
||||
@@ -24,7 +24,7 @@
|
||||
@@ -23,7 +23,7 @@
|
||||
public BehaviorWorkComposter() {}
|
||||
|
||||
@Override
|
||||
@@ -9,21 +9,21 @@
|
||||
Optional<GlobalPos> optional = entityvillager.getBehaviorController().getMemory(MemoryModuleType.JOB_SITE);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
@@ -43,7 +43,7 @@
|
||||
@@ -42,7 +42,7 @@
|
||||
BlockPosition blockposition = globalpos.getBlockPosition();
|
||||
|
||||
if ((Integer) iblockdata.get(BlockComposter.a) == 8) {
|
||||
- iblockdata = BlockComposter.d(iblockdata, (World) worldserver, blockposition);
|
||||
+ iblockdata = BlockComposter.d(iblockdata, (World) worldserver, blockposition, entityvillager); // CraftBukkit
|
||||
if ((Integer) iblockdata.get(BlockComposter.LEVEL) == 8) {
|
||||
- iblockdata = BlockComposter.d(iblockdata, worldserver, blockposition);
|
||||
+ iblockdata = BlockComposter.d(iblockdata, worldserver, blockposition, entityvillager); // CraftBukkit
|
||||
}
|
||||
|
||||
int i = 20;
|
||||
@@ -68,7 +68,7 @@
|
||||
@@ -67,7 +67,7 @@
|
||||
i -= k1;
|
||||
|
||||
for (int l1 = 0; l1 < k1; ++l1) {
|
||||
- iblockdata1 = BlockComposter.a(iblockdata1, worldserver, itemstack, blockposition);
|
||||
+ iblockdata1 = BlockComposter.a(iblockdata1, worldserver, itemstack, blockposition, entityvillager); // CraftBukkit
|
||||
if ((Integer) iblockdata1.get(BlockComposter.a) == 7) {
|
||||
if ((Integer) iblockdata1.get(BlockComposter.LEVEL) == 7) {
|
||||
this.a(worldserver, iblockdata, blockposition, iblockdata1);
|
||||
return;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
|
||||
@@ -71,6 +71,12 @@
|
||||
@@ -72,6 +72,12 @@
|
||||
}
|
||||
|
||||
if (this.a == this.f() && this.a(this.entity.world.getDifficulty())) {
|
||||
if (this.breakTime == this.f() && this.a(this.mob.level.getDifficulty())) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.entity, this.door).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.mob, this.doorPos).isCancelled()) {
|
||||
+ this.c();
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.entity.world.a(this.door, false);
|
||||
this.entity.world.triggerEffect(1021, this.door, 0);
|
||||
this.entity.world.triggerEffect(2001, this.door, Block.getCombinedId(this.entity.world.getType(this.door)));
|
||||
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)));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalEatTile.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalEatTile.java
|
||||
@@ -11,6 +11,10 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
@@ -12,6 +12,10 @@
|
||||
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@@ -10,24 +10,24 @@
|
||||
+
|
||||
public class PathfinderGoalEatTile extends PathfinderGoal {
|
||||
|
||||
private static final Predicate<IBlockData> a = BlockStatePredicate.a(Blocks.GRASS);
|
||||
@@ -63,7 +67,8 @@
|
||||
BlockPosition blockposition = this.b.getChunkCoordinates();
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -65,7 +69,8 @@
|
||||
BlockPosition blockposition = this.mob.getChunkCoordinates();
|
||||
|
||||
if (PathfinderGoalEatTile.a.test(this.c.getType(blockposition))) {
|
||||
- if (this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
if (PathfinderGoalEatTile.IS_TALL_GRASS.test(this.level.getType(blockposition))) {
|
||||
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ // CraftBukkit
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) {
|
||||
this.c.b(blockposition, false);
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.getBlockData(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
this.level.b(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -72,7 +77,8 @@
|
||||
@@ -75,7 +80,8 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
|
||||
if (this.c.getType(blockposition1).a(Blocks.GRASS_BLOCK)) {
|
||||
- if (this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
if (this.level.getType(blockposition1).a(Blocks.GRASS_BLOCK)) {
|
||||
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ // CraftBukkit
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) {
|
||||
this.c.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData()));
|
||||
this.c.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, 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);
|
||||
}
|
||||
|
||||
@@ -12,24 +12,24 @@
|
||||
+
|
||||
public class PathfinderGoalFollowOwner extends PathfinderGoal {
|
||||
|
||||
private final EntityTameableAnimal a;
|
||||
@@ -117,7 +123,18 @@
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
|
||||
@@ -121,7 +127,18 @@
|
||||
} else if (!this.a(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
- this.a.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, this.a.yaw, this.a.pitch);
|
||||
- this.tamable.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
+ // CraftBukkit start
|
||||
+ CraftEntity entity = this.a.getBukkitEntity();
|
||||
+ Location to = new Location(entity.getWorld(), (double) i + 0.5D, (double) j, (double) k + 0.5D, this.a.yaw, this.a.pitch);
|
||||
+ 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());
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to);
|
||||
+ this.a.world.getServer().getPluginManager().callEvent(event);
|
||||
+ this.tamable.level.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ to = event.getTo();
|
||||
+
|
||||
+ this.a.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ this.tamable.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ // CraftBukkit end
|
||||
this.e.o();
|
||||
this.navigation.o();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
+
|
||||
public class PathfinderGoalPanic extends PathfinderGoal {
|
||||
|
||||
protected final EntityCreature a;
|
||||
protected final EntityCreature mob;
|
||||
@@ -76,6 +80,12 @@
|
||||
|
||||
@Override
|
||||
public boolean b() {
|
||||
+ // CraftBukkit start - introduce a temporary timeout hack until this is fixed properly
|
||||
+ if ((this.a.ticksLived - this.a.hurtTimestamp) > 100) {
|
||||
+ this.a.setLastDamager((EntityLiving) null);
|
||||
+ if ((this.mob.tickCount - this.mob.lastHurtByMobTimestamp) > 100) {
|
||||
+ this.mob.setLastDamager((EntityLiving) null);
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return !this.a.getNavigation().m();
|
||||
return !this.mob.getNavigation().m();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java
|
||||
@@ -20,6 +20,11 @@
|
||||
@@ -21,6 +21,11 @@
|
||||
import net.minecraft.world.level.chunk.IChunkAccess;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
+
|
||||
public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
|
||||
|
||||
private final Block g;
|
||||
@@ -98,6 +103,14 @@
|
||||
private final Block blockToRemove;
|
||||
@@ -100,6 +105,14 @@
|
||||
}
|
||||
|
||||
if (this.i > 60) {
|
||||
if (this.ticksSinceReachedGoal > 60) {
|
||||
+ // CraftBukkit start - Step on eggs
|
||||
+ EntityInteractEvent event = new EntityInteractEvent(this.entity.getBukkitEntity(), CraftBlock.at(world, blockposition1));
|
||||
+ EntityInteractEvent event = new EntityInteractEvent(this.removerMob.getBukkitEntity(), CraftBlock.at(world, blockposition1));
|
||||
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -22,7 +22,7 @@
|
||||
@Override
|
||||
public boolean a() {
|
||||
if (!this.entity.isTamed()) {
|
||||
if (!this.mob.isTamed()) {
|
||||
- return false;
|
||||
+ return this.entity.isWillSit() && this.entity.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
||||
} else if (this.entity.aH()) {
|
||||
+ return this.mob.isWillSit() && this.mob.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
||||
} else if (this.mob.aO()) {
|
||||
return false;
|
||||
} else if (!this.entity.isOnGround()) {
|
||||
} else if (!this.mob.isOnGround()) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
|
||||
@@ -62,7 +62,8 @@
|
||||
int i = this.entity.getTemper();
|
||||
int j = this.entity.getMaxDomestication();
|
||||
int i = this.horse.getTemper();
|
||||
int j = this.horse.getMaxDomestication();
|
||||
|
||||
- if (j > 0 && this.entity.getRandom().nextInt(j) < i) {
|
||||
- if (j > 0 && this.horse.getRandom().nextInt(j) < i) {
|
||||
+ // CraftBukkit - fire EntityTameEvent
|
||||
+ if (j > 0 && this.entity.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.entity, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.entity.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) {
|
||||
this.entity.i((EntityHuman) entity);
|
||||
+ 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);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
|
||||
@@ -11,6 +11,13 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -8,6 +8,13 @@
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.item.crafting.RecipeItemStack;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -13,32 +13,29 @@
|
||||
+
|
||||
public class PathfinderGoalTempt extends PathfinderGoal {
|
||||
|
||||
private static final PathfinderTargetCondition c = (new PathfinderTargetCondition()).a(10.0D).a().b().d().c();
|
||||
@@ -21,7 +28,7 @@
|
||||
private double g;
|
||||
private double h;
|
||||
private double i;
|
||||
- protected EntityHuman target;
|
||||
+ protected EntityLiving target; // CraftBukkit
|
||||
private int j;
|
||||
private boolean k;
|
||||
private final RecipeItemStack l;
|
||||
@@ -49,7 +56,17 @@
|
||||
private static final PathfinderTargetCondition TEMP_TARGETING = PathfinderTargetCondition.b().a(10.0D).d();
|
||||
@@ -19,7 +26,7 @@
|
||||
private double pz;
|
||||
private double pRotX;
|
||||
private double pRotY;
|
||||
- protected EntityHuman player;
|
||||
+ protected EntityLiving player; // CraftBukkit
|
||||
private int calmDown;
|
||||
private boolean isRunning;
|
||||
private final RecipeItemStack items;
|
||||
@@ -41,6 +48,15 @@
|
||||
return false;
|
||||
} else {
|
||||
this.target = this.a.world.a(PathfinderGoalTempt.c, (EntityLiving) this.a);
|
||||
- return this.target == null ? false : this.a(this.target.getItemInMainHand()) || this.a(this.target.getItemInOffHand());
|
||||
this.player = this.mob.level.a(this.targetingConditions, (EntityLiving) this.mob);
|
||||
+ // CraftBukkit start
|
||||
+ boolean tempt = this.target == null ? false : this.a(this.target.getItemInMainHand()) || this.a(this.target.getItemInOffHand());
|
||||
+ if (tempt) {
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this.a, this.target, EntityTargetEvent.TargetReason.TEMPT);
|
||||
+ if (this.player != null) {
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this.mob, this.player, EntityTargetEvent.TargetReason.TEMPT);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ this.player = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+ return tempt;
|
||||
+ // CraftBukkit end
|
||||
return this.player != null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.a.setGoalTarget(this.b);
|
||||
+ this.a.setGoalTarget(this.b, org.bukkit.event.entity.EntityTargetEvent.TargetReason.DEFEND_VILLAGE, true); // CraftBukkit - reason
|
||||
- this.golem.setGoalTarget(this.potentialTarget);
|
||||
+ this.golem.setGoalTarget(this.potentialTarget, org.bukkit.event.entity.EntityTargetEvent.TargetReason.DEFEND_VILLAGE, true); // CraftBukkit - reason
|
||||
super.c();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalHurtByTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalHurtByTarget.java
|
||||
@@ -62,7 +62,7 @@
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.e.setGoalTarget(this.e.getLastDamager());
|
||||
+ this.e.setGoalTarget(this.e.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
|
||||
this.g = this.e.getGoalTarget();
|
||||
this.c = this.e.da();
|
||||
this.h = 300;
|
||||
@@ -109,6 +109,6 @@
|
||||
- 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();
|
||||
this.unseenMemoryTicks = 300;
|
||||
@@ -111,6 +111,6 @@
|
||||
}
|
||||
|
||||
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
|
||||
@@ -59,7 +59,7 @@
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.e.setGoalTarget(this.c);
|
||||
+ this.e.setGoalTarget(this.c, c instanceof EntityPlayer ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit - reason
|
||||
- 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.e.setGoalTarget(this.b);
|
||||
+ this.e.setGoalTarget(this.b, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit - reason
|
||||
EntityLiving entityliving = this.a.getOwner();
|
||||
- this.mob.setGoalTarget(this.ownerLastHurtBy);
|
||||
+ this.mob.setGoalTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit - reason
|
||||
EntityLiving entityliving = this.tameAnimal.getOwner();
|
||||
|
||||
if (entityliving != null) {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
- this.e.setGoalTarget(this.b);
|
||||
+ this.e.setGoalTarget(this.b, org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit - reason
|
||||
EntityLiving entityliving = this.a.getOwner();
|
||||
- this.mob.setGoalTarget(this.ownerLastHurt);
|
||||
+ this.mob.setGoalTarget(this.ownerLastHurt, org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit - reason
|
||||
EntityLiving entityliving = this.tameAnimal.getOwner();
|
||||
|
||||
if (entityliving != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalTarget.java
|
||||
@@ -13,6 +13,8 @@
|
||||
@@ -11,6 +11,8 @@
|
||||
import net.minecraft.world.level.pathfinder.PathPoint;
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
|
||||
@@ -8,22 +8,22 @@
|
||||
+
|
||||
public abstract class PathfinderGoalTarget extends PathfinderGoal {
|
||||
|
||||
protected final EntityInsentient e;
|
||||
@@ -70,7 +72,7 @@
|
||||
if (entityliving instanceof EntityHuman && ((EntityHuman) entityliving).abilities.isInvulnerable) {
|
||||
return false;
|
||||
} else {
|
||||
- this.e.setGoalTarget(entityliving);
|
||||
+ this.e.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit
|
||||
return true;
|
||||
private static final int EMPTY_REACH_CACHE = 0;
|
||||
@@ -68,7 +70,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.mob.setGoalTarget(entityliving);
|
||||
+ this.mob.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit
|
||||
return true;
|
||||
}
|
||||
@@ -91,7 +93,7 @@
|
||||
}
|
||||
@@ -88,7 +90,7 @@
|
||||
|
||||
@Override
|
||||
public void d() {
|
||||
- this.e.setGoalTarget((EntityLiving) null);
|
||||
+ this.e.setGoalTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||
this.g = null;
|
||||
- this.mob.setGoalTarget((EntityLiving) null);
|
||||
+ this.mob.setGoalTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
|
||||
this.targetMob = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user