Increase diff stability

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-09-22 02:57:13 +10:00
parent 8a3c8cfcd4
commit e903417936
27 changed files with 162 additions and 170 deletions

View File

@@ -25,7 +25,10 @@
+ org.bukkit.Location location = getBukkitEntity().getLocation();
+ location.setPitch(player.getLocation().getPitch());
+ location.setYaw(player.getLocation().getYaw());
+
- if (entityendermite != null) {
- entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
- this.level().addFreshEntity(entityendermite);
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
+ Bukkit.getPluginManager().callEvent(teleEvent);
+
@@ -37,13 +40,6 @@
+ entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
+ this.level().addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
+ }
+ }
- if (entityendermite != null) {
- entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
- this.level().addFreshEntity(entityendermite);
+ if (entity.isPassenger()) {
+ entity.stopRiding();
}
- }
@@ -51,15 +47,19 @@
- entityplayer.dismountTo(this.getX(), this.getY(), this.getZ());
- } else {
- entity.teleportTo(this.getX(), this.getY(), this.getZ());
- }
+ if (entity.isPassenger()) {
+ entity.stopRiding();
+ }
- entity.resetFallDistance();
- entity.hurt(this.damageSources().fall(), 5.0F);
+ entityplayer.connection.teleport(teleEvent.getTo());
+ entity.resetFallDistance();
+ CraftEventFactory.entityDamage = this;
+ entity.hurt(this.damageSources().fall(), 5.0F);
+ CraftEventFactory.entityDamage = null;
}
-
- entity.resetFallDistance();
- entity.hurt(this.damageSources().fall(), 5.0F);
+ }
+ // CraftBukkit end
}
} else if (entity != null) {

View File

@@ -46,7 +46,10 @@
+ }
+ }
+ }
+
- while (iterator1.hasNext()) {
- MobEffect mobeffect = (MobEffect) iterator1.next();
- MobEffectList mobeffectlist = mobeffect.getEffect();
+ org.bukkit.event.entity.PotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPotionSplashEvent(this, affected);
+ if (!event.isCancelled() && list != null && !list.isEmpty()) { // do not process effects if there are no effects to process
+ Entity entity1 = this.getEffectSource();
@@ -54,11 +57,22 @@
+ if (!(victim instanceof CraftLivingEntity)) {
+ continue;
+ }
+
- if (mobeffectlist.isInstantenous()) {
- mobeffectlist.applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
- } else {
- int i = mobeffect.mapDuration((j) -> {
- return (int) (d1 * (double) j + 0.5D);
- });
- MobEffect mobeffect1 = new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
+ EntityLiving entityliving = ((CraftLivingEntity) victim).getHandle();
+ double d1 = event.getIntensity(victim);
+ // CraftBukkit end
+
- if (!mobeffect1.endsWithin(20)) {
- entityliving.addEffect(mobeffect1, entity1);
- }
- }
+ Iterator iterator1 = list.iterator();
+
+ while (iterator1.hasNext()) {
@@ -80,23 +94,7 @@
+ return (int) (d1 * (double) j + 0.5D);
+ });
+ MobEffect mobeffect1 = new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
- while (iterator1.hasNext()) {
- MobEffect mobeffect = (MobEffect) iterator1.next();
- MobEffectList mobeffectlist = mobeffect.getEffect();
-
- if (mobeffectlist.isInstantenous()) {
- mobeffectlist.applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
- } else {
- int i = mobeffect.mapDuration((j) -> {
- return (int) (d1 * (double) j + 0.5D);
- });
- MobEffect mobeffect1 = new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
-
- if (!mobeffect1.endsWithin(20)) {
- entityliving.addEffect(mobeffect1, entity1);
- }
- }
+
+ if (!mobeffect1.endsWithin(20)) {
+ entityliving.addEffect(mobeffect1, entity1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
}

View File

@@ -1,12 +1,12 @@
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
@@ -60,8 +60,21 @@
@@ -60,7 +60,20 @@
this.finalTarget = entity;
this.currentMoveDirection = EnumDirection.UP;
this.selectNextMoveDirection(enumdirection_enumaxis);
+ projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
}
+ }
+
+ // CraftBukkit start
+ public Entity getTarget() {
+ return this.finalTarget;
@@ -16,12 +16,11 @@
+ this.finalTarget = e;
+ this.currentMoveDirection = EnumDirection.UP;
+ this.selectNextMoveDirection(EnumDirection.EnumAxis.X);
+ }
}
+ // CraftBukkit end
+
@Override
public SoundCategory getSoundSource() {
return SoundCategory.HOSTILE;
@@ -225,7 +238,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);