Add entity knockback events
- EntityKnockbackEvent - EntityPushedByEntityAttackEvent - EntityKnockbackByEntityEvent Co-authored-by: aerulion <aerulion@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
@@ -161,23 +161,24 @@
|
||||
}
|
||||
|
||||
public void onEquipItem(EquipmentSlot slot, ItemStack oldStack, ItemStack newStack) {
|
||||
- if (!this.level().isClientSide() && !this.isSpectator()) {
|
||||
- boolean flag = newStack.isEmpty() && oldStack.isEmpty();
|
||||
+ // CraftBukkit start
|
||||
+ this.onEquipItem(slot, oldStack, newStack, false);
|
||||
+ }
|
||||
+
|
||||
+ public void onEquipItem(EquipmentSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1, boolean silent) {
|
||||
+ // CraftBukkit end
|
||||
if (!this.level().isClientSide() && !this.isSpectator()) {
|
||||
- boolean flag = newStack.isEmpty() && oldStack.isEmpty();
|
||||
+ boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
|
||||
|
||||
- if (!flag && !ItemStack.isSameItemSameComponents(oldStack, newStack) && !this.firstTick) {
|
||||
- Equippable equippable = (Equippable) newStack.get(DataComponents.EQUIPPABLE);
|
||||
+ if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) {
|
||||
+ Equippable equippable = (Equippable) itemstack1.get(DataComponents.EQUIPPABLE);
|
||||
+ public void onEquipItem(EquipmentSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1, boolean silent) {
|
||||
+ // CraftBukkit end
|
||||
+ if (!this.level().isClientSide() && !this.isSpectator()) {
|
||||
+ boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
|
||||
|
||||
- if (!this.isSilent() && equippable != null && slot == equippable.slot()) {
|
||||
- this.level().playSeededSound((Player) null, this.getX(), this.getY(), this.getZ(), equippable.equipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
||||
+ if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) {
|
||||
+ Equippable equippable = (Equippable) itemstack1.get(DataComponents.EQUIPPABLE);
|
||||
+
|
||||
+ if (!this.isSilent() && equippable != null && enumitemslot == equippable.slot() && !silent) { // CraftBukkit
|
||||
+ this.level().playSeededSound((net.minecraft.world.entity.player.Player) null, this.getX(), this.getY(), this.getZ(), equippable.equipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
||||
}
|
||||
@@ -238,10 +239,13 @@
|
||||
if (nbt.contains("attributes", 9) && this.level() != null && !this.level().isClientSide) {
|
||||
this.getAttributes().load(nbt.getList("attributes", 10));
|
||||
}
|
||||
@@ -781,6 +855,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -778,8 +852,19 @@
|
||||
if (mobeffect != null) {
|
||||
this.activeEffects.put(mobeffect.getEffect(), mobeffect);
|
||||
}
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (nbt.contains("Bukkit.MaxHealth")) {
|
||||
+ Tag nbtbase = nbt.get("Bukkit.MaxHealth");
|
||||
@@ -249,13 +253,12 @@
|
||||
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(((FloatTag) nbtbase).getAsDouble());
|
||||
+ } else if (nbtbase.getId() == 3) {
|
||||
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(((IntTag) nbtbase).getAsDouble());
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
if (nbt.contains("Health", 99)) {
|
||||
this.setHealth(nbt.getFloat("Health"));
|
||||
}
|
||||
@@ -792,6 +877,7 @@
|
||||
String s = nbt.getString("Team");
|
||||
Scoreboard scoreboard = this.level().getScoreboard();
|
||||
@@ -651,7 +654,7 @@
|
||||
}
|
||||
|
||||
- this.knockback(0.4000000059604645D, d0, d1);
|
||||
+ this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? EntityKnockbackEvent.KnockbackCause.DAMAGE : EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
+ this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE : io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -693,7 +696,7 @@
|
||||
|
||||
protected void blockedByShield(LivingEntity target) {
|
||||
- target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ());
|
||||
+ target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), null, EntityKnockbackEvent.KnockbackCause.SHIELD_BLOCK); // CraftBukkit
|
||||
+ target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events
|
||||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource source) {
|
||||
@@ -813,7 +816,7 @@
|
||||
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {}
|
||||
|
||||
public long getLootTableSeed() {
|
||||
@@ -1612,19 +1916,31 @@
|
||||
@@ -1612,19 +1916,35 @@
|
||||
}
|
||||
|
||||
public void knockback(double strength, double x, double z) {
|
||||
@@ -821,10 +824,10 @@
|
||||
- if (strength > 0.0D) {
|
||||
- this.hasImpulse = true;
|
||||
+ // CraftBukkit start - EntityKnockbackEvent
|
||||
+ this.knockback(strength, x, z, null, EntityKnockbackEvent.KnockbackCause.UNKNOWN);
|
||||
+ this.knockback(strength, x, z, null, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.UNKNOWN); // Paper - knockback events
|
||||
+ }
|
||||
+
|
||||
+ public void knockback(double d0, double d1, double d2, Entity attacker, EntityKnockbackEvent.KnockbackCause cause) {
|
||||
+ public void knockback(double d0, double d1, double d2, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause cause) { // Paper - knockback events
|
||||
+ d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
|
||||
+ if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
|
||||
+ //this.hasImpulse = true; // CraftBukkit - Move down
|
||||
@@ -841,23 +844,25 @@
|
||||
+ Vec3 vec3d1 = (new Vec3(d1, 0.0D, d2)).normalize().scale(d0);
|
||||
|
||||
- this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+ EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, cause, d0, vec3d1, vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+ // Paper start - knockback events
|
||||
+ Vec3 finalVelocity = new Vec3(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+ Vec3 diff = finalVelocity.subtract(vec3d);
|
||||
+ io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, attacker, cause, d0, diff);
|
||||
+ // Paper end - knockback events
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ this.hasImpulse = true;
|
||||
+ this.setDeltaMovement(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ());
|
||||
+ this.setDeltaMovement(vec3d.add(event.getKnockback().getX(), event.getKnockback().getY(), event.getKnockback().getZ())); // Paper - knockback events
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1681,8 +1997,22 @@
|
||||
|
||||
public LivingEntity.Fallsounds getFallSounds() {
|
||||
@@ -1683,6 +2003,20 @@
|
||||
return new LivingEntity.Fallsounds(SoundEvents.GENERIC_SMALL_FALL, SoundEvents.GENERIC_BIG_FALL);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Add delegate methods
|
||||
+ public SoundEvent getHurtSound0(DamageSource damagesource) {
|
||||
+ return this.getHurtSound(damagesource);
|
||||
@@ -865,8 +870,8 @@
|
||||
+
|
||||
+ public SoundEvent getDeathSound0() {
|
||||
+ return this.getDeathSound();
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public SoundEvent getFallDamageSound0(int fallHeight) {
|
||||
+ return this.getFallDamageSound(fallHeight);
|
||||
+ }
|
||||
@@ -875,7 +880,7 @@
|
||||
public Optional<BlockPos> getLastClimbablePos() {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
@@ -1757,9 +2087,14 @@
|
||||
@@ -1757,9 +2091,14 @@
|
||||
int i = this.calculateFallDamage(fallDistance, damageMultiplier);
|
||||
|
||||
if (i > 0) {
|
||||
@@ -891,7 +896,7 @@
|
||||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1830,7 +2165,7 @@
|
||||
@@ -1830,7 +2169,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource source, float amount) {
|
||||
if (!source.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
@@ -900,7 +905,7 @@
|
||||
amount = CombatRules.getDamageAfterAbsorb(this, amount, source, (float) this.getArmorValue(), (float) this.getAttributeValue(Attributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1841,7 +2176,8 @@
|
||||
@@ -1841,7 +2180,8 @@
|
||||
if (source.is(DamageTypeTags.BYPASSES_EFFECTS)) {
|
||||
return amount;
|
||||
} else {
|
||||
@@ -910,7 +915,7 @@
|
||||
int i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = amount * (float) j;
|
||||
@@ -1884,18 +2220,144 @@
|
||||
@@ -1884,18 +2224,144 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -922,10 +927,7 @@
|
||||
+ // CraftBukkit start
|
||||
+ private EntityDamageEvent handleEntityDamage(final DamageSource damagesource, float f) {
|
||||
+ float originalDamage = f;
|
||||
|
||||
- amount = Math.max(amount - this.getAbsorptionAmount(), 0.0F);
|
||||
- this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - amount));
|
||||
- float f2 = f1 - amount;
|
||||
+
|
||||
+ com.google.common.base.Function<Double, Double> freezing = new com.google.common.base.Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
@@ -937,7 +939,10 @@
|
||||
+ };
|
||||
+ float freezingModifier = freezing.apply((double) f).floatValue();
|
||||
+ f += freezingModifier;
|
||||
+
|
||||
|
||||
- amount = Math.max(amount - this.getAbsorptionAmount(), 0.0F);
|
||||
- this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - amount));
|
||||
- float f2 = f1 - amount;
|
||||
+ com.google.common.base.Function<Double, Double> hardHat = new com.google.common.base.Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
@@ -949,7 +954,7 @@
|
||||
+ };
|
||||
+ float hardHatModifier = hardHat.apply((double) f).floatValue();
|
||||
+ f += hardHatModifier;
|
||||
+
|
||||
|
||||
+ com.google.common.base.Function<Double, Double> blocking = new com.google.common.base.Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
@@ -983,7 +988,7 @@
|
||||
+ };
|
||||
+ float resistanceModifier = resistance.apply((double) f).floatValue();
|
||||
+ f += resistanceModifier;
|
||||
|
||||
+
|
||||
+ com.google.common.base.Function<Double, Double> magic = new com.google.common.base.Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
@@ -1064,7 +1069,7 @@
|
||||
|
||||
if (entity instanceof ServerPlayer) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) entity;
|
||||
@@ -1904,13 +2366,48 @@
|
||||
@@ -1904,13 +2370,48 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1117,27 +1122,28 @@
|
||||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1935,8 +2432,18 @@
|
||||
@@ -1935,9 +2436,19 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int stuckArrowCount) {
|
||||
- this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, stuckArrowCount);
|
||||
+ // CraftBukkit start
|
||||
+ this.setArrowCount(stuckArrowCount, false);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ public final void setArrowCount(int i, boolean flag) {
|
||||
+ ArrowBodyCountChangeEvent event = CraftEventFactory.callArrowBodyCountChangeEvent(this, this.getArrowCount(), i, flag);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, event.getNewAmount());
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(LivingEntity.DATA_STINGER_COUNT_ID);
|
||||
@@ -1999,7 +2506,7 @@
|
||||
}
|
||||
@@ -1999,7 +2510,7 @@
|
||||
this.playSound(soundeffect, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
|
||||
@@ -1146,7 +1152,7 @@
|
||||
this.setHealth(0.0F);
|
||||
this.die(this.damageSources().generic());
|
||||
}
|
||||
@@ -2182,6 +2689,12 @@
|
||||
@@ -2182,6 +2693,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
|
||||
|
||||
@@ -1159,7 +1165,7 @@
|
||||
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
|
||||
|
||||
public Iterable<ItemStack> getHandSlots() {
|
||||
@@ -2494,7 +3007,7 @@
|
||||
@@ -2494,7 +3011,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1168,7 +1174,7 @@
|
||||
Vec3 vec3d1 = this.getRiddenInput(controllingPlayer, movementInput);
|
||||
|
||||
this.tickRidden(controllingPlayer, vec3d1);
|
||||
@@ -2507,13 +3020,13 @@
|
||||
@@ -2507,13 +3024,13 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1185,7 +1191,7 @@
|
||||
return this.getSpeed();
|
||||
}
|
||||
|
||||
@@ -2571,7 +3084,7 @@
|
||||
@@ -2571,7 +3088,7 @@
|
||||
double d1 = Mth.clamp(motion.z, -0.15000000596046448D, 0.15000000596046448D);
|
||||
double d2 = Math.max(motion.y, -0.15000000596046448D);
|
||||
|
||||
@@ -1194,7 +1200,7 @@
|
||||
d2 = 0.0D;
|
||||
}
|
||||
|
||||
@@ -2586,7 +3099,7 @@
|
||||
@@ -2586,7 +3103,7 @@
|
||||
}
|
||||
|
||||
protected float getFlyingSpeed() {
|
||||
@@ -1203,7 +1209,7 @@
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
@@ -2634,7 +3147,7 @@
|
||||
@@ -2634,7 +3151,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1212,7 +1218,7 @@
|
||||
if (this.tickCount % 20 == 0) {
|
||||
this.getCombatTracker().recheckStatus();
|
||||
}
|
||||
@@ -2741,7 +3254,7 @@
|
||||
@@ -2741,7 +3258,7 @@
|
||||
this.elytraAnimationState.tick();
|
||||
}
|
||||
|
||||
@@ -1221,7 +1227,7 @@
|
||||
Map<EquipmentSlot, ItemStack> map = this.collectEquipmentChanges();
|
||||
|
||||
if (map != null) {
|
||||
@@ -2778,10 +3291,17 @@
|
||||
@@ -2778,10 +3295,17 @@
|
||||
throw new MatchException((String) null, (Throwable) null);
|
||||
}
|
||||
|
||||
@@ -1241,7 +1247,7 @@
|
||||
if (map == null) {
|
||||
map = Maps.newEnumMap(EquipmentSlot.class);
|
||||
}
|
||||
@@ -3000,7 +3520,7 @@
|
||||
@@ -3000,7 +3524,7 @@
|
||||
{
|
||||
LivingEntity entityliving = this.getControllingPassenger();
|
||||
|
||||
@@ -1250,7 +1256,7 @@
|
||||
if (this.isAlive()) {
|
||||
this.travelRidden(entityhuman, vec3d1);
|
||||
break label112;
|
||||
@@ -3063,6 +3583,7 @@
|
||||
@@ -3063,6 +3587,7 @@
|
||||
this.checkSlowFallDistance();
|
||||
if (!this.level().isClientSide) {
|
||||
if (!this.canGlide()) {
|
||||
@@ -1258,7 +1264,7 @@
|
||||
this.setSharedFlag(7, false);
|
||||
return;
|
||||
}
|
||||
@@ -3113,7 +3634,7 @@
|
||||
@@ -3113,7 +3638,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
if (!(world instanceof ServerLevel worldserver)) {
|
||||
@@ -1267,7 +1273,7 @@
|
||||
} else {
|
||||
List list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
|
||||
|
||||
@@ -3138,10 +3659,12 @@
|
||||
@@ -3138,10 +3663,12 @@
|
||||
}
|
||||
|
||||
Iterator iterator1 = list.iterator();
|
||||
@@ -1282,7 +1288,7 @@
|
||||
this.doPush(entity1);
|
||||
}
|
||||
}
|
||||
@@ -3305,15 +3828,22 @@
|
||||
@@ -3305,15 +3832,22 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
@@ -1307,7 +1313,7 @@
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
}
|
||||
@@ -3342,7 +3872,7 @@
|
||||
@@ -3342,7 +3876,7 @@
|
||||
}
|
||||
|
||||
public final void setAbsorptionAmount(float absorptionAmount) {
|
||||
@@ -1316,7 +1322,7 @@
|
||||
}
|
||||
|
||||
protected void internalSetAbsorptionAmount(float absorptionAmount) {
|
||||
@@ -3483,13 +4013,48 @@
|
||||
@@ -3483,13 +4017,48 @@
|
||||
this.releaseUsingItem();
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
@@ -1329,7 +1335,7 @@
|
||||
+ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
|
||||
+ event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Update client
|
||||
+ Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE);
|
||||
@@ -1340,7 +1346,7 @@
|
||||
+ entityPlayer.getBukkitEntity().updateScaledHealth();
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
+
|
||||
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level(), this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(this.level(), this);
|
||||
+ } else {
|
||||
+ itemstack = this.useItem.finishUsingItem(this.level(), this);
|
||||
@@ -1366,7 +1372,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3544,12 +4109,24 @@
|
||||
@@ -3544,12 +4113,24 @@
|
||||
if (this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||
Item item = this.useItem.getItem();
|
||||
|
||||
@@ -1392,7 +1398,7 @@
|
||||
public boolean isSuppressingSlidingDownLadder() {
|
||||
return this.isShiftKeyDown();
|
||||
}
|
||||
@@ -3568,12 +4145,18 @@
|
||||
@@ -3568,12 +4149,18 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
|
||||
@@ -1413,7 +1419,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
if (world.hasChunkAt(blockposition)) {
|
||||
@@ -3592,18 +4175,43 @@
|
||||
@@ -3592,18 +4179,43 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@@ -1425,7 +1431,7 @@
|
||||
+ this.setPos(d0, d6, d2);
|
||||
if (world.noCollision((Entity) this) && !world.containsAnyLiquid(this.getBoundingBox())) {
|
||||
flag1 = true;
|
||||
+ }
|
||||
}
|
||||
+ // now revert and call event if the teleport place is valid
|
||||
+ this.setPos(d3, d4, d5);
|
||||
+
|
||||
@@ -1445,7 +1451,7 @@
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -1461,7 +1467,7 @@
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
}
|
||||
|
||||
@@ -3613,7 +4221,7 @@
|
||||
@@ -3613,7 +4225,7 @@
|
||||
entitycreature.getNavigation().stop();
|
||||
}
|
||||
|
||||
@@ -1470,7 +1476,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3706,7 +4314,7 @@
|
||||
@@ -3706,7 +4318,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
@@ -1479,7 +1485,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
java.util.Objects.requireNonNull(world);
|
||||
@@ -3718,9 +4326,9 @@
|
||||
@@ -3718,9 +4330,9 @@
|
||||
|
||||
this.level().setBlock(blockposition, (BlockState) iblockdata.setValue(BedBlock.OCCUPIED, false), 3);
|
||||
Vec3 vec3d = (Vec3) BedBlock.findStandUpPosition(this.getType(), this.level(), blockposition, enumdirection, this.getYRot()).orElseGet(() -> {
|
||||
@@ -1491,7 +1497,7 @@
|
||||
});
|
||||
Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
float f = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
@@ -3740,7 +4348,7 @@
|
||||
@@ -3740,7 +4352,7 @@
|
||||
|
||||
@Nullable
|
||||
public Direction getBedOrientation() {
|
||||
@@ -1500,7 +1506,7 @@
|
||||
|
||||
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
|
||||
}
|
||||
@@ -3905,7 +4513,7 @@
|
||||
@@ -3905,7 +4517,7 @@
|
||||
public float maxUpStep() {
|
||||
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user