SkeletonHorse Additions

This commit is contained in:
BillyGalbreath
2018-07-27 22:36:31 -05:00
parent c0a3a0d12c
commit da011362dc
3 changed files with 60 additions and 5 deletions

View File

@@ -1,15 +1,29 @@
--- a/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
+++ b/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
@@ -27,7 +27,7 @@
@@ -20,6 +20,7 @@
public class SkeletonTrapGoal extends Goal {
private final SkeletonHorse horse;
+ private java.util.List<org.bukkit.entity.HumanEntity> eligiblePlayers; // Paper
public SkeletonTrapGoal(SkeletonHorse skeletonHorse) {
this.horse = skeletonHorse;
@@ -27,12 +28,13 @@
@Override
public boolean canUse() {
- return this.horse.level().hasNearbyAlivePlayer(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D);
+ return this.horse.level().hasNearbyAlivePlayerThatAffectsSpawning(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D); // Paper - Affects Spawning API
+ return !(eligiblePlayers = this.horse.level().findNearbyBukkitPlayers(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D, net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING)).isEmpty(); // Paper - Affects Spawning API & SkeletonHorseTrapEvent
}
@Override
@@ -43,12 +43,12 @@
public void tick() {
ServerLevel worldserver = (ServerLevel) this.horse.level();
+ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.horse.getBukkitEntity(), eligiblePlayers).callEvent()) return; // Paper
DifficultyInstance difficultydamagescaler = worldserver.getCurrentDifficultyAt(this.horse.blockPosition());
this.horse.setTrap(false);
@@ -43,12 +45,12 @@
if (entitylightning != null) {
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
entitylightning.setVisualOnly(true);
@@ -24,7 +38,7 @@
for (int i = 0; i < 3; ++i) {
AbstractHorse entityhorseabstract = this.createHorse(difficultydamagescaler);
@@ -59,7 +59,7 @@
@@ -59,7 +61,7 @@
if (entityskeleton1 != null) {
entityskeleton1.startRiding(entityhorseabstract);
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));