geforkt von Mirrors/Paper
SPIGOT-6937: Ramming goat does not throw EntityTargetLivingEntityEvent
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
c48241fce5
Commit
8d542f0b21
@ -0,0 +1,68 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
|
||||
@@ -30,6 +30,13 @@
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PrepareRamNearestTarget<E extends EntityCreature> extends Behavior<E> {
|
||||
|
||||
public static final int TIME_OUT_DURATION = 160;
|
||||
@@ -62,6 +69,13 @@
|
||||
return this.ramTargeting.test(entitycreature, entityliving);
|
||||
});
|
||||
}).ifPresent((entityliving) -> {
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entitycreature, entityliving, (entityliving instanceof EntityPlayer) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+ if (event.isCancelled() || event.getTarget() == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
this.chooseRamPosition(entitycreature, entityliving);
|
||||
});
|
||||
}
|
||||
@@ -71,7 +85,7 @@
|
||||
|
||||
if (!behaviorcontroller.hasMemoryValue(MemoryModuleType.RAM_TARGET)) {
|
||||
worldserver.broadcastEntityEvent(e0, (byte) 59);
|
||||
- behaviorcontroller.setMemory(MemoryModuleType.RAM_COOLDOWN_TICKS, (Object) this.getCooldownOnFail.applyAsInt(e0));
|
||||
+ behaviorcontroller.setMemory(MemoryModuleType.RAM_COOLDOWN_TICKS, this.getCooldownOnFail.applyAsInt(e0)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,8 +96,8 @@
|
||||
|
||||
protected void tick(WorldServer worldserver, E e0, long i) {
|
||||
if (this.ramCandidate.isPresent()) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getStartPosition(), this.walkSpeed, 0)));
|
||||
- e0.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTarget(), true)));
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getStartPosition(), this.walkSpeed, 0))); // CraftBukkit - decompile error
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTarget(), true))); // CraftBukkit - decompile error
|
||||
boolean flag = !((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTarget().blockPosition().equals(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition());
|
||||
|
||||
if (flag) {
|
||||
@@ -100,7 +114,7 @@
|
||||
}
|
||||
|
||||
if (i - (Long) this.reachedRamPositionTimestamp.get() >= (long) this.ramPrepareTime) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.RAM_TARGET, (Object) this.getEdgeOfBlock(blockposition, ((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition()));
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.RAM_TARGET, this.getEdgeOfBlock(blockposition, ((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition())); // CraftBukkit - decompile error
|
||||
worldserver.playSound((EntityHuman) null, (Entity) e0, (SoundEffect) this.getPrepareRamSound.apply(e0), SoundCategory.HOSTILE, 1.0F, e0.getVoicePitch());
|
||||
this.ramCandidate = Optional.empty();
|
||||
}
|
||||
@@ -152,7 +166,7 @@
|
||||
}
|
||||
|
||||
NavigationAbstract navigationabstract = entitycreature.getNavigation();
|
||||
- Stream stream = list.stream();
|
||||
+ Stream<BlockPosition> stream = list.stream(); // CraftBukkit - decompile error
|
||||
BlockPosition blockposition1 = entitycreature.blockPosition();
|
||||
|
||||
Objects.requireNonNull(blockposition1);
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren