Update to Minecraft 1.20.5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-04-24 01:15:00 +10:00
parent 4deda9501f
commit 65bc2541a3
524 changed files with 7788 additions and 6181 deletions

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/EntityInsentient.java
+++ b/net/minecraft/world/entity/EntityInsentient.java
@@ -76,6 +76,20 @@
import net.minecraft.world.level.pathfinder.PathType;
@@ -89,6 +89,20 @@
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
import net.minecraft.world.phys.AxisAlignedBB;
+// CraftBukkit start
@@ -18,10 +18,10 @@
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
+// CraftBukkit end
+
public abstract class EntityInsentient extends EntityLiving implements Targeting {
public abstract class EntityInsentient extends EntityLiving implements EquipmentUser, Targeting {
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
@@ -123,6 +137,8 @@
@@ -138,6 +152,8 @@
private BlockPosition restrictCenter;
private float restrictRadius;
@@ -30,7 +30,7 @@
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
super(entitytypes, world);
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
@@ -148,6 +164,12 @@
@@ -165,6 +181,12 @@
}
@@ -43,7 +43,12 @@
protected void registerGoals() {}
public static AttributeProvider.Builder createMobAttributes() {
@@ -259,7 +281,38 @@
@@ -269,11 +291,42 @@
@Nullable
protected final EntityLiving getTargetFromBrain() {
- return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -82,7 +87,7 @@
}
@Override
@@ -399,6 +452,12 @@
@@ -412,6 +465,12 @@
return null;
}
@@ -95,16 +100,16 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -457,7 +516,7 @@
@@ -486,7 +545,7 @@
}
}
nbttagcompound.put("HandDropChances", nbttaglist3);
- if (this.leashHolder != null) {
+ if (this.leashHolder != null && !this.leashHolder.pluginRemoved) { // CraftBukkit - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
nbttagcompound2 = new NBTTagCompound();
if (this.leashHolder instanceof EntityLiving) {
UUID uuid = this.leashHolder.getUUID();
@@ -488,16 +547,26 @@
- if (either != null) {
+ if (either != null && !this.leashHolder.pluginRemoved) { // CraftBukkit - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
nbttagcompound.put("leash", (NBTBase) either.map((uuid) -> {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -507,16 +566,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi());
}
@@ -131,9 +136,18 @@
+ }
+ // CraftBukkit end
NBTTagList nbttaglist;
NBTTagCompound nbttagcompound1;
int i;
@@ -544,6 +613,11 @@
@@ -565,7 +634,7 @@
if (nbttagcompound.contains("leash", 10)) {
this.delayedLeashInfo = Either.left(nbttagcompound.getCompound("leash").getUUID("UUID"));
} else if (nbttagcompound.contains("leash", 11)) {
- this.delayedLeashInfo = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse((Object) null);
+ this.delayedLeashInfo = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error
} else {
this.delayedLeashInfo = null;
}
@@ -577,6 +646,11 @@
}
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@@ -145,7 +159,7 @@
}
@Override
@@ -611,20 +685,26 @@
@@ -651,20 +725,26 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -174,7 +188,7 @@
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
@@ -635,11 +715,19 @@
@@ -675,11 +755,19 @@
flag = itemstack1.isEmpty();
}
@@ -195,7 +209,7 @@
}
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
@@ -760,7 +848,7 @@
@@ -813,7 +901,7 @@
@Override
public void checkDespawn() {
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
@@ -204,7 +218,7 @@
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
EntityHuman entityhuman = this.level().getNearestPlayer(this, -1.0D);
@@ -770,14 +858,14 @@
@@ -823,14 +911,14 @@
int j = i * i;
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
@@ -221,15 +235,15 @@
} else if (d0 < (double) l) {
this.noActionTime = 0;
}
@@ -791,6 +879,7 @@
@@ -844,6 +932,7 @@
@Override
protected final void serverAiStep() {
++this.noActionTime;
+ if (!this.aware) return; // CraftBukkit
this.level().getProfiler().push("sensing");
this.sensing.tick();
this.level().getProfiler().pop();
@@ -1184,6 +1273,12 @@
GameProfilerFiller gameprofilerfiller = this.level().getProfiler();
gameprofilerfiller.push("sensing");
@@ -1311,6 +1400,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@@ -239,10 +253,10 @@
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
this.dropLeash(true, !entityhuman.hasInfiniteMaterials());
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1209,6 +1304,12 @@
@@ -1336,6 +1431,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@@ -255,7 +269,7 @@
this.setLeashedTo(entityhuman, true);
itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1224,7 +1325,7 @@
@@ -1351,7 +1452,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level() instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@@ -264,7 +278,7 @@
optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1274,12 +1375,19 @@
@@ -1401,12 +1502,19 @@
return this.restrictRadius != -1.0F;
}
@@ -285,7 +299,7 @@
if (t0 == null) {
return null;
@@ -1313,7 +1421,12 @@
@@ -1440,7 +1548,12 @@
}
}
@@ -299,7 +313,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1321,7 +1434,7 @@
@@ -1448,7 +1561,7 @@
t0.startRiding(entity, true);
}
@@ -308,7 +322,7 @@
return t0;
}
}
@@ -1334,7 +1447,8 @@
@@ -1461,7 +1574,8 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@@ -318,9 +332,9 @@
}
}
@@ -1345,7 +1459,9 @@
this.leashHolder = null;
this.leashInfoTag = null;
@@ -1473,7 +1587,9 @@
this.delayedLeashInfo = null;
this.clearRestriction();
if (!this.level().isClientSide && flag1) {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.LEAD);
@@ -328,7 +342,7 @@
}
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
@@ -1395,6 +1511,7 @@
@@ -1527,6 +1643,7 @@
boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) {
@@ -336,27 +350,27 @@
this.dropLeash(true, true);
}
@@ -1419,7 +1536,9 @@
}
@@ -1555,7 +1672,9 @@
}
if (this.tickCount > 100) {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.LEAD);
+ this.forceDrops = false; // CraftBukkit
this.leashInfoTag = null;
if (this.tickCount > 100) {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation((IMaterial) Items.LEAD);
+ this.forceDrops = false; // CraftBukkit
this.delayedLeashInfo = null;
}
}
}
@@ -1501,14 +1620,21 @@
@@ -1638,14 +1757,21 @@
int i = EnchantmentManager.getFireAspect(this);
if (i > 0) {
- entity.setSecondsOnFire(i * 4);
- entity.igniteForSeconds(i * 4);
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), i * 4);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ entity.setSecondsOnFire(combustEvent.getDuration(), false);
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
+ }
+ // CraftBukkit end
}
@@ -370,7 +384,7 @@
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
}
@@ -1576,6 +1702,7 @@
@@ -1695,6 +1821,7 @@
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();