1.21.6 dev

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
Bjarne Koll
2025-05-28 13:23:32 +02:00
committed by Nassim Jahnke
parent 39203a65e0
commit a24f9b204c
788 changed files with 41006 additions and 6324 deletions

View File

@@ -64,22 +64,22 @@
this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
@@ -222,11 +_,22 @@
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
protected void readAdditionalSaveData(ValueInput input) {
super.readAdditionalSaveData(input);
this.reassessWeaponGoal();
- }
-
- @Override
- public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem) {
- super.onEquipItem(slot, oldItem, newItem);
+ this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API
+ this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API
+ }
+
+ // Paper start - shouldBurnInDay API
+ @Override
+ public void addAdditionalSaveData(final net.minecraft.nbt.CompoundTag nbt) {
+ super.addAdditionalSaveData(nbt);
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ protected void addAdditionalSaveData(final net.minecraft.world.level.storage.ValueOutput output) {
+ super.addAdditionalSaveData(output);
+ output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ }
+ // Paper end - shouldBurnInDay API
+

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Bogged.java
+++ b/net/minecraft/world/entity/monster/Bogged.java
@@ -73,7 +_,19 @@
@@ -74,7 +_,19 @@
ItemStack itemInHand = player.getItemInHand(hand);
if (itemInHand.is(Items.SHEARS) && this.readyForShearing()) {
if (this.level() instanceof ServerLevel serverLevel) {
@@ -21,7 +21,7 @@
this.gameEvent(GameEvent.SHEAR, player);
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
}
@@ -126,15 +_,33 @@
@@ -127,15 +_,33 @@
@Override
public void shear(ServerLevel level, SoundSource soundSource, ItemStack shears) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Creeper.java
+++ b/net/minecraft/world/entity/monster/Creeper.java
@@ -53,6 +_,7 @@
@@ -54,6 +_,7 @@
public int maxSwell = 30;
public int explosionRadius = 3;
private int droppedSkulls;
@@ -8,16 +8,16 @@
public Creeper(EntityType<? extends Creeper> entityType, Level level) {
super(entityType, level);
@@ -116,7 +_,7 @@
this.maxSwell = compound.getShortOr("Fuse", (short)30);
this.explosionRadius = compound.getByteOr("ExplosionRadius", (byte)3);
if (compound.getBooleanOr("ignited", false)) {
@@ -117,7 +_,7 @@
this.maxSwell = input.getShortOr("Fuse", (short)30);
this.explosionRadius = input.getByteOr("ExplosionRadius", (byte)3);
if (input.getBooleanOr("ignited", false)) {
- this.ignite();
+ this.entityData.set(DATA_IS_IGNITED, true); // Paper - set directly to avoid firing event
}
}
@@ -149,10 +_,11 @@
@@ -150,10 +_,11 @@
}
@Override
@@ -31,7 +31,7 @@
}
@Override
@@ -199,9 +_,20 @@
@@ -200,9 +_,20 @@
@Override
public void thunderHit(ServerLevel level, LightningBolt lightning) {
super.thunderHit(level, lightning);
@@ -52,7 +52,7 @@
@Override
protected InteractionResult mobInteract(Player player, InteractionHand hand) {
ItemStack itemInHand = player.getItemInHand(hand);
@@ -210,8 +_,9 @@
@@ -211,8 +_,9 @@
this.level()
.playSound(player, this.getX(), this.getY(), this.getZ(), soundEvent, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
if (!this.level().isClientSide) {
@@ -63,7 +63,7 @@
itemInHand.shrink(1);
} else {
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
@@ -227,18 +_,29 @@
@@ -228,18 +_,29 @@
public void explodeCreeper() {
if (this.level() instanceof ServerLevel serverLevel) {
float f = this.isPowered() ? 2.0F : 1.0F;
@@ -96,7 +96,7 @@
areaEffectCloud.setRadius(2.5F);
areaEffectCloud.setRadiusOnUse(-0.5F);
areaEffectCloud.setWaitTime(10);
@@ -250,16 +_,27 @@
@@ -251,16 +_,27 @@
areaEffectCloud.addEffect(new MobEffectInstance(mobEffectInstance));
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Drowned.java
+++ b/net/minecraft/world/entity/monster/Drowned.java
@@ -85,7 +_,7 @@
@@ -86,7 +_,7 @@
this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Drowned.class).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, (entity, level) -> this.okTarget(entity)));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EnderMan.java
+++ b/net/minecraft/world/entity/monster/EnderMan.java
@@ -116,9 +_,20 @@
@@ -114,9 +_,20 @@
.add(Attributes.STEP_HEIGHT, 1.0);
}
@@ -23,7 +23,7 @@
AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED);
if (livingEntity == null) {
this.targetChangeTime = 0;
@@ -132,6 +_,7 @@
@@ -130,6 +_,7 @@
attribute.addTransientModifier(SPEED_MODIFIER_ATTACKING);
}
}
@@ -31,7 +31,7 @@
}
@Override
@@ -207,6 +_,15 @@
@@ -203,6 +_,15 @@
}
boolean isBeingStaredBy(Player player) {
@@ -47,7 +47,7 @@
return LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM.test(player) && this.isLookingAtMe(player, 0.025, true, false, new double[]{this.getEyeY()});
}
@@ -246,7 +_,7 @@
@@ -242,7 +_,7 @@
float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
if (lightLevelDependentMagicValue > 0.5F
&& level.canSeeSky(this.blockPosition())
@@ -56,7 +56,7 @@
this.setTarget(null);
this.teleport();
}
@@ -359,21 +_,25 @@
@@ -355,21 +_,25 @@
AbstractThrownPotion abstractThrownPotion1 = damageSource.getDirectEntity() instanceof AbstractThrownPotion abstractThrownPotion
? abstractThrownPotion
: null;
@@ -83,7 +83,7 @@
return flag;
}
@@ -398,6 +_,16 @@
@@ -394,6 +_,16 @@
this.entityData.set(DATA_STARED_AT, true);
}
@@ -100,7 +100,7 @@
@Override
public boolean requiresCustomPersistence() {
return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
@@ -457,16 +_,19 @@
@@ -453,16 +_,19 @@
int floor1 = Mth.floor(this.enderman.getY() + random.nextDouble() * 2.0);
int floor2 = Mth.floor(this.enderman.getZ() - 1.0 + random.nextDouble() * 2.0);
BlockPos blockPos = new BlockPos(floor, floor1, floor2);
@@ -121,7 +121,7 @@
}
}
}
@@ -564,7 +_,7 @@
@@ -560,7 +_,7 @@
} else {
if (this.target != null && !this.enderman.isPassenger()) {
if (this.enderman.isBeingStaredBy((Player)this.target)) {
@@ -130,7 +130,7 @@
this.enderman.teleport();
}
@@ -603,15 +_,18 @@
@@ -599,15 +_,18 @@
int floor1 = Mth.floor(this.enderman.getY() + random.nextDouble() * 3.0);
int floor2 = Mth.floor(this.enderman.getZ() - 2.0 + random.nextDouble() * 4.0);
BlockPos blockPos = new BlockPos(floor, floor1, floor2);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Endermite.java
+++ b/net/minecraft/world/entity/monster/Endermite.java
@@ -122,7 +_,7 @@
@@ -123,7 +_,7 @@
}
if (this.life >= 2400) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Evoker.java
+++ b/net/minecraft/world/entity/monster/Evoker.java
@@ -264,7 +_,7 @@
@@ -247,7 +_,7 @@
serverLevel.getScoreboard().addPlayerToTeam(vex.getScoreboardName(), team);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Ghast.java
+++ b/net/minecraft/world/entity/monster/Ghast.java
@@ -64,6 +_,12 @@
@@ -73,6 +_,12 @@
return this.explosionPower;
}
@@ -13,7 +13,7 @@
@Override
protected boolean shouldDespawnInPeaceful() {
return true;
@@ -276,6 +_,7 @@
@@ -372,6 +_,7 @@
}
LargeFireball largeFireball = new LargeFireball(level, this.ghast, vec3.normalize(), this.ghast.getExplosionPower());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -48,6 +_,11 @@
@@ -49,6 +_,11 @@
@Nullable
public BlockPos anchorPoint;
Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
@@ -12,7 +12,7 @@
public Phantom(EntityType<? extends Phantom> entityType, Level level) {
super(entityType, level);
@@ -142,7 +_,7 @@
@@ -143,7 +_,7 @@
@Override
public void aiStep() {
@@ -21,29 +21,29 @@
this.igniteForSeconds(8.0F);
}
@@ -163,6 +_,10 @@
super.readAdditionalSaveData(compound);
this.anchorPoint = compound.read("anchor_pos", BlockPos.CODEC).orElse(null);
this.setPhantomSize(compound.getIntOr("size", 0));
@@ -178,6 +_,10 @@
super.readAdditionalSaveData(input);
this.anchorPoint = input.read("anchor_pos", BlockPos.CODEC).orElse(null);
this.setPhantomSize(input.getIntOr("size", 0));
+ // Paper start
+ this.spawningEntity = compound.read("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
+ this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true);
+ this.spawningEntity = input.read("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
+ this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true);
+ // Paper end
}
@Override
@@ -170,6 +_,10 @@
super.addAdditionalSaveData(compound);
compound.storeNullable("anchor_pos", BlockPos.CODEC, this.anchorPoint);
compound.putInt("size", this.getPhantomSize());
@@ -185,6 +_,10 @@
super.addAdditionalSaveData(output);
output.storeNullable("anchor_pos", BlockPos.CODEC, this.anchorPoint);
output.putInt("size", this.getPhantomSize());
+ // Paper start
+ compound.storeNullable("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity);
+ compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ output.storeNullable("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity);
+ output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ // Paper end
}
@Override
@@ -243,7 +_,8 @@
@@ -258,7 +_,8 @@
for (Player player : nearbyPlayers) {
if (Phantom.this.canAttack(serverLevel, player, TargetingConditions.DEFAULT)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Pillager.java
+++ b/net/minecraft/world/entity/monster/Pillager.java
@@ -214,7 +_,7 @@
@@ -215,7 +_,7 @@
this.onItemPickup(entity);
ItemStack itemStack = this.inventory.addItem(item);
if (itemStack.isEmpty()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Ravager.java
+++ b/net/minecraft/world/entity/monster/Ravager.java
@@ -154,12 +_,19 @@
@@ -155,12 +_,19 @@
BlockState blockState = serverLevel.getBlockState(blockPos);
Block block = blockState.getBlock();
if (block instanceof LeavesBlock) {
@@ -20,7 +20,7 @@
}
}
@@ -260,7 +_,7 @@
@@ -252,7 +_,7 @@
double d = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double max = Math.max(d * d + d1 * d1, 0.001);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Shulker.java
+++ b/net/minecraft/world/entity/monster/Shulker.java
@@ -277,7 +_,13 @@
@@ -278,7 +_,13 @@
@Override
public void stopRiding() {
@@ -15,7 +15,7 @@
if (this.level().isClientSide) {
this.clientOldAttachPosition = this.blockPosition();
}
@@ -390,6 +_,14 @@
@@ -391,6 +_,14 @@
&& this.level().getWorldBorder().isWithinBounds(blockPos1)
&& this.level().noCollision(this, new AABB(blockPos1).deflate(1.0E-6))) {
Direction direction = this.findAttachableSurface(blockPos1);
@@ -30,7 +30,7 @@
if (direction != null) {
this.unRide();
this.setAttachFace(direction);
@@ -454,7 +_,12 @@
@@ -455,7 +_,12 @@
if (shulker != null) {
shulker.setVariant(this.getVariant());
shulker.snapTo(vec3);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Skeleton.java
+++ b/net/minecraft/world/entity/monster/Skeleton.java
@@ -93,11 +_,17 @@
@@ -94,11 +_,17 @@
}
protected void doFreezeConversion() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Slime.java
+++ b/net/minecraft/world/entity/monster/Slime.java
@@ -57,6 +_,7 @@
@@ -58,6 +_,7 @@
public float squish;
public float oSquish;
private boolean wasOnGround = false;
@@ -8,23 +8,23 @@
public Slime(EntityType<? extends Slime> entityType, Level level) {
super(entityType, level);
@@ -111,6 +_,7 @@
super.addAdditionalSaveData(compound);
compound.putInt("Size", this.getSize() - 1);
compound.putBoolean("wasOnGround", this.wasOnGround);
+ compound.putBoolean("Paper.canWander", this.canWander); // Paper
@@ -112,6 +_,7 @@
super.addAdditionalSaveData(output);
output.putInt("Size", this.getSize() - 1);
output.putBoolean("wasOnGround", this.wasOnGround);
+ output.putBoolean("Paper.canWander", this.canWander); // Paper
}
@Override
@@ -118,6 +_,7 @@
this.setSize(compound.getIntOr("Size", 0) + 1, false);
super.readAdditionalSaveData(compound);
this.wasOnGround = compound.getBooleanOr("wasOnGround", false);
+ this.canWander = compound.getBooleanOr("Paper.canWander", true); // Paper
@@ -119,6 +_,7 @@
this.setSize(input.getIntOr("Size", 0) + 1, false);
super.readAdditionalSaveData(input);
this.wasOnGround = input.getBooleanOr("wasOnGround", false);
+ this.canWander = input.getBooleanOr("Paper.canWander", true); // Paper
}
public boolean isTiny() {
@@ -197,7 +_,7 @@
@@ -198,7 +_,7 @@
}
@Override
@@ -33,7 +33,7 @@
int size = this.getSize();
if (!this.level().isClientSide && size > 1 && this.isDeadOrDying()) {
float width = this.getDimensions(this.getPose()).width();
@@ -205,18 +_,43 @@
@@ -206,18 +_,43 @@
int i = size / 2;
int i1 = 2 + this.random.nextInt(3);
PlayerTeam team = this.getTeam();
@@ -81,7 +81,7 @@
}
@Override
@@ -282,9 +_,13 @@
@@ -283,9 +_,13 @@
return checkMobSpawnRules(entityType, level, spawnReason, pos, random);
}
@@ -97,7 +97,7 @@
&& random.nextFloat() < 0.5F
&& random.nextFloat() < level.getMoonBrightness()
&& level.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) {
@@ -296,8 +_,11 @@
@@ -297,8 +_,11 @@
}
ChunkPos chunkPos = new ChunkPos(pos);
@@ -111,7 +111,7 @@
return checkMobSpawnRules(entityType, level, spawnReason, pos, random);
}
}
@@ -356,6 +_,16 @@
@@ -357,6 +_,16 @@
return super.getDefaultDimensions(pose).scale(this.getSize());
}
@@ -128,7 +128,7 @@
static class SlimeAttackGoal extends Goal {
private final Slime slime;
private int growTiredTimer;
@@ -368,7 +_,16 @@
@@ -369,7 +_,16 @@
@Override
public boolean canUse() {
LivingEntity target = this.slime.getTarget();
@@ -146,7 +146,7 @@
}
@Override
@@ -380,7 +_,16 @@
@@ -381,7 +_,16 @@
@Override
public boolean canContinueToUse() {
LivingEntity target = this.slime.getTarget();
@@ -164,7 +164,7 @@
}
@Override
@@ -399,6 +_,13 @@
@@ -400,6 +_,13 @@
slimeMoveControl.setDirection(this.slime.getYRot(), this.slime.isDealsDamage());
}
}
@@ -178,7 +178,7 @@
}
static class SlimeFloatGoal extends Goal {
@@ -412,7 +_,7 @@
@@ -413,7 +_,7 @@
@Override
public boolean canUse() {
@@ -187,7 +187,7 @@
}
@Override
@@ -442,7 +_,7 @@
@@ -443,7 +_,7 @@
@Override
public boolean canUse() {
@@ -196,7 +196,7 @@
}
@Override
@@ -520,7 +_,7 @@
@@ -521,7 +_,7 @@
@Override
public boolean canUse() {
@@ -205,7 +205,7 @@
&& (this.slime.onGround() || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION))
&& this.slime.getMoveControl() instanceof Slime.SlimeMoveControl;
}
@@ -530,6 +_,11 @@
@@ -531,6 +_,11 @@
if (--this.nextRandomizeTime <= 0) {
this.nextRandomizeTime = this.adjustedTickDelay(40 + this.slime.getRandom().nextInt(60));
this.chosenDegrees = this.slime.getRandom().nextInt(360);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/SpellcasterIllager.java
+++ b/net/minecraft/world/entity/monster/SpellcasterIllager.java
@@ -209,6 +_,11 @@
@@ -210,6 +_,11 @@
public void tick() {
this.attackWarmupDelay--;
if (this.attackWarmupDelay == 0) {

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/entity/monster/Vex.java
+++ b/net/minecraft/world/entity/monster/Vex.java
@@ -286,7 +_,7 @@
@@ -293,7 +_,7 @@
@Override
public void start() {
- Vex.this.setTarget(Vex.this.owner.getTarget());
+ Vex.this.setTarget(Vex.this.owner.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET); // CraftBukkit
Mob owner = Vex.this.getOwner();
- Vex.this.setTarget(owner != null ? owner.getTarget() : null);
+ Vex.this.setTarget(owner != null ? owner.getTarget() : null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET); // CraftBukkit
super.start();
}
}
@@ -345,7 +_,10 @@
@@ -352,7 +_,10 @@
for (int i = 0; i < 3; i++) {
BlockPos blockPos = boundOrigin.offset(Vex.this.random.nextInt(15) - 7, Vex.this.random.nextInt(11) - 5, Vex.this.random.nextInt(15) - 7);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Vindicator.java
+++ b/net/minecraft/world/entity/monster/Vindicator.java
@@ -183,7 +_,7 @@
@@ -184,7 +_,7 @@
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
public VindicatorBreakDoorGoal(Mob mob) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Zombie.java
+++ b/net/minecraft/world/entity/monster/Zombie.java
@@ -68,9 +_,7 @@
@@ -67,9 +_,7 @@
public class Zombie extends Monster {
private static final ResourceLocation SPEED_MODIFIER_BABY_ID = ResourceLocation.withDefaultNamespace("baby");
@@ -11,7 +11,7 @@
private static final ResourceLocation REINFORCEMENT_CALLER_CHARGE_ID = ResourceLocation.withDefaultNamespace("reinforcement_caller_charge");
private static final AttributeModifier ZOMBIE_REINFORCEMENT_CALLEE_CHARGE = new AttributeModifier(
ResourceLocation.withDefaultNamespace("reinforcement_callee_charge"), -0.05F, AttributeModifier.Operation.ADD_VALUE
@@ -91,13 +_,15 @@
@@ -90,13 +_,15 @@
private static final boolean DEFAULT_BABY = false;
private static final boolean DEFAULT_CAN_BREAK_DOORS = false;
private static final int DEFAULT_IN_WATER_TIME = 0;
@@ -28,7 +28,7 @@
}
public Zombie(Level level) {
@@ -106,7 +_,7 @@
@@ -105,7 +_,7 @@
@Override
protected void registerGoals() {
@@ -37,7 +37,7 @@
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
this.addBehaviourGoals();
@@ -118,7 +_,7 @@
@@ -117,7 +_,7 @@
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
@@ -46,7 +46,7 @@
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
}
@@ -172,11 +_,16 @@
@@ -171,11 +_,16 @@
@Override
protected int getBaseExperienceReward(ServerLevel level) {
@@ -64,7 +64,7 @@
}
@Override
@@ -184,9 +_,9 @@
@@ -183,9 +_,9 @@
this.getEntityData().set(DATA_BABY_ID, childZombie);
if (this.level() != null && !this.level().isClientSide) {
AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED);
@@ -76,7 +76,7 @@
}
}
}
@@ -255,6 +_,13 @@
@@ -254,6 +_,13 @@
super.aiStep();
}
@@ -90,7 +90,7 @@
public void startUnderWaterConversion(int conversionTime) {
this.conversionTime = conversionTime;
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, true);
@@ -268,31 +_,50 @@
@@ -267,31 +_,50 @@
}
protected void convertToZombieType(EntityType<? extends Zombie> entityType) {
@@ -150,7 +150,7 @@
@Override
public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {
@@ -325,13 +_,13 @@
@@ -324,13 +_,13 @@
if (SpawnPlacements.isSpawnPositionOk(type, level, blockPos)
&& SpawnPlacements.checkSpawnRules(type, level, EntitySpawnReason.REINFORCEMENT, blockPos, level.random)) {
zombie.setPos(i1, i2, i3);
@@ -167,7 +167,7 @@
AttributeInstance attribute = this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
AttributeModifier modifier = attribute.getModifier(REINFORCEMENT_CALLER_CHARGE_ID);
double d = modifier != null ? modifier.amount() : 0.0;
@@ -356,7 +_,12 @@
@@ -355,7 +_,12 @@
if (flag) {
float effectiveDifficulty = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < effectiveDifficulty * 0.3F) {
@@ -181,19 +181,19 @@
}
}
@@ -416,6 +_,7 @@
compound.putBoolean("CanBreakDoors", this.canBreakDoors());
compound.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
compound.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
+ compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
@@ -415,6 +_,7 @@
output.putBoolean("CanBreakDoors", this.canBreakDoors());
output.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
output.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
+ output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
}
@Override
@@ -430,13 +_,15 @@
@@ -429,13 +_,15 @@
} else {
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, false);
}
+ this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - Add more Zombie API
+ this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - Add more Zombie API
}
@Override
@@ -207,7 +207,7 @@
return flag;
}
@@ -472,7 +_,7 @@
@@ -471,7 +_,7 @@
spawnGroupData = super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
float specialMultiplier = difficulty.getSpecialMultiplier();
if (spawnReason != EntitySpawnReason.CONVERSION) {
@@ -216,7 +216,7 @@
}
if (spawnGroupData == null) {
@@ -499,7 +_,7 @@
@@ -498,7 +_,7 @@
chicken1.finalizeSpawn(level, difficulty, EntitySpawnReason.JOCKEY, null);
chicken1.setChickenJockey(true);
this.startRiding(chicken1);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -160,12 +_,20 @@
@@ -159,12 +_,20 @@
}
public void startConverting(@Nullable UUID conversionStarter, int villagerConversionTime) {
@@ -24,7 +24,7 @@
}
@Override
@@ -190,7 +_,7 @@
@@ -189,7 +_,7 @@
}
private void finishConversion(ServerLevel level) {
@@ -32,21 +32,21 @@
+ Villager converted = this.convertTo( // CraftBukkit
EntityType.VILLAGER,
ConversionParams.single(this, false, false),
villager -> {
@@ -214,19 +_,24 @@
villager.finalizeSpawn(level, level.getCurrentDifficultyAt(villager.blockPosition()), EntitySpawnReason.CONVERSION, null);
villager.refreshBrain(level);
mob -> {
@@ -213,19 +_,24 @@
mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CONVERSION, null);
mob.refreshBrain(level);
if (this.conversionStarter != null) {
- Player playerByUuid = level.getPlayerByUUID(this.conversionStarter);
+ Player playerByUuid = level.getGlobalPlayerByUUID(this.conversionStarter); // Paper - check global player list where appropriate
if (playerByUuid instanceof ServerPlayer) {
CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer)playerByUuid, this, villager);
level.onReputationEvent(ReputationEventType.ZOMBIE_VILLAGER_CURED, playerByUuid, villager);
CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer)playerByUuid, this, mob);
level.onReputationEvent(ReputationEventType.ZOMBIE_VILLAGER_CURED, playerByUuid, mob);
}
}
- villager.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0));
+ villager.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
- mob.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0));
+ mob.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
if (!this.isSilent()) {
level.levelEvent(null, 1027, this.blockPosition(), 0);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -56,6 +_,7 @@
@@ -57,6 +_,7 @@
private static final int ALERT_RANGE_Y = 10;
private static final UniformInt ALERT_INTERVAL = TimeUtil.rangeOfSeconds(4, 6);
private int ticksUntilNextAlert;
@@ -8,7 +8,7 @@
public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> entityType, Level level) {
super(entityType, level);
@@ -71,7 +_,7 @@
@@ -72,7 +_,7 @@
protected void addBehaviourGoals() {
this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0, false));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
@@ -17,7 +17,7 @@
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
}
@@ -144,7 +_,7 @@
@@ -145,7 +_,7 @@
.filter(zombifiedPiglin -> zombifiedPiglin != this)
.filter(zombifiedPiglin -> zombifiedPiglin.getTarget() == null)
.filter(zombifiedPiglin -> !zombifiedPiglin.isAlliedTo(this.getTarget()))
@@ -26,7 +26,7 @@
}
private void playAngerSound() {
@@ -152,18 +_,27 @@
@@ -153,18 +_,27 @@
}
@Override

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/creaking/Creaking.java
+++ b/net/minecraft/world/entity/monster/creaking/Creaking.java
@@ -191,9 +_,9 @@
@@ -192,9 +_,9 @@
}
@Override
@@ -12,7 +12,7 @@
}
}
@@ -318,7 +_,7 @@
@@ -319,7 +_,7 @@
}
this.makeSound(this.getDeathSound());
@@ -21,7 +21,7 @@
}
public void creakingDeathEffects(DamageSource damageSource) {
@@ -471,9 +_,9 @@
@@ -472,9 +_,9 @@
}
@Override

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -265,7 +_,12 @@
@@ -266,7 +_,12 @@
}
private void finishConversion() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
+++ b/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
@@ -102,9 +_,14 @@
@@ -101,9 +_,14 @@
}
protected void finishConversion(ServerLevel serverLevel) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -124,6 +_,12 @@
@@ -125,6 +_,12 @@
MemoryModuleType.ATE_RECENTLY,
MemoryModuleType.NEAREST_REPELLENT
);
@@ -13,29 +13,29 @@
public Piglin(EntityType<? extends AbstractPiglin> entityType, Level level) {
super(entityType, level);
@@ -136,6 +_,10 @@
compound.putBoolean("IsBaby", this.isBaby());
compound.putBoolean("CannotHunt", this.cannotHunt);
this.writeInventoryToTag(compound, this.registryAccess());
@@ -137,6 +_,10 @@
output.putBoolean("IsBaby", this.isBaby());
output.putBoolean("CannotHunt", this.cannotHunt);
this.writeInventoryToTag(output);
+ // CraftBukkit start
+ compound.store("Bukkit.BarterList", ITEM_SET_CODEC, this.allowedBarterItems);
+ compound.store("Bukkit.InterestList", ITEM_SET_CODEC, this.interestItems);
+ output.store("Bukkit.BarterList", ITEM_SET_CODEC, this.allowedBarterItems);
+ output.store("Bukkit.InterestList", ITEM_SET_CODEC, this.interestItems);
+ // CraftBukkit end
}
@Override
@@ -144,6 +_,10 @@
this.setBaby(compound.getBooleanOr("IsBaby", false));
this.setCannotHunt(compound.getBooleanOr("CannotHunt", false));
this.readInventoryFromTag(compound, this.registryAccess());
@@ -145,6 +_,10 @@
this.setBaby(input.getBooleanOr("IsBaby", false));
this.setCannotHunt(input.getBooleanOr("CannotHunt", false));
this.readInventoryFromTag(input);
+ // CraftBukkit start
+ this.allowedBarterItems = compound.read("Bukkit.BarterList", ITEM_SET_CODEC).orElseGet(java.util.HashSet::new);
+ this.interestItems = compound.read("Bukkit.InterestList", ITEM_SET_CODEC).orElseGet(java.util.HashSet::new);
+ this.allowedBarterItems = input.read("Bukkit.BarterList", ITEM_SET_CODEC).orElseGet(java.util.HashSet::new);
+ this.interestItems = input.read("Bukkit.InterestList", ITEM_SET_CODEC).orElseGet(java.util.HashSet::new);
+ // CraftBukkit end
}
@VisibleForDebug
@@ -321,7 +_,9 @@
@@ -322,7 +_,9 @@
@Override
protected void finishConversion(ServerLevel serverLevel) {
PiglinAi.cancelAdmiring(serverLevel, this);
@@ -45,7 +45,7 @@
super.finishConversion(serverLevel);
}
@@ -397,7 +_,7 @@
@@ -398,7 +_,7 @@
}
protected void holdInOffHand(ItemStack stack) {
@@ -54,7 +54,7 @@
this.setItemSlot(EquipmentSlot.OFFHAND, stack);
this.setGuaranteedDrop(EquipmentSlot.OFFHAND);
} else {
@@ -422,15 +_,15 @@
@@ -423,15 +_,15 @@
return false;
} else {
TagKey<Item> preferredWeaponType = this.getPreferredWeaponType();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -404,7 +_,7 @@
@@ -402,7 +_,7 @@
public static void applyDarknessAround(ServerLevel level, Vec3 pos, @Nullable Entity source, int radius) {
MobEffectInstance mobEffectInstance = new MobEffectInstance(MobEffects.DARKNESS, 260, 0, false, false);
@@ -9,7 +9,7 @@
}
@Override
@@ -450,6 +_,15 @@
@@ -446,6 +_,15 @@
@VisibleForTesting
public void increaseAngerAt(@Nullable Entity entity, int offset, boolean playListeningSound) {
if (!this.isNoAi() && this.canTargetEntity(entity)) {