Remove Spigot timings
This commit is contained in:
@ -17,11 +17,10 @@
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.AxeItem;
|
||||
@@ -135,6 +136,32 @@
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
@@ -136,6 +137,30 @@
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
import org.slf4j.Logger;
|
||||
+
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.HashSet;
|
||||
@ -46,11 +45,10 @@
|
||||
+import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
|
||||
public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
@@ -174,7 +201,7 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -174,7 +199,7 @@
|
||||
public static final float DEFAULT_BABY_SCALE = 0.5F;
|
||||
public static final String ATTRIBUTES_FIELD = "attributes";
|
||||
public static final Predicate<LivingEntity> PLAYER_NOT_WEARING_DISGUISE_ITEM = (entityliving) -> {
|
||||
@ -59,7 +57,7 @@
|
||||
ItemStack itemstack = entityhuman.getItemBySlot(EquipmentSlot.HEAD);
|
||||
|
||||
return !itemstack.is(ItemTags.GAZE_DISGUISE_EQUIPMENT);
|
||||
@@ -210,7 +237,7 @@
|
||||
@@ -210,7 +235,7 @@
|
||||
public float yHeadRotO;
|
||||
public final ElytraAnimationState elytraAnimationState;
|
||||
@Nullable
|
||||
@ -68,7 +66,7 @@
|
||||
public int lastHurtByPlayerTime;
|
||||
protected boolean dead;
|
||||
protected int noActionTime;
|
||||
@@ -260,6 +287,27 @@
|
||||
@@ -260,7 +285,28 @@
|
||||
protected boolean skipDropExperience;
|
||||
private final EnumMap<EquipmentSlot, Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>>> activeLocationDependentEnchantments;
|
||||
protected float appliedScale;
|
||||
@ -80,7 +78,7 @@
|
||||
+ public Set<UUID> collidableExemptions = new HashSet<>();
|
||||
+ public boolean bukkitPickUpLoot;
|
||||
+ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
|
||||
+
|
||||
|
||||
+ @Override
|
||||
+ public float getBukkitYaw() {
|
||||
+ return this.getYHeadRot();
|
||||
@ -93,10 +91,11 @@
|
||||
+ ++this.noActionTime; // Above all the floats
|
||||
+ }
|
||||
+ // Spigot end
|
||||
|
||||
+
|
||||
protected LivingEntity(EntityType<? extends LivingEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -276,7 +324,9 @@
|
||||
this.lastHandItemStacks = NonNullList.withSize(2, ItemStack.EMPTY);
|
||||
@@ -276,7 +322,9 @@
|
||||
this.activeLocationDependentEnchantments = new EnumMap(EquipmentSlot.class);
|
||||
this.appliedScale = 1.0F;
|
||||
this.attributes = new AttributeMap(DefaultAttributes.getSupplier(type));
|
||||
@ -107,7 +106,7 @@
|
||||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.reapplyPosition();
|
||||
@@ -356,7 +406,13 @@
|
||||
@@ -356,7 +404,13 @@
|
||||
double d8 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d8);
|
||||
|
||||
@ -122,7 +121,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -402,7 +458,7 @@
|
||||
@@ -402,7 +456,7 @@
|
||||
}
|
||||
|
||||
if (this.isAlive()) {
|
||||
@ -131,7 +130,7 @@
|
||||
Level world1 = this.level();
|
||||
ServerLevel worldserver1;
|
||||
double d0;
|
||||
@@ -424,7 +480,7 @@
|
||||
@@ -424,7 +478,7 @@
|
||||
}
|
||||
|
||||
if (this.isEyeInFluid(FluidTags.WATER) && !this.level().getBlockState(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())).is(Blocks.BUBBLE_COLUMN)) {
|
||||
@ -140,7 +139,7 @@
|
||||
|
||||
if (flag1) {
|
||||
this.setAirSupply(this.decreaseAirSupply(this.getAirSupply()));
|
||||
@@ -573,7 +629,7 @@
|
||||
@@ -573,7 +627,7 @@
|
||||
++this.deathTime;
|
||||
if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
|
||||
this.level().broadcastEntityEvent(this, (byte) 60);
|
||||
@ -149,7 +148,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -629,7 +685,7 @@
|
||||
@@ -629,7 +683,7 @@
|
||||
return this.lastHurtByMobTimestamp;
|
||||
}
|
||||
|
||||
@ -158,26 +157,25 @@
|
||||
this.lastHurtByPlayer = attacking;
|
||||
this.lastHurtByPlayerTime = this.tickCount;
|
||||
}
|
||||
@@ -679,17 +735,23 @@
|
||||
@@ -679,17 +733,23 @@
|
||||
}
|
||||
|
||||
public void onEquipItem(EquipmentSlot slot, ItemStack oldStack, ItemStack newStack) {
|
||||
- if (!this.level().isClientSide() && !this.isSpectator()) {
|
||||
- boolean flag = newStack.isEmpty() && oldStack.isEmpty();
|
||||
-
|
||||
- if (!flag && !ItemStack.isSameItemSameComponents(oldStack, newStack) && !this.firstTick) {
|
||||
- Equippable equippable = (Equippable) newStack.get(DataComponents.EQUIPPABLE);
|
||||
+ // CraftBukkit start
|
||||
+ this.onEquipItem(slot, oldStack, newStack, false);
|
||||
+ }
|
||||
|
||||
- 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(oldStack, newStack) && !this.firstTick) {
|
||||
- Equippable equippable = (Equippable) newStack.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);
|
||||
+
|
||||
@ -190,7 +188,7 @@
|
||||
this.gameEvent(equippable != null ? GameEvent.EQUIP : GameEvent.UNEQUIP);
|
||||
}
|
||||
|
||||
@@ -699,17 +761,24 @@
|
||||
@@ -699,17 +759,24 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
@ -218,7 +216,7 @@
|
||||
this.brain.clearMemories();
|
||||
}
|
||||
|
||||
@@ -722,6 +791,7 @@
|
||||
@@ -722,6 +789,7 @@
|
||||
mobeffect.onMobRemoved(world, this, reason);
|
||||
}
|
||||
|
||||
@ -226,7 +224,7 @@
|
||||
this.activeEffects.clear();
|
||||
}
|
||||
|
||||
@@ -781,6 +851,17 @@
|
||||
@@ -781,6 +849,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,7 +242,7 @@
|
||||
if (nbt.contains("Health", 99)) {
|
||||
this.setHealth(nbt.getFloat("Health"));
|
||||
}
|
||||
@@ -819,9 +900,32 @@
|
||||
@@ -819,9 +898,32 @@
|
||||
|
||||
}
|
||||
|
||||
@ -277,7 +275,7 @@
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
Holder<MobEffect> holder = (Holder) iterator.next();
|
||||
@@ -831,6 +935,12 @@
|
||||
@@ -831,6 +933,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level().isClientSide) {
|
||||
@ -290,7 +288,7 @@
|
||||
iterator.remove();
|
||||
this.onEffectsRemoved(List.of(mobeffect));
|
||||
}
|
||||
@@ -841,6 +951,17 @@
|
||||
@@ -841,6 +949,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
@ -308,7 +306,7 @@
|
||||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -921,7 +1042,7 @@
|
||||
@@ -921,7 +1040,7 @@
|
||||
}
|
||||
|
||||
public boolean canAttack(LivingEntity target) {
|
||||
@ -317,7 +315,7 @@
|
||||
}
|
||||
|
||||
public boolean canBeSeenAsEnemy() {
|
||||
@@ -952,17 +1073,36 @@
|
||||
@@ -952,17 +1071,36 @@
|
||||
this.entityData.set(LivingEntity.DATA_EFFECT_PARTICLES, List.of());
|
||||
}
|
||||
|
||||
@ -358,7 +356,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -987,24 +1127,55 @@
|
||||
@@ -987,24 +1125,55 @@
|
||||
return this.addEffect(effect, (Entity) null);
|
||||
}
|
||||
|
||||
@ -422,7 +420,7 @@
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -1031,14 +1202,40 @@
|
||||
@@ -1031,14 +1200,40 @@
|
||||
return this.getType().is(EntityTypeTags.INVERTED_HEALING_AND_HARM);
|
||||
}
|
||||
|
||||
@ -465,7 +463,7 @@
|
||||
if (mobeffect != null) {
|
||||
this.onEffectsRemoved(List.of(mobeffect));
|
||||
return true;
|
||||
@@ -1142,20 +1339,55 @@
|
||||
@@ -1142,20 +1337,55 @@
|
||||
|
||||
}
|
||||
|
||||
@ -522,7 +520,7 @@
|
||||
this.entityData.set(LivingEntity.DATA_HEALTH_ID, Mth.clamp(health, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1167,7 +1399,7 @@
|
||||
@@ -1167,7 +1397,7 @@
|
||||
public boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
||||
if (this.isInvulnerableTo(world, source)) {
|
||||
return false;
|
||||
@ -531,7 +529,7 @@
|
||||
return false;
|
||||
} else if (source.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1182,10 +1414,11 @@
|
||||
@@ -1182,10 +1412,11 @@
|
||||
}
|
||||
|
||||
float f1 = amount;
|
||||
@ -545,7 +543,7 @@
|
||||
this.hurtCurrentlyUsedShield(amount);
|
||||
f2 = amount;
|
||||
amount = 0.0F;
|
||||
@@ -1202,15 +1435,26 @@
|
||||
@@ -1202,15 +1433,26 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@ -574,7 +572,7 @@
|
||||
this.walkAnimation.setSpeed(1.5F);
|
||||
if (Float.isNaN(amount) || Float.isInfinite(amount)) {
|
||||
amount = Float.MAX_VALUE;
|
||||
@@ -1218,18 +1462,27 @@
|
||||
@@ -1218,18 +1460,27 @@
|
||||
|
||||
boolean flag1 = true;
|
||||
|
||||
@ -606,7 +604,7 @@
|
||||
this.hurtDuration = 10;
|
||||
this.hurtTime = this.hurtDuration;
|
||||
}
|
||||
@@ -1243,7 +1496,7 @@
|
||||
@@ -1243,7 +1494,7 @@
|
||||
world.broadcastDamageEvent(this, source);
|
||||
}
|
||||
|
||||
@ -615,7 +613,7 @@
|
||||
this.markHurt();
|
||||
}
|
||||
|
||||
@@ -1263,7 +1516,7 @@
|
||||
@@ -1263,7 +1514,7 @@
|
||||
d1 = source.getSourcePosition().z() - this.getZ();
|
||||
}
|
||||
|
||||
@ -624,7 +622,7 @@
|
||||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -1282,7 +1535,7 @@
|
||||
@@ -1282,7 +1533,7 @@
|
||||
this.playHurtSound(source);
|
||||
}
|
||||
|
||||
@ -633,7 +631,7 @@
|
||||
|
||||
if (flag2) {
|
||||
this.lastDamageSource = source;
|
||||
@@ -1329,10 +1582,10 @@
|
||||
@@ -1329,10 +1580,10 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -646,7 +644,7 @@
|
||||
this.lastHurtByPlayerTime = 100;
|
||||
this.lastHurtByPlayer = entityhuman;
|
||||
return entityhuman;
|
||||
@@ -1342,8 +1595,8 @@
|
||||
@@ -1342,8 +1593,8 @@
|
||||
this.lastHurtByPlayerTime = 100;
|
||||
LivingEntity entityliving = entitywolf.getOwner();
|
||||
|
||||
@ -657,7 +655,7 @@
|
||||
|
||||
this.lastHurtByPlayer = entityhuman1;
|
||||
} else {
|
||||
@@ -1363,7 +1616,7 @@
|
||||
@@ -1363,7 +1614,7 @@
|
||||
}
|
||||
|
||||
protected void blockedByShield(LivingEntity target) {
|
||||
@ -666,7 +664,7 @@
|
||||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource source) {
|
||||
@@ -1375,20 +1628,33 @@
|
||||
@@ -1375,20 +1626,33 @@
|
||||
InteractionHand[] aenumhand = InteractionHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
@ -704,7 +702,7 @@
|
||||
ServerPlayer entityplayer = (ServerPlayer) this;
|
||||
|
||||
entityplayer.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
|
||||
@@ -1477,7 +1743,7 @@
|
||||
@@ -1477,7 +1741,7 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && this.hasCustomName()) {
|
||||
@ -713,7 +711,7 @@
|
||||
}
|
||||
|
||||
this.dead = true;
|
||||
@@ -1512,14 +1778,22 @@
|
||||
@@ -1512,14 +1776,22 @@
|
||||
BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
@ -738,7 +736,7 @@
|
||||
this.level().addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1530,22 +1804,37 @@
|
||||
@@ -1530,24 +1802,39 @@
|
||||
protected void dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
@ -768,8 +766,8 @@
|
||||
}
|
||||
|
||||
+ return 0; // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ protected void dropExperience(ServerLevel world, @Nullable Entity attacker) {
|
||||
+ // CraftBukkit start - Update getExpReward() above if the removed if() changes!
|
||||
+ if (!(this instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
|
||||
@ -777,10 +775,12 @@
|
||||
+ this.expToDrop = 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {}
|
||||
@@ -1612,19 +1901,31 @@
|
||||
|
||||
public long getLootTableSeed() {
|
||||
@@ -1612,19 +1899,31 @@
|
||||
}
|
||||
|
||||
public void knockback(double strength, double x, double z) {
|
||||
@ -819,7 +819,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1683,6 +1984,20 @@
|
||||
@@ -1683,6 +1982,20 @@
|
||||
return new LivingEntity.Fallsounds(SoundEvents.GENERIC_SMALL_FALL, SoundEvents.GENERIC_BIG_FALL);
|
||||
}
|
||||
|
||||
@ -840,7 +840,7 @@
|
||||
public Optional<BlockPos> getLastClimbablePos() {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
@@ -1757,9 +2072,14 @@
|
||||
@@ -1757,9 +2070,14 @@
|
||||
int i = this.calculateFallDamage(fallDistance, damageMultiplier);
|
||||
|
||||
if (i > 0) {
|
||||
@ -856,7 +856,7 @@
|
||||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1830,7 +2150,7 @@
|
||||
@@ -1830,7 +2148,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource source, float amount) {
|
||||
if (!source.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
@ -865,7 +865,7 @@
|
||||
amount = CombatRules.getDamageAfterAbsorb(this, amount, source, (float) this.getArmorValue(), (float) this.getAttributeValue(Attributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1841,7 +2161,8 @@
|
||||
@@ -1841,7 +2159,8 @@
|
||||
if (source.is(DamageTypeTags.BYPASSES_EFFECTS)) {
|
||||
return amount;
|
||||
} else {
|
||||
@ -875,7 +875,7 @@
|
||||
int i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = amount * (float) j;
|
||||
@@ -1884,18 +2205,144 @@
|
||||
@@ -1884,18 +2203,144 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -902,7 +902,7 @@
|
||||
+ };
|
||||
+ float freezingModifier = freezing.apply((double) f).floatValue();
|
||||
+ f += freezingModifier;
|
||||
|
||||
+
|
||||
+ com.google.common.base.Function<Double, Double> hardHat = new com.google.common.base.Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
@ -923,7 +923,7 @@
|
||||
+ };
|
||||
+ float blockingModifier = blocking.apply((double) f).floatValue();
|
||||
+ f += blockingModifier;
|
||||
+
|
||||
|
||||
+ com.google.common.base.Function<Double, Double> armor = new com.google.common.base.Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
@ -1029,7 +1029,7 @@
|
||||
|
||||
if (entity instanceof ServerPlayer) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) entity;
|
||||
@@ -1904,13 +2351,48 @@
|
||||
@@ -1904,13 +2349,48 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -1082,27 +1082,28 @@
|
||||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1935,8 +2417,18 @@
|
||||
@@ -1935,9 +2415,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 +2491,7 @@
|
||||
}
|
||||
@@ -1999,7 +2489,7 @@
|
||||
this.playSound(soundeffect, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
|
||||
@ -1111,7 +1112,7 @@
|
||||
this.setHealth(0.0F);
|
||||
this.die(this.damageSources().generic());
|
||||
}
|
||||
@@ -2182,6 +2674,12 @@
|
||||
@@ -2182,6 +2672,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
|
||||
|
||||
@ -1124,7 +1125,7 @@
|
||||
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
|
||||
|
||||
public Iterable<ItemStack> getHandSlots() {
|
||||
@@ -2494,7 +2992,7 @@
|
||||
@@ -2494,7 +2990,7 @@
|
||||
|
||||
}
|
||||
|
||||
@ -1133,7 +1134,7 @@
|
||||
Vec3 vec3d1 = this.getRiddenInput(controllingPlayer, movementInput);
|
||||
|
||||
this.tickRidden(controllingPlayer, vec3d1);
|
||||
@@ -2507,13 +3005,13 @@
|
||||
@@ -2507,13 +3003,13 @@
|
||||
|
||||
}
|
||||
|
||||
@ -1150,7 +1151,7 @@
|
||||
return this.getSpeed();
|
||||
}
|
||||
|
||||
@@ -2571,7 +3069,7 @@
|
||||
@@ -2571,7 +3067,7 @@
|
||||
double d1 = Mth.clamp(motion.z, -0.15000000596046448D, 0.15000000596046448D);
|
||||
double d2 = Math.max(motion.y, -0.15000000596046448D);
|
||||
|
||||
@ -1159,7 +1160,7 @@
|
||||
d2 = 0.0D;
|
||||
}
|
||||
|
||||
@@ -2586,7 +3084,7 @@
|
||||
@@ -2586,7 +3082,7 @@
|
||||
}
|
||||
|
||||
protected float getFlyingSpeed() {
|
||||
@ -1168,15 +1169,7 @@
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
@@ -2604,6 +3102,7 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
|
||||
super.tick();
|
||||
this.updatingUsingItem();
|
||||
this.updateSwimAmount();
|
||||
@@ -2634,7 +3133,7 @@
|
||||
@@ -2634,7 +3130,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -1185,21 +1178,8 @@
|
||||
if (this.tickCount % 20 == 0) {
|
||||
this.getCombatTracker().recheckStatus();
|
||||
}
|
||||
@@ -2645,7 +3144,9 @@
|
||||
}
|
||||
|
||||
if (!this.isRemoved()) {
|
||||
+ SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
|
||||
this.aiStep();
|
||||
+ SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
|
||||
}
|
||||
|
||||
double d0 = this.getX() - this.xo;
|
||||
@@ -2739,9 +3240,10 @@
|
||||
}
|
||||
|
||||
@@ -2741,7 +3237,7 @@
|
||||
this.elytraAnimationState.tick();
|
||||
+ SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
- public void detectEquipmentUpdates() {
|
||||
@ -1207,28 +1187,7 @@
|
||||
Map<EquipmentSlot, ItemStack> map = this.collectEquipmentChanges();
|
||||
|
||||
if (map != null) {
|
||||
@@ -2945,6 +3447,7 @@
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("ai");
|
||||
+ SpigotTimings.timerEntityAI.startTiming(); // Spigot
|
||||
if (this.isImmobile()) {
|
||||
this.jumping = false;
|
||||
this.xxa = 0.0F;
|
||||
@@ -2954,6 +3457,7 @@
|
||||
this.serverAiStep();
|
||||
gameprofilerfiller.pop();
|
||||
}
|
||||
+ SpigotTimings.timerEntityAI.stopTiming(); // Spigot
|
||||
|
||||
gameprofilerfiller.pop();
|
||||
gameprofilerfiller.push("jump");
|
||||
@@ -2996,11 +3500,12 @@
|
||||
this.resetFallDistance();
|
||||
}
|
||||
|
||||
+ SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
|
||||
label112:
|
||||
@@ -3000,7 +3496,7 @@
|
||||
{
|
||||
LivingEntity entityliving = this.getControllingPassenger();
|
||||
|
||||
@ -1237,25 +1196,7 @@
|
||||
if (this.isAlive()) {
|
||||
this.travelRidden(entityhuman, vec3d1);
|
||||
break label112;
|
||||
@@ -3009,6 +3514,7 @@
|
||||
|
||||
this.travel(vec3d1);
|
||||
}
|
||||
+ SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
|
||||
|
||||
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
||||
this.applyEffectsFromBlocks();
|
||||
@@ -3044,7 +3550,9 @@
|
||||
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
|
||||
}
|
||||
|
||||
+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
|
||||
this.pushEntities();
|
||||
+ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
|
||||
gameprofilerfiller.pop();
|
||||
world = this.level();
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
@@ -3063,6 +3571,7 @@
|
||||
@@ -3063,6 +3559,7 @@
|
||||
this.checkSlowFallDistance();
|
||||
if (!this.level().isClientSide) {
|
||||
if (!this.canGlide()) {
|
||||
@ -1263,7 +1204,7 @@
|
||||
this.setSharedFlag(7, false);
|
||||
return;
|
||||
}
|
||||
@@ -3113,7 +3622,7 @@
|
||||
@@ -3113,7 +3610,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
if (!(world instanceof ServerLevel worldserver)) {
|
||||
@ -1272,7 +1213,7 @@
|
||||
} else {
|
||||
List list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
|
||||
|
||||
@@ -3305,15 +3814,22 @@
|
||||
@@ -3305,15 +3802,22 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
@ -1297,7 +1238,7 @@
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
}
|
||||
@@ -3483,8 +3999,31 @@
|
||||
@@ -3483,8 +3987,31 @@
|
||||
this.releaseUsingItem();
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
@ -1309,7 +1250,7 @@
|
||||
+ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
|
||||
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Update client
|
||||
+ Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE);
|
||||
@ -1320,7 +1261,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);
|
||||
@ -1330,7 +1271,7 @@
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
}
|
||||
@@ -3568,12 +4107,18 @@
|
||||
@@ -3568,12 +4095,18 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
|
||||
@ -1351,7 +1292,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
if (world.hasChunkAt(blockposition)) {
|
||||
@@ -3592,18 +4137,43 @@
|
||||
@@ -3592,18 +4125,43 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@ -1399,7 +1340,7 @@
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
}
|
||||
|
||||
@@ -3613,7 +4183,7 @@
|
||||
@@ -3613,7 +4171,7 @@
|
||||
entitycreature.getNavigation().stop();
|
||||
}
|
||||
|
||||
@ -1408,7 +1349,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3706,7 +4276,7 @@
|
||||
@@ -3706,7 +4264,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
@ -1417,7 +1358,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
java.util.Objects.requireNonNull(world);
|
||||
@@ -3718,9 +4288,9 @@
|
||||
@@ -3718,9 +4276,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(() -> {
|
||||
@ -1429,7 +1370,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 +4310,7 @@
|
||||
@@ -3740,7 +4298,7 @@
|
||||
|
||||
@Nullable
|
||||
public Direction getBedOrientation() {
|
||||
@ -1438,7 +1379,7 @@
|
||||
|
||||
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
|
||||
}
|
||||
@@ -3905,7 +4475,7 @@
|
||||
@@ -3905,7 +4463,7 @@
|
||||
public float maxUpStep() {
|
||||
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user