Update to Minecraft 1.19

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-06-08 02:00:00 +10:00
parent 91d9aa9a89
commit 25f3b50f6b
332 changed files with 3628 additions and 2559 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityLiving.java
+++ b/net/minecraft/world/entity/EntityLiving.java
@@ -117,6 +117,30 @@
@@ -118,6 +118,30 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
@@ -31,10 +31,10 @@
public abstract class EntityLiving extends Entity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -226,6 +250,20 @@
private float swimAmount;
@@ -228,6 +252,20 @@
private float swimAmountO;
protected BehaviorController<?> brain;
private boolean skipDropExperience;
+ // CraftBukkit start
+ public int expToDrop;
+ public boolean forceDrops;
@@ -52,7 +52,7 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world);
@@ -238,7 +276,9 @@
@@ -240,7 +278,9 @@
this.useItem = ItemStack.EMPTY;
this.lastClimbablePos = Optional.empty();
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
@@ -63,7 +63,7 @@
this.blocksBuilding = true;
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.reapplyPosition();
@@ -305,7 +345,13 @@
@@ -307,7 +347,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@@ -78,24 +78,25 @@
}
}
@@ -655,9 +701,15 @@
@@ -661,10 +707,16 @@
}
protected void equipEventAndSound(ItemStack itemstack) {
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
+ // CraftBukkit start
+ this.equipEventAndSound(itemstack, false);
+ onEquipItem(enumitemslot, itemstack, itemstack1, false);
+ }
+
+ protected void equipEventAndSound(ItemStack itemstack, boolean silent) {
SoundEffect soundeffect = itemstack.getEquipSound();
+ public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1, boolean silent) {
+ // CraftBukkit end
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
- if (!itemstack.isEmpty() && soundeffect != null && !this.isSpectator()) {
+ if (!itemstack.isEmpty() && soundeffect != null && !this.isSpectator() && !silent) {
+ // CraftBukkit end
this.gameEvent(GameEvent.EQUIP);
this.playSound(soundeffect, 1.0F, 1.0F);
}
@@ -719,6 +771,17 @@
if (!flag && !ItemStack.isSameIgnoreDurability(itemstack, itemstack1)) {
- if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
+ if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !silent) { // CraftBukkit
this.playEquipSound(itemstack1);
}
@@ -742,6 +794,17 @@
}
}
@@ -113,7 +114,7 @@
if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -756,9 +819,32 @@
@@ -779,9 +842,32 @@
}
@@ -146,7 +147,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -768,6 +854,12 @@
@@ -791,6 +877,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null);
})) {
if (!this.level.isClientSide) {
@@ -159,7 +160,7 @@
iterator.remove();
this.onEffectRemoved(mobeffect);
}
@@ -778,6 +870,17 @@
@@ -801,6 +893,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@@ -177,7 +178,7 @@
if (this.effectsDirty) {
if (!this.level.isClientSide) {
@@ -904,7 +1007,13 @@
@@ -927,7 +1030,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
}
@@ -191,7 +192,7 @@
if (this.level.isClientSide) {
return false;
} else {
@@ -913,7 +1022,14 @@
@@ -936,7 +1045,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@@ -207,7 +208,7 @@
iterator.remove();
}
@@ -942,18 +1058,48 @@
@@ -965,18 +1081,48 @@
return this.addEffect(mobeffect, (Entity) null);
}
@@ -257,7 +258,7 @@
return true;
} else {
return false;
@@ -990,13 +1136,39 @@
@@ -1013,13 +1159,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
}
@@ -298,7 +299,7 @@
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1033,20 +1205,55 @@
@@ -1056,20 +1228,55 @@
}
@@ -355,7 +356,7 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1060,7 +1267,7 @@
@@ -1083,7 +1290,7 @@
return false;
} else if (this.level.isClientSide) {
return false;
@@ -364,7 +365,7 @@
return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1071,10 +1278,11 @@
@@ -1094,10 +1301,11 @@
this.noActionTime = 0;
float f1 = f;
@@ -378,7 +379,7 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1092,27 +1300,46 @@
@@ -1115,27 +1323,46 @@
this.animationSpeed = 1.5F;
boolean flag1 = true;
@@ -430,7 +431,7 @@
this.hurtDir = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -1235,19 +1462,29 @@
@@ -1258,19 +1485,29 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -464,7 +465,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1255,14 +1492,16 @@
@@ -1278,14 +1515,16 @@
}
this.setHealth(1.0F);
@@ -486,7 +487,7 @@
}
}
@@ -1367,14 +1606,22 @@
@@ -1390,14 +1629,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
@@ -511,7 +512,7 @@
this.level.addFreshEntity(entityitem);
}
}
@@ -1394,21 +1641,40 @@
@@ -1417,21 +1664,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@@ -535,9 +536,9 @@
- protected void dropExperience() {
+ // CraftBukkit start
+ public int getExpReward() {
if (this.level instanceof WorldServer && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
- EntityExperienceOrb.award((WorldServer) this.level, this.position(), this.getExperienceReward(this.lastHurtByPlayer));
+ int i = this.getExperienceReward(this.lastHurtByPlayer);
if (this.level instanceof WorldServer && !this.wasExperienceConsumed() && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
- EntityExperienceOrb.award((WorldServer) this.level, this.position(), this.getExperienceReward());
+ int i = this.getExperienceReward();
+ return i;
+ } else {
+ return 0;
@@ -555,7 +556,7 @@
}
@@ -1528,9 +1794,14 @@
@@ -1559,9 +1825,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@@ -571,7 +572,7 @@
return true;
} else {
return flag;
@@ -1579,7 +1850,7 @@
@@ -1610,7 +1881,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.isBypassArmor()) {
@@ -580,7 +581,7 @@
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1592,7 +1863,8 @@
@@ -1623,7 +1894,8 @@
} else {
int i;
@@ -590,7 +591,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1623,29 +1895,172 @@
@@ -1656,29 +1928,172 @@
}
}
@@ -744,7 +745,7 @@
+ if (!human) {
+ this.setAbsorptionAmount(this.getAbsorptionAmount() - f);
+ }
this.gameEvent(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
this.gameEvent(GameEvent.ENTITY_DAMAGE);
+
+ return true;
+ } else {
@@ -773,7 +774,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1666,8 +2081,18 @@
@@ -1699,8 +2114,18 @@
}
public final void setArrowCount(int i) {
@@ -793,7 +794,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -1963,6 +2388,12 @@
@@ -1996,6 +2421,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@@ -806,7 +807,7 @@
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2206,6 +2637,7 @@
@@ -2239,6 +2670,7 @@
}
if (this.onGround && !this.level.isClientSide) {
@@ -814,7 +815,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2736,6 +3168,7 @@
@@ -2769,6 +3201,7 @@
}
if (!this.level.isClientSide) {
@@ -822,7 +823,7 @@
this.setSharedFlag(7, flag);
}
@@ -2895,14 +3328,21 @@
@@ -2928,14 +3361,21 @@
@Override
public boolean isPickable() {
@@ -846,7 +847,7 @@
@Override
public float getYHeadRot() {
return this.yHeadRot;
@@ -3096,7 +3536,25 @@
@@ -3130,7 +3570,25 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@@ -873,7 +874,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3169,6 +3627,12 @@
@@ -3208,6 +3666,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@@ -886,7 +887,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3193,16 +3657,41 @@
@@ -3232,16 +3696,41 @@
}
if (flag2) {
@@ -931,7 +932,7 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3212,7 +3701,7 @@
@@ -3251,7 +3740,7 @@
((EntityCreature) this).getNavigation().stop();
}
@@ -940,7 +941,7 @@
}
}
@@ -3295,7 +3784,7 @@
@@ -3334,7 +3823,7 @@
}
public void stopSleeping() {
@@ -949,7 +950,7 @@
World world = this.level;
java.util.Objects.requireNonNull(this.level);
@@ -3327,7 +3816,7 @@
@@ -3366,7 +3855,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@@ -958,7 +959,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
}
@@ -3376,7 +3865,7 @@
@@ -3414,7 +3903,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
@@ -967,23 +968,3 @@
}
}
}
@@ -3479,8 +3968,10 @@
this.setDeltaMovement((double) ((float) packetplayoutspawnentityliving.getXd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getYd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getZd() / 8000.0F));
}
- public static record a(SoundEffect a, SoundEffect b) {
+ // CraftBukkit start - decompile error
+ public static record a(SoundEffect small, SoundEffect big) {
+ /*
private final SoundEffect small;
private final SoundEffect big;
@@ -3496,5 +3987,7 @@
public SoundEffect big() {
return this.big;
}
+ */
+ // CraftBukkit end
}
}