Update to Minecraft 1.19.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-03-15 03:30:00 +11:00
parent 90a887a912
commit 40076782ed
227 changed files with 2788 additions and 1621 deletions

View File

@@ -9,7 +9,7 @@
}
}
@@ -646,11 +646,15 @@
@@ -641,11 +641,15 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@@ -27,7 +27,7 @@
}
}
@@ -1226,7 +1230,7 @@
@@ -1221,7 +1225,7 @@
}
}
@@ -36,7 +36,7 @@
EntityBee.this.level.levelEvent(2005, blockposition, 0);
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
EntityBee.this.incrementNumCropsGrownSincePollination();
@@ -1299,7 +1303,7 @@
@@ -1294,7 +1298,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@@ -45,7 +45,7 @@
}
}
@@ -1308,7 +1312,7 @@
@@ -1303,7 +1307,7 @@
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
c(EntityBee entitybee) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityCat.java
+++ b/net/minecraft/world/entity/animal/EntityCat.java
@@ -415,7 +415,7 @@
@@ -412,7 +412,7 @@
}
} else if (this.isFood(itemstack)) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
@@ -9,7 +9,7 @@
this.tame(entityhuman);
this.setOrderedToSit(true);
this.level.broadcastEntityEvent(this, (byte) 7);
@@ -472,7 +472,7 @@
@@ -469,7 +469,7 @@
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
@@ -18,7 +18,7 @@
private final EntityCat cat;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -613,7 +613,15 @@
@@ -610,7 +610,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
@@ -35,7 +35,7 @@
}
}
@@ -645,10 +653,10 @@
@@ -642,10 +650,10 @@
private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -516,7 +516,8 @@
@@ -517,7 +517,8 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -10,7 +10,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -871,6 +872,16 @@
@@ -872,6 +873,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID());
}
@@ -27,7 +27,7 @@
if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -881,12 +892,14 @@
@@ -882,12 +893,14 @@
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@@ -46,15 +46,7 @@
}
}
@@ -1277,13 +1290,18 @@
}
private void pickGlowBerry(IBlockData iblockdata) {
- CaveVines.use(iblockdata, EntityFox.this.level, this.blockPos);
+ CaveVines.use(iblockdata, EntityFox.this.level, this.blockPos, EntityFox.this); // CraftBukkit
}
private void pickSweetBerries(IBlockData iblockdata) {
@@ -1285,6 +1298,11 @@
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
iblockdata.setValue(BlockSweetBerryBush.AGE, 1);
@@ -66,7 +58,7 @@
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1440,7 +1458,7 @@
@@ -1441,7 +1459,7 @@
private EntityLiving trustedLastHurt;
private int timestamp;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
@@ -182,7 +182,8 @@
@@ -177,7 +177,8 @@
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
if (!this.level.isClientSide) {
@@ -10,7 +10,7 @@
this.setTrusting(true);
this.spawnTrustingParticles(true);
this.level.broadcastEntityEvent(this, (byte) 41);
@@ -313,10 +314,10 @@
@@ -308,10 +309,10 @@
private final EntityOcelot ocelot;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {

View File

@@ -16,9 +16,9 @@
- this.addEffect(new MobEffect(MobEffects.POISON, 900));
+ this.addEffect(new MobEffect(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
this.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -387,7 +387,7 @@
@@ -382,7 +382,7 @@
@Override
public boolean isPushable() {
@@ -27,7 +27,7 @@
}
@Override
@@ -403,7 +403,7 @@
@@ -398,7 +398,7 @@
return false;
} else {
if (!this.level.isClientSide) {

View File

@@ -3,7 +3,7 @@
@@ -144,7 +144,7 @@
int i = this.getPuffState();
if (entityinsentient.hurt(DamageSource.mobAttack(this), (float) (1 + i))) {
if (entityinsentient.hurt(this.damageSources().mobAttack(this), (float) (1 + i))) {
- entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this);
+ entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
this.playSound(SoundEffects.PUFFER_FISH_STING, 1.0F, 1.0F);

View File

@@ -56,7 +56,7 @@
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
- Optional optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> {
+ Optional<Item> optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // CraftBukkit - decompile error
return recipecrafting.assemble(inventorycrafting);
return recipecrafting.assemble(inventorycrafting, this.level.registryAccess());
}).map(ItemStack::getItem);
@@ -399,10 +420,18 @@

View File

@@ -11,29 +11,29 @@
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -103,7 +107,7 @@
BiomeBase biomebase = (BiomeBase) this.level.getBiome(blockposition).value();
if (biomebase.shouldSnowGolemBurn(blockposition)) {
- this.hurt(DamageSource.ON_FIRE, 1.0F);
+ this.hurt(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
@@ -97,7 +101,7 @@
super.aiStep();
if (!this.level.isClientSide) {
if (this.level.getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
- this.hurt(this.damageSources().onFire(), 1.0F);
+ this.hurt(this.damageSources().melting, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -119,7 +123,11 @@
BlockPosition blockposition1 = new BlockPosition(i, j, k);
@@ -113,7 +117,11 @@
BlockPosition blockposition = new BlockPosition(j, k, l);
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
- this.level.setBlockAndUpdate(blockposition1, iblockdata);
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
- this.level.setBlockAndUpdate(blockposition, iblockdata);
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition1, iblockdata, this)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, this)) {
+ continue;
+ }
+ // CraftBukkit end
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this, iblockdata));
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
}
}
@@ -151,6 +159,11 @@
@@ -145,6 +153,11 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@@ -45,7 +45,7 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level.isClientSide) {
@@ -170,7 +183,9 @@
@@ -164,7 +177,9 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level.isClientSide()) {
this.setPumpkin(false);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -307,7 +307,9 @@
@@ -308,7 +308,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@@ -10,24 +10,28 @@
}
}
@@ -334,7 +336,9 @@
@@ -335,7 +337,9 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = entitylightning; // CraftBukkit
this.hurt(DamageSource.LIGHTNING_BOLT, Float.MAX_VALUE);
this.hurt(this.damageSources().lightningBolt(), Float.MAX_VALUE);
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
}
private static class e extends ControllerMove {
@@ -482,8 +486,12 @@
@@ -487,12 +491,16 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level;
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
world.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
world.setBlock(this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1), 3);
BlockPosition blockposition1 = this.blockPos.above();
IBlockData iblockdata = (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1);
world.setBlock(blockposition1, iblockdata, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this.turtle, iblockdata));
+ }
+ // CraftBukkit end
this.turtle.setHasEgg(false);

