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

@@ -27,31 +27,31 @@
}
@@ -470,9 +481,13 @@
@@ -474,9 +485,13 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
+ // CraftBukkit start - Place event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2).isCancelled()) {
world.setBlock(blockposition, iblockdata2, 3);
world.gameEvent(this.enderman, GameEvent.BLOCK_PLACE, blockposition);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this.enderman, iblockdata2));
this.enderman.setCarriedBlock((IBlockData) null);
+ }
+ // CraftBukkit end
}
}
@@ -511,9 +526,13 @@
@@ -515,9 +530,13 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
- world.removeBlock(blockposition, false);
- world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
- world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
- this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
+ // CraftBukkit start - Pickup event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
+ world.removeBlock(blockposition, false);
+ world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
+ world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
+ this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
+ }
+ // CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGhast.java
+++ b/net/minecraft/world/entity/monster/EntityGhast.java
@@ -330,6 +330,8 @@
@@ -337,6 +337,8 @@
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getExplosionPower());

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntityGuardianElder.java
+++ b/net/minecraft/world/entity/monster/EntityGuardianElder.java
@@ -79,7 +79,7 @@
@@ -67,7 +67,7 @@
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 1200 == 0) {
MobEffect mobeffect = new MobEffect(MobEffects.DIG_SLOWDOWN, 6000, 2);
- List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level, this, this.position(), 50.0D, mobeffect, 1200);
+ List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level, this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) {
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
- entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), this);
+ entityplayer.addEffect(new MobEffect(mobeffectlist, 6000, 2), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
}
list.forEach((entityplayer) -> {
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));

View File

