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,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityCaveSpider.java
+++ b/net/minecraft/world/entity/monster/EntityCaveSpider.java
@@ -42,7 +42,7 @@
@@ -39,7 +39,7 @@
}
if (b0 > 0) {

View File

@@ -22,7 +22,7 @@
public EntityCreeper(EntityTypes<? extends EntityCreeper> entitytypes, World world) {
super(entitytypes, world);
@@ -218,9 +226,20 @@
@@ -216,9 +224,20 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
super.thunderHit(worldserver, entitylightning);
@@ -43,18 +43,18 @@
@Override
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
@@ -230,8 +249,9 @@
@@ -228,8 +247,9 @@
this.level().playSound(entityhuman, this.getX(), this.getY(), this.getZ(), soundeffect, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
if (!this.level().isClientSide) {
+ this.entityIgniter = entityhuman; // CraftBukkit
this.ignite();
- if (!itemstack.isDamageableItem()) {
+ if (itemstack.getItem().getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper
+ if (itemstack.getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper
itemstack.shrink(1);
} else {
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
@@ -250,10 +270,19 @@
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
@@ -246,10 +266,19 @@
if (!this.level().isClientSide) {
float f = this.isPowered() ? 2.0F : 1.0F;
@@ -76,7 +76,7 @@
}
}
@@ -264,6 +293,7 @@
@@ -260,6 +289,7 @@
if (!collection.isEmpty()) {
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
@@ -84,7 +84,7 @@
entityareaeffectcloud.setRadius(2.5F);
entityareaeffectcloud.setRadiusOnUse(-0.5F);
entityareaeffectcloud.setWaitTime(10);
@@ -277,7 +307,7 @@
@@ -273,7 +303,7 @@
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityDrowned.java
+++ b/net/minecraft/world/entity/monster/EntityDrowned.java
@@ -244,7 +244,7 @@
@@ -247,7 +247,7 @@
@Override
public void performRangedAttack(EntityLiving entityliving, float f) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -71,6 +71,11 @@
@@ -68,6 +68,11 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntityEnderman extends EntityMonster implements IEntityAngerable {
private static final UUID SPEED_MODIFIER_ATTACKING_UUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
@@ -115,7 +120,17 @@
@@ -111,7 +116,17 @@
@Override
public void setTarget(@Nullable EntityLiving entityliving) {
@@ -31,7 +31,7 @@
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
@@ -130,6 +145,7 @@
@@ -126,6 +141,7 @@
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
}
}
@@ -39,25 +39,25 @@
}
@@ -493,9 +509,11 @@
@@ -477,9 +493,11 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2)) { // CraftBukkit - Place event
world.setBlock(blockposition, iblockdata2, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this.enderman, iblockdata2));
world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this.enderman, iblockdata2));
this.enderman.setCarriedBlock((IBlockData) null);
+ } // CraftBukkit
}
}
@@ -534,9 +552,11 @@
@@ -518,9 +536,11 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState())) { // CraftBukkit - Place event
world.removeBlock(blockposition, false);
world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
world.gameEvent((Holder) GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
+ } // CraftBukkit
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityEndermite.java
+++ b/net/minecraft/world/entity/monster/EntityEndermite.java
@@ -29,6 +29,10 @@
@@ -25,6 +25,10 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityRemoveEvent;
@@ -11,7 +11,7 @@
public class EntityEndermite extends EntityMonster {
private static final int MAX_LIFE = 2400;
@@ -122,7 +126,7 @@
@@ -113,7 +117,7 @@
}
if (this.life >= 2400) {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntityEvoker.java
+++ b/net/minecraft/world/entity/monster/EntityEvoker.java
@@ -200,7 +200,7 @@
@@ -213,7 +213,7 @@
worldserver.getScoreboard().addPlayerToTeam(entityvex.getScoreboardName(), scoreboardteam);
}
- worldserver.addFreshEntityWithPassengers(entityvex);
+ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason
worldserver.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of((Entity) EntityEvoker.this));
worldserver.gameEvent((Holder) GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of((Entity) EntityEvoker.this));
}
}

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGuardian.java
+++ b/net/minecraft/world/entity/monster/EntityGuardian.java
@@ -63,6 +63,7 @@
@@ -59,6 +59,7 @@
private boolean clientSideTouchedGround;
@Nullable
public PathfinderGoalRandomStroll randomStrollGoal;
@@ -8,7 +8,7 @@
public EntityGuardian(EntityTypes<? extends EntityGuardian> entitytypes, World world) {
super(entitytypes, world);
@@ -78,7 +79,7 @@
@@ -74,7 +75,7 @@
PathfinderGoalMoveTowardsRestriction pathfindergoalmovetowardsrestriction = new PathfinderGoalMoveTowardsRestriction(this, 1.0D);
this.randomStrollGoal = new PathfinderGoalRandomStroll(this, 1.0D, 80);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityGuardianElder.java
+++ b/net/minecraft/world/entity/monster/EntityGuardianElder.java
@@ -70,7 +70,7 @@
@@ -67,7 +67,7 @@
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 1200 == 0) {
MobEffect mobeffect = new MobEffect(MobEffects.DIG_SLOWDOWN, 6000, 2);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
+++ b/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
@@ -228,7 +228,7 @@
@@ -215,7 +215,7 @@
@Override
protected void performSpellCasting() {
@@ -9,7 +9,7 @@
}
@Nullable
@@ -279,7 +279,7 @@
@@ -266,7 +266,7 @@
@Override
protected void performSpellCasting() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityIllagerWizard.java
+++ b/net/minecraft/world/entity/monster/EntityIllagerWizard.java
@@ -16,6 +16,10 @@
@@ -17,6 +17,10 @@
import net.minecraft.world.entity.ai.goal.PathfinderGoal;
import net.minecraft.world.level.World;
@@ -11,7 +11,7 @@
public abstract class EntityIllagerWizard extends EntityIllagerAbstract {
private static final DataWatcherObject<Byte> DATA_SPELL_CASTING_ID = DataWatcher.defineId(EntityIllagerWizard.class, DataWatcherRegistry.BYTE);
@@ -155,6 +159,11 @@
@@ -158,6 +162,11 @@
public void tick() {
--this.attackWarmupDelay;
if (this.attackWarmupDelay == 0) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
@@ -543,14 +543,14 @@
@@ -521,14 +521,14 @@
List<EntityHuman> list = EntityPhantom.this.level().getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
if (!list.isEmpty()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
@@ -150,7 +150,7 @@
@@ -148,7 +148,7 @@
}).filter((entitypigzombie) -> {
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
}).forEach((entitypigzombie) -> {
@@ -9,7 +9,7 @@
});
}
@@ -159,7 +159,7 @@
@@ -157,7 +157,7 @@
}
@Override
@@ -18,7 +18,7 @@
if (this.getTarget() == null && entityliving != null) {
this.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.sample(this.random);
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.sample(this.random);
@@ -169,12 +169,21 @@
@@ -167,12 +167,21 @@
this.setLastHurtByPlayer((EntityHuman) entityliving);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPillager.java
+++ b/net/minecraft/world/entity/monster/EntityPillager.java
@@ -51,6 +51,10 @@
@@ -44,6 +44,10 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.WorldAccess;
@@ -11,7 +11,7 @@
public class EntityPillager extends EntityIllagerAbstract implements ICrossbow, InventoryCarrier {
private static final DataWatcherObject<Boolean> IS_CHARGING_CROSSBOW = DataWatcher.defineId(EntityPillager.class, DataWatcherRegistry.BOOLEAN);
@@ -213,7 +217,7 @@
@@ -192,7 +196,7 @@
ItemStack itemstack1 = this.inventory.addItem(itemstack);
if (itemstack1.isEmpty()) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityRavager.java
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
@@ -43,6 +43,10 @@
@@ -42,6 +42,10 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -11,7 +11,7 @@
public class EntityRavager extends EntityRaider {
private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (entity) -> {
@@ -153,6 +157,11 @@
@@ -146,6 +150,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockLeaves) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityShulker.java
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
@@ -59,6 +59,12 @@
@@ -58,6 +58,12 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
@@ -13,7 +13,7 @@
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, IMonster {
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
@@ -400,6 +406,14 @@
@@ -401,6 +407,14 @@
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
if (enumdirection != null) {
@@ -28,7 +28,7 @@
this.unRide();
this.setAttachFace(enumdirection);
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -470,7 +484,7 @@
@@ -471,7 +485,7 @@
if (entityshulker != null) {
entityshulker.setVariant(this.getVariant());
entityshulker.moveTo(vec3d);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
@@ -34,6 +34,11 @@
@@ -30,6 +30,11 @@
import net.minecraft.world.level.block.BlockMonsterEggs;
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntitySilverfish extends EntityMonster {
@Nullable
@@ -176,6 +181,11 @@
@@ -157,6 +162,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockMonsterEggs) {
@@ -24,7 +24,7 @@
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
world.destroyBlock(blockposition1, true, this.silverfish);
} else {
@@ -245,9 +255,14 @@
@@ -226,9 +236,14 @@
IBlockData iblockdata = world.getBlockState(blockposition);
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {

View File

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

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntitySlime.java
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
@@ -44,6 +44,15 @@
@@ -43,6 +43,15 @@
import net.minecraft.world.level.levelgen.SeededRandom;
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
+// CraftBukkit start
+import java.util.ArrayList;
@@ -16,7 +16,7 @@
public class EntitySlime extends EntityInsentient implements IMonster {
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
@@ -192,11 +201,18 @@
@@ -193,11 +202,18 @@
@Override
public EntityTypes<? extends EntitySlime> getType() {
@@ -36,7 +36,7 @@
int i = this.getSize();
if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) {
@@ -206,6 +222,19 @@
@@ -208,6 +224,19 @@
int j = i / 2;
int k = 2 + this.random.nextInt(3);
@@ -54,12 +54,12 @@
+ // CraftBukkit end
+
for (int l = 0; l < k; ++l) {
float f1 = ((float) (l % 2) - 0.5F) * f;
float f2 = ((float) (l / 2) - 0.5F) * f;
@@ -221,12 +250,21 @@
float f2 = ((float) (l % 2) - 0.5F) * f1;
float f3 = ((float) (l / 2) - 0.5F) * f1;
@@ -223,12 +252,21 @@
entityslime.setInvulnerable(this.isInvulnerable());
entityslime.setSize(j, true);
entityslime.moveTo(this.getX() + (double) f1, this.getY() + 0.5D, this.getZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);
entityslime.moveTo(this.getX() + (double) f2, this.getY() + 0.5D, this.getZ() + (double) f3, this.random.nextFloat() * 360.0F, 0.0F);
- this.level().addFreshEntity(entityslime);
+ slimes.add(entityslime); // CraftBukkit
}

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntitySpider.java
+++ b/net/minecraft/world/entity/monster/EntitySpider.java
@@ -182,7 +182,7 @@
MobEffectList mobeffectlist = entityspider_groupdataspider.effect;
@@ -172,7 +172,7 @@
Holder<MobEffectList> holder = entityspider_groupdataspider.effect;
if (mobeffectlist != null) {
- this.addEffect(new MobEffect(mobeffectlist, -1));
+ this.addEffect(new MobEffect(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
if (holder != null) {
- this.addEffect(new MobEffect(holder, -1));
+ this.addEffect(new MobEffect(holder, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityVex.java
+++ b/net/minecraft/world/entity/monster/EntityVex.java
@@ -404,7 +404,7 @@
@@ -383,7 +383,7 @@
@Override
public void start() {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntityWitch.java
+++ b/net/minecraft/world/entity/monster/EntityWitch.java
@@ -134,7 +134,7 @@
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
@@ -124,7 +124,7 @@
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
- this.addEffect(new MobEffect(mobeffect));
+ this.addEffect(new MobEffect(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
if (itemstack.is(Items.POTION) && potioncontents != null) {
- potioncontents.forEachEffect(this::addEffect);
+ potioncontents.forEachEffect((effect) -> this.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK)); // CraftBukkit
}
this.gameEvent(GameEvent.DRINK);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityZombie.java
+++ b/net/minecraft/world/entity/monster/EntityZombie.java
@@ -67,6 +67,15 @@
@@ -64,6 +64,15 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
import org.joml.Vector3f;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
@@ -16,7 +16,7 @@
public class EntityZombie extends EntityMonster {
private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
@@ -87,6 +96,7 @@
@@ -84,6 +93,7 @@
private boolean canBreakDoors;
private int inWaterTime;
public int conversionTime;
@@ -24,7 +24,7 @@
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
super(entitytypes, world);
@@ -203,7 +213,10 @@
@@ -200,7 +210,10 @@
public void tick() {
if (!this.level().isClientSide && this.isAlive() && !this.isNoAi()) {
if (this.isUnderWaterConverting()) {
@@ -36,7 +36,7 @@
if (this.conversionTime < 0) {
this.doUnderWaterConversion();
}
@@ -220,6 +233,7 @@
@@ -217,6 +230,7 @@
}
super.tick();
@@ -44,7 +44,7 @@
}
@Override
@@ -252,6 +266,7 @@
@@ -249,6 +263,7 @@
}
public void startUnderWaterConversion(int i) {
@@ -52,7 +52,7 @@
this.conversionTime = i;
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
}
@@ -265,11 +280,15 @@
@@ -262,11 +277,15 @@
}
protected void convertToZombieType(EntityTypes<? extends EntityZombie> entitytypes) {
@@ -69,35 +69,35 @@
}
}
@@ -309,9 +328,9 @@
if (SpawnerCreature.isSpawnPositionOk(entitypositiontypes_surface, this.level(), blockposition, entitytypes) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level().random)) {
@@ -305,9 +324,9 @@
if (EntityPositionTypes.isSpawnPositionOk(entitytypes, this.level(), blockposition) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level().random)) {
entityzombie.setPos((double) i1, (double) j1, (double) k1);
if (!this.level().hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) {
- entityzombie.setTarget(entityliving);
+ entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null, (NBTTagCompound) null);
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null);
- worldserver.addFreshEntityWithPassengers(entityzombie);
+ worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADD_VALUE));
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADD_VALUE));
break;
@@ -332,7 +351,14 @@
@@ -328,7 +347,14 @@
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
- entity.setSecondsOnFire(2 * (int) f);
- entity.igniteForSeconds(2 * (int) f);
+ // CraftBukkit start
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * (int) f); // PAIL: fixme
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entity.setSecondsOnFire(event.getDuration(), false);
+ entity.igniteForSeconds(event.getDuration(), false);
+ }
+ // CraftBukkit end
}
}
@@ -414,8 +440,17 @@
@@ -403,8 +429,17 @@
if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
return flag;
}
@@ -115,10 +115,10 @@
+ // CraftBukkit end
if (entityzombievillager != null) {
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
@@ -423,15 +458,17 @@
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true));
@@ -412,15 +447,17 @@
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
entityzombievillager.setTradeOffers(entityvillager.getOffers().createTag());
entityzombievillager.setTradeOffers(entityvillager.getOffers().copy());
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
- if (!this.isSilent()) {
- worldserver.levelEvent((EntityHuman) null, 1026, this.blockPosition(), 0);
@@ -139,8 +139,8 @@
}
@Override
@@ -484,7 +521,7 @@
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
@@ -471,7 +508,7 @@
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null);
entitychicken1.setChickenJockey(true);
this.startRiding(entitychicken1);
- worldaccess.addFreshEntity(entitychicken1);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityZombieHusk.java
+++ b/net/minecraft/world/entity/monster/EntityZombieHusk.java
@@ -60,7 +60,7 @@
@@ -58,7 +58,7 @@
if (flag && this.getMainHandItem().isEmpty() && entity instanceof EntityLiving) {
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
@@ -50,6 +50,13 @@
import org.joml.Vector3f;
@@ -48,6 +48,13 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -14,15 +14,15 @@
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -67,6 +74,7 @@
@@ -65,6 +72,7 @@
@Nullable
private NBTTagCompound tradeOffers;
private MerchantRecipeList tradeOffers;
private int villagerXp;
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
super(entitytypes, world);
@@ -85,7 +93,7 @@
@@ -83,7 +91,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -31,7 +31,16 @@
Logger logger = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -141,6 +149,10 @@
@@ -118,7 +126,7 @@
}
if (nbttagcompound.contains("Offers")) {
- DataResult dataresult1 = MerchantRecipeList.CODEC.parse(this.registryAccess().createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("Offers"));
+ DataResult<MerchantRecipeList> dataresult1 = MerchantRecipeList.CODEC.parse(this.registryAccess().createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("Offers")); // CraftBukkit - decompile error
Logger logger1 = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger1);
@@ -145,6 +153,10 @@
public void tick() {
if (!this.level().isClientSide && this.isAlive() && this.isConverting()) {
int i = this.getConversionProgress();
@@ -42,7 +51,7 @@
this.villagerConversionTime -= i;
if (this.villagerConversionTime <= 0) {
@@ -149,6 +161,7 @@
@@ -153,6 +165,7 @@
}
super.tick();
@@ -50,7 +59,7 @@
}
@Override
@@ -192,8 +205,10 @@
@@ -193,8 +206,10 @@
this.conversionStarter = uuid;
this.villagerConversionTime = i;
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
@@ -63,7 +72,7 @@
this.level().broadcastEntityEvent(this, (byte) 16);
}
@@ -210,7 +225,13 @@
@@ -211,7 +226,13 @@
}
private void finishConversion(WorldServer worldserver) {
@@ -78,7 +87,7 @@
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
@@ -225,7 +246,9 @@
@@ -226,7 +247,9 @@
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (d0 > 1.0D) {
@@ -88,7 +97,7 @@
}
}
}
@@ -252,7 +275,7 @@
@@ -253,7 +276,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 @@
@@ -73,6 +85,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.ITEM_PICKUP_COOLDOWN_TICKS, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, new MemoryModuleType[]{MemoryModuleType.WALK_TARGET, 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,10 +30,10 @@
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -93,6 +109,14 @@
@@ -91,6 +107,14 @@
}
this.writeInventoryToTag(nbttagcompound);
this.writeInventoryToTag(nbttagcompound, this.registryAccess());
+ // CraftBukkit start
+ NBTTagList barterList = new NBTTagList();
+ allowedBarterItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
@@ -45,10 +45,10 @@
}
@Override
@@ -101,6 +125,10 @@
@@ -99,6 +123,10 @@
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
this.readInventoryFromTag(nbttagcompound);
this.readInventoryFromTag(nbttagcompound, this.registryAccess());
+ // CraftBukkit start
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
@@ -56,7 +56,7 @@
}
@VisibleForDebug
@@ -220,7 +248,7 @@
@@ -216,7 +244,7 @@
@Override
public BehaviorController<EntityPiglin> getBrain() {
@@ -65,7 +65,7 @@
}
@Override
@@ -360,7 +388,7 @@
@@ -349,7 +377,7 @@
}
protected void holdInOffHand(ItemStack itemstack) {
@@ -74,7 +74,7 @@
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
} else {
@@ -386,8 +414,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)));
}
@@ -416,7 +444,7 @@
@@ -405,7 +433,7 @@
@Override
protected SoundEffect getAmbientSound() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
@@ -115,7 +115,7 @@
@@ -94,7 +94,7 @@
}
protected void finishConversion(WorldServer worldserver) {
@@ -9,12 +9,3 @@
if (entitypigzombie != null) {
entitypigzombie.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
@@ -132,7 +132,7 @@
@Nullable
@Override
public EntityLiving getTarget() {
- return (EntityLiving) this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
protected boolean isHoldingMeleeWeapon() {

View File

@@ -50,7 +50,7 @@
+ Optional<SoundEffect> optional = getSoundForCurrentActivity(entitypiglin); // CraftBukkit - decompile error
Objects.requireNonNull(entitypiglin);
optional.ifPresent(entitypiglin::playSoundEvent);
optional.ifPresent(entitypiglin::makeSound);
@@ -233,23 +242,27 @@
stopWalking(entitypiglin);
ItemStack itemstack;
@@ -141,7 +141,7 @@
protected static boolean isLovedItem(ItemStack itemstack) {
return itemstack.is(TagsItem.PIGLIN_LOVED);
}
@@ -481,7 +505,7 @@
@@ -479,7 +503,7 @@
}
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
@@ -150,7 +150,7 @@
}
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
@@ -738,6 +762,12 @@
@@ -736,6 +760,12 @@
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
}
@@ -163,7 +163,7 @@
private static boolean isBarterCurrency(ItemStack itemstack) {
return itemstack.is(PiglinAI.BARTERING_ITEM);
}
@@ -775,7 +805,7 @@
@@ -773,7 +803,7 @@
}
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -373,7 +373,7 @@
@@ -371,7 +371,7 @@
@Override
public BehaviorController<Warden> getBrain() {
@@ -9,7 +9,7 @@
}
@Override
@@ -414,13 +414,13 @@
@@ -408,13 +408,13 @@
public static void applyDarknessAround(WorldServer worldserver, Vec3D vec3d, @Nullable Entity entity, int i) {
MobEffect mobeffect = new MobEffect(MobEffects.DARKNESS, 260, 0, false, false);
@@ -25,7 +25,7 @@
Logger logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -445,7 +445,7 @@
@@ -439,7 +439,7 @@
dataresult = AngerManagement.codec(this::canTargetEntity).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("anger")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -34,7 +34,7 @@
this.angerManagement = angermanagement;
});
this.syncClientAngerLevel();
@@ -455,7 +455,7 @@
@@ -449,7 +449,7 @@
dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -43,25 +43,7 @@
this.vibrationData = vibrationsystem_a;
});
}
@@ -489,7 +489,7 @@
public void increaseAngerAt(@Nullable Entity entity, int i, boolean flag) {
if (!this.isNoAi() && this.canTargetEntity(entity)) {
WardenAi.setDigCooldown(this);
- boolean flag1 = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null) instanceof EntityHuman);
+ boolean flag1 = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null) instanceof EntityHuman); // CraftBukkit - decompile error
int j = this.angerManagement.increaseAnger(entity, i);
if (entity instanceof EntityHuman && flag1 && AngerLevel.byAnger(j).isAngry()) {
@@ -510,7 +510,7 @@
@Nullable
@Override
public EntityLiving getTarget() {
- return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
@Override
@@ -553,7 +553,7 @@
@@ -547,7 +547,7 @@
public void setAttackTarget(EntityLiving entityliving) {
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);
@@ -70,3 +52,18 @@
this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
SonicBoom.setCooldown(this, 200);
}
@@ -582,12 +582,12 @@
@Override
protected NavigationAbstract createNavigation(World world) {
- return new Navigation(this, this, world) {
+ return new Navigation(this, world) { // CraftBukkit - decompile error
@Override
protected Pathfinder createPathFinder(int i) {
this.nodeEvaluator = new PathfinderNormal();
this.nodeEvaluator.setCanPassDoors(true);
- return new Pathfinder(this, this.nodeEvaluator, i) {
+ return new Pathfinder(this.nodeEvaluator, i) { // CraftBukkit - decompile error
@Override
protected float distance(PathPoint pathpoint, PathPoint pathpoint1) {
return pathpoint.distanceToXZ(pathpoint1);