@@ -3,9 +3,9 @@
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
@Override
|
||||
public double a(double d0) {
|
||||
+ if (d0 != d0) return getDefault(); // CraftBukkit
|
||||
public double sanitizeValue(double d0) {
|
||||
+ if (d0 != d0) return getDefaultValue(); // CraftBukkit
|
||||
+
|
||||
d0 = MathHelper.a(d0, this.minValue, this.maxValue);
|
||||
d0 = MathHelper.clamp(d0, this.minValue, this.maxValue);
|
||||
return d0;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,3 @@
|
||||
package net.minecraft.world.entity.ai.attributes;
|
||||
|
||||
import net.minecraft.core.IRegistry;
|
||||
@@ -21,6 +22,6 @@
|
||||
public GenericAttributes() {}
|
||||
|
||||
private static AttributeBase a(String s, AttributeBase attributebase) {
|
||||
- return (AttributeBase) IRegistry.a(IRegistry.ATTRIBUTE, s, (Object) attributebase);
|
||||
+ return (AttributeBase) IRegistry.a(IRegistry.ATTRIBUTE, s, attributebase); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,18 @@
|
||||
@@ -77,6 +83,17 @@
|
||||
}
|
||||
|
||||
protected void a(E e0) {
|
||||
protected void clearAttackTarget(E e0) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityLiving old = e0.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (event.getTarget() != null) {
|
||||
+ e0.getBehaviorController().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.onTargetErased.accept(e0);
|
||||
e0.getBehaviorController().removeMemory(MemoryModuleType.ATTACK_TARGET);
|
||||
e0.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
|
||||
}
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
@@ -38,13 +45,21 @@
|
||||
}
|
||||
|
||||
protected void a(WorldServer worldserver, E e0, long i) {
|
||||
protected void start(WorldServer worldserver, E e0, long i) {
|
||||
- ((Optional) this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> {
|
||||
+ (this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> { // CraftBukkit - decompile error
|
||||
this.a(e0, entityliving);
|
||||
this.setAttackTarget(e0, entityliving);
|
||||
});
|
||||
}
|
||||
|
||||
private void a(E e0, EntityLiving entityliving) {
|
||||
- e0.getBehaviorController().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
|
||||
private void setAttackTarget(E e0, EntityLiving entityliving) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, entityliving, (entityliving instanceof EntityPlayer) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+ if (event.isCancelled()) {
|
||||
@@ -34,7 +34,7 @@
|
||||
+ entityliving = (event.getTarget() != null) ? ((CraftLivingEntity) event.getTarget()).getHandle() : null;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ e0.getBehaviorController().setMemory(MemoryModuleType.ATTACK_TARGET, entityliving); // CraftBukkit - decompile error
|
||||
e0.getBehaviorController().removeMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, entityliving); // CraftBukkit - decompile error
|
||||
e0.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,27 +14,27 @@
|
||||
|
||||
public BehaviorCareer() {
|
||||
@@ -29,7 +35,7 @@
|
||||
GlobalPos globalpos = (GlobalPos) entityvillager.getBehaviorController().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
|
||||
GlobalPos globalpos = (GlobalPos) entityvillager.getBrain().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
|
||||
|
||||
entityvillager.getBehaviorController().removeMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.JOB_SITE, (Object) globalpos);
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.JOB_SITE, globalpos); // CraftBukkit - decompile error
|
||||
worldserver.broadcastEntityEffect(entityvillager, (byte) 14);
|
||||
entityvillager.getBrain().eraseMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.JOB_SITE, (Object) globalpos);
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.JOB_SITE, globalpos); // CraftBukkit - decompile error
|
||||
worldserver.broadcastEntityEvent(entityvillager, (byte) 14);
|
||||
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
|
||||
MinecraftServer minecraftserver = worldserver.getMinecraftServer();
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
@@ -41,7 +47,14 @@
|
||||
return villagerprofession.b() == villageplacetype;
|
||||
return villagerprofession.getJobPoiType() == villageplacetype;
|
||||
}).findFirst();
|
||||
}).ifPresent((villagerprofession) -> {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(villagerprofession));
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(villagerprofession));
|
||||
+ // CraftBukkit start - Fire VillagerCareerChangeEvent where Villager gets employed
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(villagerprofession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.c(worldserver);
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,54 +2,54 @@
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
|
||||
@@ -80,8 +80,8 @@
|
||||
|
||||
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
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
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.aboveFarmlandPos)));
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1)));
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.aboveFarmlandPos))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
@@ -101,7 +101,11 @@
|
||||
Block block1 = worldserver.getType(this.aboveFarmlandPos.down()).getBlock();
|
||||
Block block1 = worldserver.getBlockState(this.aboveFarmlandPos.below()).getBlock();
|
||||
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata)) {
|
||||
- worldserver.a(this.aboveFarmlandPos, true, entityvillager);
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isMaxAge(iblockdata)) {
|
||||
- worldserver.destroyBlock(this.aboveFarmlandPos, true, entityvillager);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ worldserver.a(this.aboveFarmlandPos, true, entityvillager);
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ worldserver.destroyBlock(this.aboveFarmlandPos, true, entityvillager);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.canPlant()) {
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.hasFarmSeeds()) {
|
||||
@@ -112,19 +116,28 @@
|
||||
boolean flag = false;
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ Block planted = null;
|
||||
if (itemstack.a(Items.WHEAT_SEEDS)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.WHEAT.getBlockData(), 3);
|
||||
if (itemstack.is(Items.WHEAT_SEEDS)) {
|
||||
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.WHEAT.defaultBlockState(), 3);
|
||||
+ planted = Blocks.WHEAT;
|
||||
flag = true;
|
||||
} else if (itemstack.a(Items.POTATO)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.POTATOES.getBlockData(), 3);
|
||||
} else if (itemstack.is(Items.POTATO)) {
|
||||
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.POTATOES.defaultBlockState(), 3);
|
||||
+ planted = Blocks.POTATOES;
|
||||
flag = true;
|
||||
} else if (itemstack.a(Items.CARROT)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.CARROTS.getBlockData(), 3);
|
||||
} else if (itemstack.is(Items.CARROT)) {
|
||||
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.CARROTS.defaultBlockState(), 3);
|
||||
+ planted = Blocks.CARROTS;
|
||||
flag = true;
|
||||
} else if (itemstack.a(Items.BEETROOT_SEEDS)) {
|
||||
- worldserver.setTypeAndData(this.aboveFarmlandPos, Blocks.BEETROOTS.getBlockData(), 3);
|
||||
} else if (itemstack.is(Items.BEETROOT_SEEDS)) {
|
||||
- worldserver.setBlock(this.aboveFarmlandPos, Blocks.BEETROOTS.defaultBlockState(), 3);
|
||||
+ planted = Blocks.BEETROOTS;
|
||||
flag = true;
|
||||
}
|
||||
+
|
||||
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, planted.getBlockData()).isCancelled()) {
|
||||
+ worldserver.setTypeAndData(this.aboveFarmlandPos, planted.getBlockData(), 3);
|
||||
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, planted.defaultBlockState()).isCancelled()) {
|
||||
+ worldserver.setBlock(this.aboveFarmlandPos, planted.defaultBlockState(), 3);
|
||||
+ } else {
|
||||
+ flag = false;
|
||||
+ }
|
||||
@@ -58,13 +58,13 @@
|
||||
|
||||
if (flag) {
|
||||
@@ -143,8 +156,8 @@
|
||||
this.aboveFarmlandPos = this.a(worldserver);
|
||||
this.aboveFarmlandPos = this.getValidFarmland(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
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1)));
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.aboveFarmlandPos)));
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.aboveFarmlandPos), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.aboveFarmlandPos))); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -69,6 +69,13 @@
|
||||
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
|
||||
|
||||
if (!blockdoor.h(iblockdata)) {
|
||||
if (!blockdoor.isOpen(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.level, blockposition));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -11,13 +11,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor.setDoor(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
blockdoor.setOpen(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
}
|
||||
|
||||
@@ -82,6 +89,13 @@
|
||||
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
|
||||
|
||||
if (!blockdoor1.h(iblockdata1)) {
|
||||
if (!blockdoor1.isOpen(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.level, blockposition1));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -25,18 +25,18 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor1.setDoor(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
this.c(worldserver, entityliving, blockposition1);
|
||||
blockdoor1.setOpen(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
this.rememberDoorToClose(worldserver, entityliving, blockposition1);
|
||||
}
|
||||
@@ -130,7 +144,7 @@
|
||||
private static boolean a(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController();
|
||||
private static boolean areOtherMobsComingThroughDoor(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBrain();
|
||||
|
||||
- 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();
|
||||
- return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> {
|
||||
+ return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : (behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
return entityliving1.getType() == entityliving.getType();
|
||||
}).filter((entityliving1) -> {
|
||||
return blockposition.a((IPosition) entityliving1.getPositionVector(), 2.0D);
|
||||
return blockposition.closerThan((IPosition) entityliving1.position(), 2.0D);
|
||||
@@ -172,7 +186,7 @@
|
||||
if (behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).isPresent()) {
|
||||
((Set) behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).get()).add(globalpos);
|
||||
|
||||
@@ -4,27 +4,27 @@
|
||||
if (entityvillager2 == null) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
- entityvillager.setAgeRaw(6000);
|
||||
- entityvillager1.setAgeRaw(6000);
|
||||
- entityvillager.setAge(6000);
|
||||
- entityvillager1.setAge(6000);
|
||||
+ // CraftBukkit start - call EntityBreedEvent
|
||||
entityvillager2.setAgeRaw(-24000);
|
||||
entityvillager2.setPositionRotation(entityvillager.locX(), entityvillager.locY(), entityvillager.locZ(), 0.0F, 0.0F);
|
||||
- worldserver.addAllEntities(entityvillager2);
|
||||
entityvillager2.setAge(-24000);
|
||||
entityvillager2.moveTo(entityvillager.getX(), entityvillager.getY(), entityvillager.getZ(), 0.0F, 0.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(entityvillager2);
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityvillager2, entityvillager, entityvillager1, null, null, 0).isCancelled()) {
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ entityvillager.setAgeRaw(6000);
|
||||
+ entityvillager1.setAgeRaw(6000);
|
||||
+ worldserver.addAllEntities(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
worldserver.broadcastEntityEffect(entityvillager2, (byte) 12);
|
||||
+ entityvillager.setAge(6000);
|
||||
+ entityvillager1.setAge(6000);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
worldserver.broadcastEntityEvent(entityvillager2, (byte) 12);
|
||||
return Optional.of(entityvillager2);
|
||||
}
|
||||
@@ -125,6 +130,6 @@
|
||||
private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
|
||||
GlobalPos globalpos = GlobalPos.create(worldserver.getDimensionKey(), blockposition);
|
||||
private void giveBedToChild(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
|
||||
GlobalPos globalpos = GlobalPos.of(worldserver.dimension(), blockposition);
|
||||
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, (Object) globalpos);
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, globalpos); // CraftBukkit - decompile error
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.HOME, (Object) globalpos);
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.HOME, globalpos); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
@@ -21,7 +27,14 @@
|
||||
}
|
||||
|
||||
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(VillagerProfession.NONE));
|
||||
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(VillagerProfession.NONE));
|
||||
+ // CraftBukkit start
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.c(worldserver);
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
@@ -62,7 +62,7 @@
|
||||
@@ -61,7 +61,7 @@
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entityliving1, true)));
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entityliving1, true))); // CraftBukkit - decompile error
|
||||
public static void lookAtEntity(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entityliving1, true)));
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entityliving1, true))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static void b(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -75,18 +75,19 @@
|
||||
public static void a(EntityLiving entityliving, Entity entity, float f, int i) {
|
||||
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -74,18 +74,19 @@
|
||||
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, Entity entity, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entity, false), f, i);
|
||||
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entity, true)));
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entity, true))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entity, true)));
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entity, true))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, BlockPosition blockposition, float f, int i) {
|
||||
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, BlockPosition blockposition, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorTarget(blockposition), f, i);
|
||||
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(blockposition)));
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(blockposition))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(blockposition)));
|
||||
- entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(blockposition))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBrain().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
|
||||
public static void throwItem(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.level, entityliving.locX(), d0, entityliving.locZ(), itemstack);
|
||||
double d0 = entityliving.getEyeY() - 0.30000001192092896D;
|
||||
EntityItem entityitem = new EntityItem(entityliving.level, entityliving.getX(), d0, entityliving.getZ(), itemstack);
|
||||
float f = 0.3F;
|
||||
@@ -95,12 +96,19 @@
|
||||
vec3d1 = vec3d1.d().a(0.30000001192092896D);
|
||||
entityitem.setMot(vec3d1);
|
||||
entityitem.defaultPickupDelay();
|
||||
@@ -94,12 +95,19 @@
|
||||
vec3d1 = vec3d1.normalize().scale(0.30000001192092896D);
|
||||
entityitem.setDeltaMovement(vec3d1);
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(entityliving.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -44,13 +44,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityliving.level.addEntity(entityitem);
|
||||
entityliving.level.addFreshEntity(entityitem);
|
||||
}
|
||||
|
||||
public static SectionPosition a(WorldServer worldserver, SectionPosition sectionposition, int i) {
|
||||
int j = worldserver.b(sectionposition);
|
||||
- Stream stream = SectionPosition.a(sectionposition, i).filter((sectionposition1) -> {
|
||||
+ Stream<SectionPosition> stream = SectionPosition.a(sectionposition, i).filter((sectionposition1) -> { // CraftBukkit - decompile error
|
||||
return worldserver.b(sectionposition1) < j;
|
||||
public static SectionPosition findSectionClosestToVillage(WorldServer worldserver, SectionPosition sectionposition, int i) {
|
||||
int j = worldserver.sectionsToVillage(sectionposition);
|
||||
- Stream stream = SectionPosition.cube(sectionposition, i).filter((sectionposition1) -> {
|
||||
+ Stream<SectionPosition> stream = SectionPosition.cube(sectionposition, i).filter((sectionposition1) -> { // CraftBukkit - decompile error
|
||||
return worldserver.sectionsToVillage(sectionposition1) < j;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
|
||||
@@ -23,7 +23,7 @@
|
||||
public BehaviorWorkComposter() {}
|
||||
|
||||
@Override
|
||||
- protected void a(WorldServer worldserver, EntityVillager entityvillager) {
|
||||
+ protected void doWork(WorldServer worldserver, EntityVillager entityvillager) { // PAIL
|
||||
Optional<GlobalPos> optional = entityvillager.getBehaviorController().getMemory(MemoryModuleType.JOB_SITE);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
@@ -42,7 +42,7 @@
|
||||
BlockPosition blockposition = globalpos.getBlockPosition();
|
||||
BlockPosition blockposition = globalpos.pos();
|
||||
|
||||
if ((Integer) iblockdata.get(BlockComposter.LEVEL) == 8) {
|
||||
- iblockdata = BlockComposter.d(iblockdata, worldserver, blockposition);
|
||||
+ iblockdata = BlockComposter.d(iblockdata, worldserver, blockposition, entityvillager); // CraftBukkit
|
||||
if ((Integer) iblockdata.getValue(BlockComposter.LEVEL) == 8) {
|
||||
- iblockdata = BlockComposter.extractProduce(iblockdata, worldserver, blockposition);
|
||||
+ iblockdata = BlockComposter.extractProduce(iblockdata, worldserver, blockposition, entityvillager); // CraftBukkit
|
||||
}
|
||||
|
||||
int i = 20;
|
||||
@@ -22,8 +13,8 @@
|
||||
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.LEVEL) == 7) {
|
||||
this.a(worldserver, iblockdata, blockposition, iblockdata1);
|
||||
- iblockdata1 = BlockComposter.insertItem(iblockdata1, worldserver, itemstack, blockposition);
|
||||
+ iblockdata1 = BlockComposter.insertItem(iblockdata1, worldserver, itemstack, blockposition, entityvillager); // CraftBukkit
|
||||
if ((Integer) iblockdata1.getValue(BlockComposter.LEVEL) == 7) {
|
||||
this.spawnComposterFillEffects(worldserver, iblockdata, blockposition, iblockdata1);
|
||||
return;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/ai/village/VillageSiege.java
|
||||
+++ b/net/minecraft/world/entity/ai/village/VillageSiege.java
|
||||
@@ -123,7 +123,7 @@
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
entityzombie.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
- worldserver.addAllEntities(entityzombie);
|
||||
+ worldserver.addAllEntities(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit
|
||||
entityzombie.moveTo(vec3d.x, vec3d.y, vec3d.z, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(entityzombie);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user