@@ -41,4 +41,4 @@
+ // CraftBukkit end
}
public static boolean checkZombifiedPiglinSpawnRules(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {
public static boolean checkZombifiedPiglinSpawnRules(EntityTypes<EntityPigZombie> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, RandomSource randomsource) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityRavager.java
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
@@ -170,7 +170,7 @@
@@ -171,7 +171,7 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
Block block = iblockdata.getBlock();

View File

@@ -30,7 +30,7 @@
this.unRide();
this.setAttachFace(enumdirection);
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -477,7 +493,7 @@
@@ -478,7 +494,7 @@
}
entityshulker.moveTo(vec3d);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
+++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
@@ -194,8 +194,19 @@
@@ -197,8 +197,19 @@
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySkeletonWither.java
+++ b/net/minecraft/world/entity/monster/EntitySkeletonWither.java
@@ -105,7 +105,7 @@
@@ -106,7 +106,7 @@
return false;
} else {
if (entity instanceof EntityLiving) {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/monster/EntitySlime.java
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
@@ -43,6 +43,14 @@
import net.minecraft.world.level.storage.loot.LootTables;
@@ -42,6 +42,14 @@
import net.minecraft.world.level.levelgen.SeededRandom;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySpider.java
+++ b/net/minecraft/world/entity/monster/EntitySpider.java
@@ -176,7 +176,7 @@
@@ -177,7 +177,7 @@
MobEffectList mobeffectlist = ((EntitySpider.GroupDataSpider) object).effect;
if (mobeffectlist != null) {

View File

@@ -1,17 +1,17 @@
--- a/net/minecraft/world/entity/monster/EntityStrider.java
+++ b/net/minecraft/world/entity/monster/EntityStrider.java
@@ -320,7 +320,13 @@
IBlockData iblockdata1 = this.getBlockStateOn();
boolean flag = iblockdata.is(TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is(TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
IBlockData iblockdata1 = this.getBlockStateOnLegacy();
boolean flag = iblockdata.is(TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is(TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
- this.setSuffocating(!flag);
+ // CraftBukkit start
+ if (!flag ^ this.isSuffocating()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag)) {
+ this.setSuffocating(!flag);
- this.setSuffocating(!flag);
+ // CraftBukkit start
+ if (!flag ^ this.isSuffocating()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag)) {
+ this.setSuffocating(!flag);
+ }
+ }
+ }
+ // CraftBukkit end
+ // CraftBukkit end
}
super.tick();
this.floatStrider();
this.checkInsideBlocks();

View File

@@ -1,17 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityVex.java
+++ b/net/minecraft/world/entity/monster/EntityVex.java
@@ -49,8 +49,8 @@
EntityInsentient owner;
@Nullable
private BlockPosition boundOrigin;
- private boolean hasLimitedLife;
- private int limitedLifeTicks;
+ public boolean hasLimitedLife; // CraftBukkit - PAIL, private -> public
+ public int limitedLifeTicks; // CraftBukkit - PAIL, private -> public
public EntityVex(EntityTypes<? extends EntityVex> entitytypes, World world) {
super(entitytypes, world);
@@ -368,7 +368,7 @@
@@ -373,7 +373,7 @@
@Override
public void start() {

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/entity/monster/EntityVindicator.java
+++ b/net/minecraft/world/entity/monster/EntityVindicator.java
@@ -52,7 +52,7 @@
static final Predicate<EnumDifficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> {
return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD;
};
- boolean isJohnny;
+ public boolean isJohnny; // PAIL
public EntityVindicator(EntityTypes<? extends EntityVindicator> entitytypes, World world) {
super(entitytypes, world);

View File

@@ -97,16 +97,18 @@
}
}
@@ -411,18 +437,28 @@
@@ -412,21 +438,30 @@
}
EntityVillager entityvillager = (EntityVillager) entityliving;
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
+ // CraftBukkit start
+ zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION);
+ flag = zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
+ }
+ }
+ return flag;
+ }
+
+ public static EntityZombieVillager zombifyVillager(WorldServer worldserver, EntityVillager entityvillager, net.minecraft.core.BlockPosition blockPosition, boolean silent, CreatureSpawnEvent.SpawnReason spawnReason) {
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, spawnReason);
+ if (entityzombievillager != null) {
@@ -122,14 +124,17 @@
+ if (!silent) {
+ worldserver.levelEvent((EntityHuman) null, 1026, blockPosition, 0);
}
-
- flag = false;
+ // CraftBukkit end
}
- return flag;
+ return entityzombievillager; // CraftBukkit
}
@Override
@@ -473,7 +509,7 @@
@@ -478,7 +513,7 @@
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.setChickenJockey(true);
this.startRiding(entitychicken1);

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
@@ -48,6 +48,13 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -47,6 +47,13 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -14,7 +14,7 @@
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -65,6 +72,7 @@
@@ -64,6 +71,7 @@
@Nullable
private NBTTagCompound tradeOffers;
private int villagerXp;
@@ -22,7 +22,7 @@
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
super(entitytypes, world);
@@ -83,7 +91,7 @@
@@ -82,7 +90,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -31,7 +31,7 @@
Logger logger = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -139,6 +147,10 @@
@@ -138,6 +146,10 @@
public void tick() {
if (!this.level.isClientSide && this.isAlive() && this.isConverting()) {
int i = this.getConversionProgress();
@@ -42,7 +42,7 @@
this.villagerConversionTime -= i;
if (this.villagerConversionTime <= 0) {
@@ -147,6 +159,7 @@
@@ -146,6 +158,7 @@
}
super.tick();
@@ -50,7 +50,7 @@
}
@Override
@@ -191,8 +204,10 @@
@@ -189,8 +202,10 @@
this.conversionStarter = uuid;
this.villagerConversionTime = i;
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
@@ -63,7 +63,7 @@
this.level.broadcastEntityEvent(this, (byte) 16);
}
@@ -209,7 +224,13 @@
@@ -207,7 +222,13 @@
}
private void finishConversion(WorldServer worldserver) {
@@ -78,7 +78,7 @@
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
@@ -224,7 +245,9 @@
@@ -222,7 +243,9 @@
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (d0 > 1.0D) {
@@ -88,7 +88,7 @@
}
}
}
@@ -250,7 +273,7 @@
@@ -248,7 +271,7 @@
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
@@ -55,6 +55,18 @@
@@ -54,6 +54,18 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -19,7 +19,7 @@
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
@@ -75,6 +87,10 @@
@@ -74,6 +86,10 @@
public boolean cannotHunt;
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_SPECIFIC_SENSOR);
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
@@ -30,7 +30,7 @@
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -93,6 +109,14 @@
@@ -92,6 +108,14 @@
}
nbttagcompound.put("Inventory", this.inventory.createTag());
@@ -45,7 +45,7 @@
}
@Override
@@ -101,6 +125,10 @@
@@ -100,6 +124,10 @@
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
@@ -56,7 +56,7 @@
}
@VisibleForDebug
@@ -205,7 +233,7 @@
@@ -206,7 +234,7 @@
@Override
public BehaviorController<EntityPiglin> getBrain() {
@@ -65,7 +65,7 @@
}
@Override
@@ -348,7 +376,7 @@
@@ -349,7 +377,7 @@
}
protected void holdInOffHand(ItemStack itemstack) {
@@ -74,7 +74,7 @@
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
} else {
@@ -374,8 +402,8 @@
@@ -375,8 +403,8 @@
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
return false;
} else {
@@ -85,7 +85,7 @@
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1)));
}
@@ -404,7 +432,7 @@
@@ -405,7 +433,7 @@
@Override
protected SoundEffect getAmbientSound() {

View File

@@ -30,7 +30,7 @@
+ Optional<SoundEffect> optional = getSoundForCurrentActivity(entitypiglin); // CraftBukkit - decompile error
Objects.requireNonNull(entitypiglin);
optional.ifPresent(entitypiglin::playSound);
optional.ifPresent(entitypiglin::playSoundEvent);
@@ -224,23 +231,27 @@
stopWalking(entitypiglin);
ItemStack itemstack;