1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2024-12-15 11:15:41 +01:00
PaperMC/nms-patches/BehaviorUtil.patch

57 lines
3.5 KiB
Diff
Raw Normal View History

--- a/net/minecraft/server/BehaviorUtil.java
+++ b/net/minecraft/server/BehaviorUtil.java
2020-06-25 02:00:00 +02:00
@@ -38,7 +38,7 @@
}
2020-06-25 02:00:00 +02:00
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
}
2020-06-25 02:00:00 +02:00
private static void b(EntityLiving entityliving, EntityLiving entityliving1, float f) {
@@ -51,18 +51,19 @@
public static void a(EntityLiving entityliving, Entity entity, float f, int i) {
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entity, false), f, i);
2020-06-25 02:00:00 +02:00
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entity, true)));
- entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
2020-06-25 02:00:00 +02:00
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entity, true))); // CraftBukkit - decompile error
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
}
2020-06-25 02:00:00 +02:00
public static void a(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
}
public static void a(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-4940: no empty loot
2019-12-10 23:00:00 +01:00
double d0 = entityliving.getHeadY() - 0.30000001192092896D;
EntityItem entityitem = new EntityItem(entityliving.world, entityliving.locX(), d0, entityliving.locZ(), itemstack);
2020-06-25 02:00:00 +02:00
float f = 0.3F;
@@ -71,12 +72,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);
+ if (event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
entityliving.world.addEntity(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;
});