View File

@@ -39,7 +39,7 @@
}
public static AttributeProvider.Builder createAttributes() {
@@ -236,7 +243,7 @@
@@ -231,7 +238,7 @@
public void aiStep() {
super.aiStep();
if (!this.level.isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
@@ -48,7 +48,7 @@
}
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -306,7 +313,12 @@
@@ -301,7 +308,12 @@
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
@@ -62,7 +62,7 @@
this.level.broadcastEntityEvent(this, (byte) 18);
this.level.playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
this.removeInteractionItem(entityhuman, itemstack);
@@ -318,7 +330,7 @@
@@ -313,7 +325,7 @@
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
this.removeInteractionItem(entityhuman, itemstack);
this.level.playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
@@ -71,7 +71,7 @@
return EnumInteractionResult.SUCCESS;
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
@@ -439,6 +451,7 @@
@@ -434,6 +446,7 @@
}
private boolean shouldStopDancing() {
@@ -79,7 +79,7 @@
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
}
@@ -483,7 +496,7 @@
@@ -478,7 +491,7 @@
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
this.writeInventoryToTag(nbttagcompound);
@@ -88,7 +88,7 @@
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -499,7 +512,7 @@
@@ -494,7 +507,7 @@
super.readAdditionalSaveData(nbttagcompound);
this.readInventoryFromTag(nbttagcompound);
if (nbttagcompound.contains("listener", 10)) {
@@ -97,7 +97,7 @@
Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger);
@@ -532,7 +545,7 @@
@@ -527,7 +540,7 @@
return Allay.DUPLICATION_ITEM.test(itemstack);
}
@@ -106,7 +106,7 @@
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level);
if (allay != null) {
@@ -540,17 +553,17 @@
@@ -535,17 +548,17 @@
allay.setPersistenceRequired();
allay.resetDuplicationCooldown();
this.resetDuplicationCooldown();

View File

@@ -27,16 +27,16 @@
}
@Override
@@ -418,7 +425,7 @@
@@ -419,7 +426,7 @@
int i = mobeffect != null ? mobeffect.getDuration() : 0;
int j = Math.min(2400, 100 + i);
if (i < 2400) {
i = Math.min(2400, 100 + i);
- entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, i, 0), this);
+ entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit
- entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, j, 0), this);
+ entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, j, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -468,7 +475,7 @@
@@ -469,7 +476,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {

View File

@@ -1,23 +1,23 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
@@ -74,6 +74,8 @@
import net.minecraft.world.phys.AxisAlignedBB;
@@ -78,6 +78,8 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
+
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, IJumpable, ISaddleable {
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, OwnableEntity, IJumpable, ISaddleable {
public static final int EQUIPMENT_SLOT_OFFSET = 400;
@@ -113,6 +115,7 @@
private float mouthAnimO;
protected boolean canGallop = true;
@@ -139,6 +141,7 @@
protected int gallopSoundCounter;
@Nullable
private UUID owner;
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -312,7 +315,7 @@
@@ -338,7 +341,7 @@
public void createInventory() {
InventorySubcontainer inventorysubcontainer = this.inventory;
@@ -26,7 +26,7 @@
if (inventorysubcontainer != null) {
inventorysubcontainer.removeListener(this);
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
@@ -416,7 +419,7 @@
@@ -442,7 +445,7 @@
}
public int getMaxTemper() {
@@ -35,7 +35,7 @@
}
@Override
@@ -487,7 +490,7 @@
@@ -513,7 +516,7 @@
}
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
@@ -44,7 +44,7 @@
flag = true;
}
@@ -564,7 +567,7 @@
@@ -590,7 +593,7 @@
super.aiStep();
if (!this.level.isClientSide && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@@ -53,7 +53,7 @@
}
if (this.canEatGrass()) {
@@ -838,6 +841,7 @@
@@ -857,6 +860,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
}
@@ -61,7 +61,7 @@
if (!this.inventory.getItem(0).isEmpty()) {
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
@@ -865,6 +869,11 @@
@@ -884,6 +888,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
}
@@ -73,7 +73,7 @@
if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -942,6 +951,18 @@
@@ -986,6 +995,18 @@
@Override
public void handleStartJump(int i) {