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,10 +1,11 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -112,6 +112,19 @@
import net.minecraft.world.scores.ScoreboardTeam;
@@ -116,6 +116,20 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTBase;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftVector;
@@ -19,8 +20,8 @@
+
public abstract class EntityHuman extends EntityLiving {
public static final String UUID_PREFIX_OFFLINE_PLAYER = "OfflinePlayer:";
@@ -125,7 +138,8 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -129,7 +143,8 @@
public static final float SWIMMING_BB_HEIGHT = 0.6F;
public static final float DEFAULT_EYE_HEIGHT = 1.62F;
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F);
@@ -30,7 +31,7 @@
private static final int FLY_ACHIEVEMENT_SPEED = 25;
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
@@ -135,10 +149,10 @@
@@ -139,10 +154,10 @@
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
private long timeEntitySatOnShoulder;
private final PlayerInventory inventory = new PlayerInventory(this);
@@ -40,10 +41,10 @@
public Container containerMenu;
- protected FoodMetaData foodData = new FoodMetaData();
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
protected WardenSpawnTracker wardenSpawnTracker = new WardenSpawnTracker(0, 0, 0);
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -165,6 +179,16 @@
@@ -173,6 +188,16 @@
@Nullable
public EntityFishingHook fishing;
@@ -57,10 +58,10 @@
+ }
+ // CraftBukkit end
+
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile, @Nullable ProfilePublicKey profilepublickey) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -303,7 +327,7 @@
@@ -314,7 +339,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@@ -69,7 +70,7 @@
}
}
@@ -495,7 +519,8 @@
@@ -506,7 +531,8 @@
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@@ -79,7 +80,7 @@
}
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -658,6 +683,13 @@
@@ -670,6 +696,13 @@
@Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
@@ -93,7 +94,7 @@
if (itemstack.isEmpty()) {
return null;
} else {
@@ -692,6 +724,33 @@
@@ -704,6 +737,33 @@
entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
}
@@ -127,7 +128,43 @@
return entityitem;
}
}
@@ -825,12 +884,12 @@
@@ -780,7 +840,7 @@
this.setScore(nbttagcompound.getInt("Score"));
this.foodData.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
- DataResult dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
+ DataResult<WardenSpawnTracker> dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker"))); // CraftBukkit - decompile error
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -804,7 +864,7 @@
}
if (nbttagcompound.contains("LastDeathLocation", 10)) {
- DataResult dataresult1 = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation"));
+ DataResult<GlobalPos> dataresult1 = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation")); // CraftBukkit - decompile error
Logger logger1 = EntityHuman.LOGGER;
Objects.requireNonNull(logger1);
@@ -826,7 +886,7 @@
nbttagcompound.putInt("XpSeed", this.enchantmentSeed);
nbttagcompound.putInt("Score", this.getScore());
this.foodData.addAdditionalSaveData(nbttagcompound);
- DataResult dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker);
+ DataResult<NBTBase> dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker); // CraftBukkit - decompile error
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -844,7 +904,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
- DataResult dataresult1 = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos);
+ DataResult<NBTBase> dataresult1 = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos); // CraftBukkit - decompile error
Logger logger1 = EntityHuman.LOGGER;
Objects.requireNonNull(logger1);
@@ -871,12 +931,12 @@
return false;
} else {
if (!this.level.isClientSide) {
@@ -142,7 +179,7 @@
}
if (this.level.getDifficulty() == EnumDifficulty.EASY) {
@@ -842,7 +901,13 @@
@@ -888,7 +948,13 @@
}
}
@@ -157,7 +194,7 @@
}
}
}
@@ -862,10 +927,29 @@
@@ -908,10 +974,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
@@ -190,7 +227,7 @@
}
@Override
@@ -907,8 +991,13 @@
@@ -953,8 +1038,13 @@
}
}
@@ -205,7 +242,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -923,7 +1012,7 @@
@@ -969,7 +1059,7 @@
}
if (f != 0.0F) {
@@ -214,7 +251,7 @@
float f3 = this.getHealth();
this.setHealth(this.getHealth() - f);
@@ -934,6 +1023,7 @@
@@ -980,6 +1070,7 @@
}
}
@@ -222,7 +259,7 @@
}
@Override
@@ -1093,7 +1183,7 @@
@@ -1139,7 +1230,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@@ -231,7 +268,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1132,8 +1222,15 @@
@@ -1178,8 +1269,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
@@ -249,7 +286,7 @@
}
}
@@ -1161,8 +1258,11 @@
@@ -1207,8 +1305,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
@@ -262,7 +299,7 @@
}
}
@@ -1171,9 +1271,26 @@
@@ -1217,9 +1318,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
@@ -289,7 +326,7 @@
}
if (flag2) {
@@ -1218,7 +1335,14 @@
@@ -1264,7 +1382,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -305,7 +342,7 @@
}
if (this.level instanceof WorldServer && f5 > 2.0F) {
@@ -1228,12 +1352,17 @@
@@ -1274,12 +1399,17 @@
}
}
@@ -324,7 +361,7 @@
}
}
@@ -1306,6 +1435,12 @@
@@ -1357,6 +1487,12 @@
public void updateTutorialInventoryAction(ItemStack itemstack, ItemStack itemstack1, ClickAction clickaction) {}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@@ -337,7 +374,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1390,9 +1525,9 @@
@@ -1441,9 +1577,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@@ -349,7 +386,7 @@
}
}
@@ -1426,7 +1561,11 @@
@@ -1477,7 +1613,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.flyingSpeed = f;
this.resetFallDistance();
@@ -362,7 +399,7 @@
} else {
super.travel(vec3d);
}
@@ -1461,19 +1600,19 @@
@@ -1512,19 +1652,19 @@
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.SWIM_ONE_CM, i);
@@ -385,7 +422,7 @@
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1484,13 +1623,13 @@
@@ -1535,13 +1675,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@@ -402,7 +439,7 @@
}
}
} else if (this.isFallFlying()) {
@@ -1556,12 +1695,24 @@
@@ -1607,12 +1747,24 @@
}
public void startFallFlying() {
@@ -428,7 +465,7 @@
}
@Override
@@ -1651,10 +1802,21 @@
@@ -1703,10 +1855,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@@ -451,12 +488,12 @@
}
}
@@ -1731,15 +1893,22 @@
@@ -1792,13 +1955,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
+ // CraftBukkit start
+ this.setItemSlot(enumitemslot, itemstack, false);
+ setItemSlot(enumitemslot, itemstack, false);
+ }
+
+ @Override
@@ -464,20 +501,18 @@
+ // CraftBukkit end
this.verifyEquippedItem(itemstack);
if (enumitemslot == EnumItemSlot.MAINHAND) {
- this.equipEventAndSound(itemstack);
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
this.inventory.items.set(this.inventory.selected, itemstack);
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.items.set(this.inventory.selected, itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.items.set(this.inventory.selected, itemstack), itemstack, silent); // CraftBukkit
} else if (enumitemslot == EnumItemSlot.OFFHAND) {
- this.equipEventAndSound(itemstack);
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
this.inventory.offhand.set(0, itemstack);
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack, silent); // CraftBukkit
} else if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
- this.equipEventAndSound(itemstack);
+ this.equipEventAndSound(itemstack, silent); // CraftBukkit
this.inventory.armor.set(enumitemslot.getIndex(), itemstack);
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
}
@@ -1780,26 +1949,31 @@
}
@@ -1837,26 +2007,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {