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:
committed by
Nassim Jahnke
parent
39203a65e0
commit
a24f9b204c
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/entity/animal/Animal.java
|
||||
+++ b/net/minecraft/world/entity/animal/Animal.java
|
||||
@@ -41,6 +_,7 @@
|
||||
@@ -42,6 +_,7 @@
|
||||
public int inLove = 0;
|
||||
@Nullable
|
||||
public UUID loveCause;
|
||||
public EntityReference<ServerPlayer> loveCause;
|
||||
+ public @Nullable ItemStack breedItem; // CraftBukkit - Add breedItem variable
|
||||
|
||||
protected Animal(EntityType<? extends Animal> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -80,9 +_,13 @@
|
||||
@@ -81,9 +_,13 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -24,18 +24,18 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,8 +_,9 @@
|
||||
@@ -139,8 +_,9 @@
|
||||
if (this.isFood(itemInHand)) {
|
||||
int age = this.getAge();
|
||||
if (!this.level().isClientSide && age == 0 && this.canFallInLove()) {
|
||||
if (player instanceof ServerPlayer serverPlayer && age == 0 && this.canFallInLove()) {
|
||||
+ final ItemStack breedCopy = itemInHand.copy(); // Paper - Fix EntityBreedEvent copying
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
- this.setInLove(player);
|
||||
+ this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying
|
||||
- this.setInLove(serverPlayer);
|
||||
+ this.setInLove(serverPlayer, breedCopy); // Paper - Fix EntityBreedEvent copying
|
||||
this.playEatingSound();
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
}
|
||||
@@ -176,8 +_,23 @@
|
||||
@@ -177,8 +_,23 @@
|
||||
return this.inLove <= 0;
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@
|
||||
+ }
|
||||
+ this.inLove = entityEnterLoveModeEvent.getTicksInLove();
|
||||
+ // CraftBukkit end
|
||||
if (player != null) {
|
||||
this.loveCause = player.getUUID();
|
||||
if (player instanceof ServerPlayer serverPlayer) {
|
||||
this.loveCause = new EntityReference<>(serverPlayer);
|
||||
}
|
||||
@@ -220,23 +_,45 @@
|
||||
@@ -216,23 +_,45 @@
|
||||
if (breedOffspring != null) {
|
||||
breedOffspring.setBaby(true);
|
||||
breedOffspring.snapTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
@@ -108,7 +108,7 @@
|
||||
- if (level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
- level.addFreshEntity(new ExperienceOrb(level, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1));
|
||||
+ if (experience > 0 && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - Call EntityBreedEvent
|
||||
+ level.addFreshEntity(new ExperienceOrb(level, this.getX(), this.getY(), this.getZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, player, baby)); // Paper - Call EntityBreedEvent, add spawn context
|
||||
+ level.addFreshEntity(new ExperienceOrb(level, this.position(), net.minecraft.world.phys.Vec3.ZERO, experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, player, baby)); // Paper - Call EntityBreedEvent, add spawn context
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -145,10 +_,26 @@
|
||||
@@ -146,10 +_,26 @@
|
||||
Bee.BeeGoToHiveGoal goToHiveGoal;
|
||||
private Bee.BeeGoToKnownFlowerGoal goToKnownFlowerGoal;
|
||||
private int underWaterTicks;
|
||||
@@ -28,26 +28,26 @@
|
||||
this.lookControl = new Bee.BeeLookControl(this);
|
||||
this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F);
|
||||
this.setPathfindingMalus(PathType.WATER, -1.0F);
|
||||
@@ -195,9 +_,18 @@
|
||||
@@ -196,9 +_,18 @@
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag compound) {
|
||||
protected void addAdditionalSaveData(ValueOutput output) {
|
||||
+ // CraftBukkit start - selectively save data
|
||||
+ this.addAdditionalSaveData(compound, true);
|
||||
+ this.addAdditionalSaveData(output, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void addAdditionalSaveData(CompoundTag compound, boolean saveAll) {
|
||||
+ public void addAdditionalSaveData(ValueOutput output, boolean saveAll) {
|
||||
+ // CraftBukkit end
|
||||
super.addAdditionalSaveData(compound);
|
||||
super.addAdditionalSaveData(output);
|
||||
+ if (saveAll) { // Paper
|
||||
compound.storeNullable("hive_pos", BlockPos.CODEC, this.hivePos);
|
||||
compound.storeNullable("flower_pos", BlockPos.CODEC, this.savedFlowerPos);
|
||||
output.storeNullable("hive_pos", BlockPos.CODEC, this.hivePos);
|
||||
output.storeNullable("flower_pos", BlockPos.CODEC, this.savedFlowerPos);
|
||||
+ } // Paper
|
||||
compound.putBoolean("HasNectar", this.hasNectar());
|
||||
compound.putBoolean("HasStung", this.hasStung());
|
||||
compound.putInt("TicksSincePollination", this.ticksWithoutNectarSinceExitingHive);
|
||||
@@ -235,7 +_,7 @@
|
||||
output.putBoolean("HasNectar", this.hasNectar());
|
||||
output.putBoolean("HasStung", this.hasStung());
|
||||
output.putInt("TicksSincePollination", this.ticksWithoutNectarSinceExitingHive);
|
||||
@@ -236,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +_,11 @@
|
||||
@@ -491,7 +_,11 @@
|
||||
if (this.hivePos == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,6 +_,7 @@
|
||||
@@ -524,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setRolling(boolean isRolling) {
|
||||
@@ -77,7 +77,7 @@
|
||||
this.setFlag(2, isRolling);
|
||||
}
|
||||
|
||||
@@ -579,7 +_,7 @@
|
||||
@@ -580,7 +_,7 @@
|
||||
if (beeInteractionEffect != null) {
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -648,8 +_,9 @@
|
||||
@@ -649,8 +_,9 @@
|
||||
if (this.isInvulnerableTo(level, damageSource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -97,25 +97,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,7 +_,7 @@
|
||||
@VisibleForDebug
|
||||
public class BeeGoToHiveGoal extends Bee.BaseBeeGoal {
|
||||
public static final int MAX_TRAVELLING_TICKS = 2400;
|
||||
- int travellingTicks = Bee.this.level().random.nextInt(10);
|
||||
+ int travellingTicks = Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues
|
||||
private static final int MAX_BLACKLISTED_TARGETS = 3;
|
||||
final List<BlockPos> blacklistedTargets = Lists.newArrayList();
|
||||
@Nullable
|
||||
@@ -886,7 +_,7 @@
|
||||
|
||||
public class BeeGoToKnownFlowerGoal extends Bee.BaseBeeGoal {
|
||||
private static final int MAX_TRAVELLING_TICKS = 2400;
|
||||
- int travellingTicks = Bee.this.level().random.nextInt(10);
|
||||
+ int travellingTicks = Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues
|
||||
|
||||
BeeGoToKnownFlowerGoal() {
|
||||
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
|
||||
@@ -983,7 +_,7 @@
|
||||
@@ -981,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +106,7 @@
|
||||
Bee.this.level().levelEvent(2011, blockPos, 15);
|
||||
Bee.this.level().setBlockAndUpdate(blockPos, blockState1);
|
||||
Bee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1007,7 +_,7 @@
|
||||
@@ -1005,7 +_,7 @@
|
||||
@Override
|
||||
protected void alertOther(Mob mob, LivingEntity target) {
|
||||
if (mob instanceof Bee && this.mob.hasLineOfSight(target)) {
|
||||
@@ -133,7 +115,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1165,7 +_,7 @@
|
||||
@@ -1163,7 +_,7 @@
|
||||
Bee.this.dropFlower();
|
||||
this.pollinating = false;
|
||||
Bee.this.remainingCooldownBeforeLocatingNewFlower = 200;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Cat.java
|
||||
+++ b/net/minecraft/world/entity/animal/Cat.java
|
||||
@@ -372,6 +_,11 @@
|
||||
@@ -373,6 +_,11 @@
|
||||
if (item instanceof DyeItem dyeItem) {
|
||||
DyeColor dyeColor = dyeItem.getDyeColor();
|
||||
if (dyeColor != this.getCollarColor()) {
|
||||
@@ -12,7 +12,7 @@
|
||||
if (!this.level().isClientSide()) {
|
||||
this.setCollarColor(dyeColor);
|
||||
itemInHand.consume(1, player);
|
||||
@@ -384,7 +_,7 @@
|
||||
@@ -385,7 +_,7 @@
|
||||
if (!this.level().isClientSide()) {
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD);
|
||||
@@ -21,7 +21,7 @@
|
||||
this.playEatingSound();
|
||||
}
|
||||
|
||||
@@ -446,7 +_,7 @@
|
||||
@@ -447,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void tryToTame(Player player) {
|
||||
@@ -30,7 +30,7 @@
|
||||
this.tame(player);
|
||||
this.setOrderedToSit(true);
|
||||
this.level().broadcastEntityEvent(this, (byte)7);
|
||||
@@ -580,15 +_,20 @@
|
||||
@@ -581,15 +_,20 @@
|
||||
.dropFromGiftLootTable(
|
||||
getServerLevel(this.cat),
|
||||
BuiltInLootTables.CAT_MORNING_GIFT,
|
||||
@@ -55,7 +55,7 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -615,7 +_,7 @@
|
||||
@@ -616,7 +_,7 @@
|
||||
|
||||
static class CatTemptGoal extends TemptGoal {
|
||||
@Nullable
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Chicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/Chicken.java
|
||||
@@ -111,10 +_,12 @@
|
||||
@@ -112,10 +_,12 @@
|
||||
|
||||
this.flap = this.flap + this.flapping * 2.0F;
|
||||
if (this.level() instanceof ServerLevel serverLevel && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -98,6 +_,13 @@
|
||||
@@ -99,6 +_,13 @@
|
||||
return EntityType.DOLPHIN.create(level, EntitySpawnReason.BREEDING);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
@Override
|
||||
public float getAgeScale() {
|
||||
return this.isBaby() ? 0.65F : 1.0F;
|
||||
@@ -182,7 +_,7 @@
|
||||
@@ -183,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -215,11 +_,15 @@
|
||||
@@ -216,11 +_,15 @@
|
||||
if (this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) {
|
||||
ItemStack item = entity.getItem();
|
||||
if (this.canHoldItem(item)) {
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -486,7 +_,7 @@
|
||||
@@ -487,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -505,7 +_,7 @@
|
||||
@@ -506,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -575,7 +_,7 @@
|
||||
@@ -576,7 +_,7 @@
|
||||
0.3F * Mth.cos(Dolphin.this.getYRot() * (float) (Math.PI / 180.0)) * Mth.cos(Dolphin.this.getXRot() * (float) (Math.PI / 180.0))
|
||||
+ Mth.sin(f1) * f2
|
||||
);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -429,7 +_,7 @@
|
||||
compound.read("Trusted", TRUSTED_LIST_CODEC).orElse(List.of()).forEach(this::addTrustedEntity);
|
||||
this.setSleeping(compound.getBooleanOr("Sleeping", false));
|
||||
this.setVariant(compound.read("Type", Fox.Variant.CODEC).orElse(Fox.Variant.DEFAULT));
|
||||
- this.setSitting(compound.getBooleanOr("Sitting", false));
|
||||
+ this.setSitting(compound.getBooleanOr("Sitting", false), false); // Paper - Add EntityToggleSitEvent
|
||||
this.setIsCrouching(compound.getBooleanOr("Crouching", false));
|
||||
@@ -430,7 +_,7 @@
|
||||
input.read("Trusted", TRUSTED_LIST_CODEC).orElse(List.of()).forEach(this::addTrustedEntity);
|
||||
this.setSleeping(input.getBooleanOr("Sleeping", false));
|
||||
this.setVariant(input.read("Type", Fox.Variant.CODEC).orElse(Fox.Variant.DEFAULT));
|
||||
- this.setSitting(input.getBooleanOr("Sitting", false));
|
||||
+ this.setSitting(input.getBooleanOr("Sitting", false), false); // Paper - Add EntityToggleSitEvent
|
||||
this.setIsCrouching(input.getBooleanOr("Crouching", false));
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
this.setTargetGoals();
|
||||
@@ -446,6 +_,12 @@
|
||||
@@ -447,6 +_,12 @@
|
||||
}
|
||||
|
||||
public void setSitting(boolean sitting) {
|
||||
@@ -22,7 +22,7 @@
|
||||
this.setFlag(1, sitting);
|
||||
}
|
||||
|
||||
@@ -505,19 +_,20 @@
|
||||
@@ -506,19 +_,20 @@
|
||||
itemEntity.setPickUpDelay(40);
|
||||
itemEntity.setThrower(this);
|
||||
this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F);
|
||||
@@ -46,7 +46,7 @@
|
||||
int count = item.getCount();
|
||||
if (count > 1) {
|
||||
this.dropItemStack(item.split(count - 1));
|
||||
@@ -528,7 +_,7 @@
|
||||
@@ -529,7 +_,7 @@
|
||||
this.setItemSlot(EquipmentSlot.MAINHAND, item.split(1));
|
||||
this.setGuaranteedDrop(EquipmentSlot.MAINHAND);
|
||||
this.take(entity, item.getCount());
|
||||
@@ -55,7 +55,7 @@
|
||||
this.ticksSinceEaten = 0;
|
||||
}
|
||||
}
|
||||
@@ -623,12 +_,12 @@
|
||||
@@ -620,12 +_,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +70,7 @@
|
||||
}
|
||||
|
||||
void wakeUp() {
|
||||
@@ -692,15 +_,33 @@
|
||||
@@ -689,15 +_,33 @@
|
||||
return this.getTrustedEntities().anyMatch(entityReference -> entityReference.matches(entity));
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
}
|
||||
|
||||
public static boolean isPathClear(Fox fox, LivingEntity livingEntity) {
|
||||
@@ -876,6 +_,19 @@
|
||||
@@ -873,6 +_,19 @@
|
||||
fox.addTrustedEntity(loveCause1);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
if (serverPlayer != null) {
|
||||
serverPlayer.awardStat(Stats.ANIMALS_BRED);
|
||||
CriteriaTriggers.BRED_ANIMALS.trigger(serverPlayer, this.animal, this.partner, fox);
|
||||
@@ -885,14 +_,12 @@
|
||||
@@ -882,14 +_,12 @@
|
||||
this.partner.setAge(6000);
|
||||
this.animal.resetLove();
|
||||
this.partner.resetLove();
|
||||
@@ -142,11 +142,11 @@
|
||||
this.level
|
||||
.addFreshEntity(
|
||||
- new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), this.animal.getRandom().nextInt(7) + 1)
|
||||
+ new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, loveCause, fox) // Paper - call EntityBreedEvent, add spawn context
|
||||
+ new ExperienceOrb(this.level, this.animal.position(), net.minecraft.world.phys.Vec3.ZERO, experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, loveCause, fox) // Paper - call EntityBreedEvent, add spawn context
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -956,6 +_,7 @@
|
||||
@@ -953,6 +_,7 @@
|
||||
private void pickSweetBerries(BlockState state) {
|
||||
int ageValue = state.getValue(SweetBerryBushBlock.AGE);
|
||||
state.setValue(SweetBerryBushBlock.AGE, 1);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--- a/net/minecraft/world/entity/animal/HappyGhast.java
|
||||
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
|
||||
@@ -296,8 +_,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void removePassenger(Entity passenger) {
|
||||
- super.removePassenger(passenger);
|
||||
+ // Paper start - cancellable passengers
|
||||
+ protected boolean removePassenger(Entity passenger, boolean suppressCancellation) {
|
||||
+ if (!super.removePassenger(passenger, suppressCancellation)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end - cancellable passengers
|
||||
if (!this.level().isClientSide) {
|
||||
this.setServerStillTimeout(10);
|
||||
}
|
||||
@@ -306,6 +_,7 @@
|
||||
this.clearHome();
|
||||
this.level().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.HARNESS_GOGGLES_UP, this.getSoundSource(), 1.0F, 1.0F);
|
||||
}
|
||||
+ return true; // Paper - cancellable passengers
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/IronGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/IronGolem.java
|
||||
@@ -105,7 +_,7 @@
|
||||
@@ -106,7 +_,7 @@
|
||||
@Override
|
||||
protected void doPush(Entity entity) {
|
||||
if (entity instanceof Enemy && !(entity instanceof Creeper) && this.getRandom().nextInt(20) == 0) {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
super.doPush(entity);
|
||||
@@ -304,7 +_,7 @@
|
||||
@@ -305,7 +_,7 @@
|
||||
BlockPos blockPos = this.blockPosition();
|
||||
BlockPos blockPos1 = blockPos.below();
|
||||
BlockState blockState = level.getBlockState(blockPos1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
@@ -116,7 +_,17 @@
|
||||
@@ -117,7 +_,17 @@
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if (itemInHand.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
@@ -19,7 +19,7 @@
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
}
|
||||
@@ -169,15 +_,31 @@
|
||||
@@ -170,15 +_,31 @@
|
||||
|
||||
@Override
|
||||
public void shear(ServerLevel level, SoundSource soundSource, ItemStack shears) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Ocelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/Ocelot.java
|
||||
@@ -126,7 +_,7 @@
|
||||
@@ -127,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean removeWhenFarAway(double distanceToClosestPlayer) {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
@@ -160,7 +_,7 @@
|
||||
@@ -161,7 +_,7 @@
|
||||
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemInHand) && player.distanceToSqr(this) < 9.0) {
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
if (!this.level().isClientSide) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Panda.java
|
||||
+++ b/net/minecraft/world/entity/animal/Panda.java
|
||||
@@ -128,6 +_,7 @@
|
||||
@@ -129,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void sit(boolean sitting) {
|
||||
@@ -8,7 +8,7 @@
|
||||
this.setFlag(8, sitting);
|
||||
}
|
||||
|
||||
@@ -517,24 +_,28 @@
|
||||
@@ -518,24 +_,28 @@
|
||||
|
||||
for (Panda panda : level.getEntitiesOfClass(Panda.class, this.getBoundingBox().inflate(10.0))) {
|
||||
if (!panda.isBaby() && panda.onGround() && !panda.isInWater() && panda.canPerformAction()) {
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,8 +_,9 @@
|
||||
@@ -626,8 +_,9 @@
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
this.ageUp((int)(-this.getAge() / 20 * 0.1F), true);
|
||||
} else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) {
|
||||
@@ -50,7 +50,7 @@
|
||||
} else {
|
||||
if (!(this.level() instanceof ServerLevel serverLevel) || this.isSitting() || this.isInWater()) {
|
||||
return InteractionResult.PASS;
|
||||
@@ -636,7 +_,9 @@
|
||||
@@ -637,7 +_,9 @@
|
||||
this.eat(true);
|
||||
ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.MAINHAND);
|
||||
if (!itemBySlot.isEmpty() && !player.hasInfiniteMaterials()) {
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemInHand.getItem(), 1));
|
||||
@@ -858,7 +_,7 @@
|
||||
@@ -859,7 +_,7 @@
|
||||
@Override
|
||||
protected void alertOther(Mob mob, LivingEntity target) {
|
||||
if (mob instanceof Panda && mob.isAggressive()) {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1087,7 +_,9 @@
|
||||
@@ -1088,7 +_,9 @@
|
||||
public void stop() {
|
||||
ItemStack itemBySlot = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
|
||||
if (!itemBySlot.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -262,7 +_,7 @@
|
||||
@@ -264,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -9,7 +9,7 @@
|
||||
this.tame(player);
|
||||
this.level().broadcastEntityEvent(this, (byte)7);
|
||||
} else {
|
||||
@@ -283,7 +_,7 @@
|
||||
@@ -285,7 +_,7 @@
|
||||
}
|
||||
} else {
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
@@ -18,7 +18,7 @@
|
||||
if (player.isCreative() || !this.isInvulnerable()) {
|
||||
this.hurt(this.damageSources().playerAttack(player), Float.MAX_VALUE);
|
||||
}
|
||||
@@ -378,8 +_,8 @@
|
||||
@@ -380,8 +_,8 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,7 +29,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -394,8 +_,13 @@
|
||||
@@ -396,8 +_,13 @@
|
||||
if (this.isInvulnerableTo(level, damageSource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Pig.java
|
||||
+++ b/net/minecraft/world/entity/animal/Pig.java
|
||||
@@ -214,7 +_,14 @@
|
||||
@@ -215,7 +_,14 @@
|
||||
}
|
||||
|
||||
mob.setPersistenceRequired();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Pufferfish.java
|
||||
+++ b/net/minecraft/world/entity/animal/Pufferfish.java
|
||||
@@ -96,24 +_,36 @@
|
||||
@@ -97,24 +_,36 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) {
|
||||
if (this.inflateCounter > 0) {
|
||||
@@ -37,7 +37,7 @@
|
||||
this.deflateTimer++;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +_,7 @@
|
||||
@@ -138,7 +_,7 @@
|
||||
private void touch(ServerLevel level, Mob mob) {
|
||||
int puffState = this.getPuffState();
|
||||
if (mob.hurtServer(level, this.damageSources().mobAttack(this), 1 + puffState)) {
|
||||
@@ -46,7 +46,7 @@
|
||||
this.playSound(SoundEvents.PUFFER_FISH_STING, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -152,7 +_,7 @@
|
||||
@@ -153,7 +_,7 @@
|
||||
serverPlayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.PUFFER_FISH_STING, 0.0F));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Rabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/Rabbit.java
|
||||
@@ -95,7 +_,7 @@
|
||||
@@ -96,7 +_,7 @@
|
||||
super(entityType, level);
|
||||
this.jumpControl = new Rabbit.RabbitJumpControl(this);
|
||||
this.moveControl = new Rabbit.RabbitMoveControl(this);
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -588,9 +_,11 @@
|
||||
@@ -589,9 +_,11 @@
|
||||
if (this.canRaid && block instanceof CarrotBlock) {
|
||||
int ageValue = blockState.getValue(CarrotBlock.AGE);
|
||||
if (ageValue == 0) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/animal/ShoulderRidingEntity.java
|
||||
+++ b/net/minecraft/world/entity/animal/ShoulderRidingEntity.java
|
||||
@@ -19,7 +_,7 @@
|
||||
compoundTag.putString("id", this.getEncodeId());
|
||||
this.saveWithoutId(compoundTag);
|
||||
if (player.setEntityOnShoulder(compoundTag)) {
|
||||
- this.discard();
|
||||
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -24,7 +_,7 @@
|
||||
this.saveWithoutId(tagValueOutput);
|
||||
tagValueOutput.putString("id", this.getEncodeId());
|
||||
if (player.setEntityOnShoulder(tagValueOutput.buildResult())) {
|
||||
- this.discard();
|
||||
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -91,7 +_,7 @@
|
||||
@@ -92,7 +_,7 @@
|
||||
super.aiStep();
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
@@ -106,7 +_,7 @@
|
||||
@@ -107,7 +_,7 @@
|
||||
int floor2 = Mth.floor(this.getZ() + (i / 2 % 2 * 2 - 1) * 0.25F);
|
||||
BlockPos blockPos = new BlockPos(floor, floor1, floor2);
|
||||
if (this.level().getBlockState(blockPos).isAir() && blockState.canSurvive(this.level(), blockPos)) {
|
||||
@@ -18,7 +18,7 @@
|
||||
this.level().gameEvent(GameEvent.BLOCK_PLACE, blockPos, GameEvent.Context.of(this, blockState));
|
||||
}
|
||||
}
|
||||
@@ -134,7 +_,19 @@
|
||||
@@ -135,7 +_,19 @@
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
if (itemInHand.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
@@ -39,7 +39,7 @@
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
}
|
||||
@@ -147,11 +_,29 @@
|
||||
@@ -148,11 +_,29 @@
|
||||
|
||||
@Override
|
||||
public void shear(ServerLevel level, SoundSource soundSource, ItemStack shears) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Turtle.java
|
||||
+++ b/net/minecraft/world/entity/animal/Turtle.java
|
||||
@@ -259,7 +_,9 @@
|
||||
@@ -260,7 +_,9 @@
|
||||
protected void ageBoundaryReached() {
|
||||
super.ageBoundaryReached();
|
||||
if (!this.isBaby() && this.level() instanceof ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +_,7 @@
|
||||
@@ -285,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void thunderHit(ServerLevel level, LightningBolt lightning) {
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -311,6 +_,10 @@
|
||||
@@ -312,6 +_,10 @@
|
||||
if (loveCause == null && this.partner.getLoveCause() != null) {
|
||||
loveCause = this.partner.getLoveCause();
|
||||
}
|
||||
@@ -30,16 +30,16 @@
|
||||
|
||||
if (loveCause != null) {
|
||||
loveCause.awardStat(Stats.ANIMALS_BRED);
|
||||
@@ -324,7 +_,7 @@
|
||||
@@ -325,7 +_,7 @@
|
||||
this.partner.resetLove();
|
||||
RandomSource random = this.animal.getRandom();
|
||||
if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), random.nextInt(7) + 1));
|
||||
+ if (event.getExperience() > 0) this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), event.getExperience(), org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, loveCause)); // Paper - Add EntityFertilizeEggEvent event
|
||||
+ if (event.getExperience() > 0) this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.position(), Vec3.ZERO, event.getExperience(), org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, loveCause, this.turtle)); // Paper - Add EntityFertilizeEggEvent event
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,7 +_,7 @@
|
||||
@@ -348,7 +_,7 @@
|
||||
&& (
|
||||
this.turtle.hasEgg()
|
||||
|| this.turtle.getRandom().nextInt(reducedTickDelay(700)) == 0 && !this.turtle.homePos.closerToCenterThan(this.turtle.position(), 64.0)
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -455,14 +_,20 @@
|
||||
@@ -456,14 +_,20 @@
|
||||
BlockPos blockPos = this.turtle.blockPosition();
|
||||
if (!this.turtle.isInWater() && this.isReachedTarget()) {
|
||||
if (this.turtle.layEggCounter < 1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -116,6 +_,7 @@
|
||||
@@ -113,6 +_,7 @@
|
||||
private float dancingAnimationTicks;
|
||||
private float spinningAnimationTicks;
|
||||
private float spinningAnimationTicks0;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public Allay(EntityType<? extends Allay> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -129,6 +_,12 @@
|
||||
@@ -126,6 +_,12 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
@Override
|
||||
protected Brain.Provider<Allay> brainProvider() {
|
||||
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
|
||||
@@ -248,7 +_,7 @@
|
||||
@@ -233,7 +_,7 @@
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
|
||||
@@ -316,7 +_,12 @@
|
||||
@@ -301,7 +_,12 @@
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
ItemStack itemInHand1 = this.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
if (this.isDancing() && itemInHand.is(ItemTags.DUPLICATES_ALLAYS) && this.canDuplicate()) {
|
||||
@@ -44,7 +44,7 @@
|
||||
this.level().broadcastEntityEvent(this, (byte)18);
|
||||
this.level().playSound(player, this, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.NEUTRAL, 2.0F, 1.0F);
|
||||
this.removeInteractionItem(player, itemInHand);
|
||||
@@ -421,6 +_,7 @@
|
||||
@@ -406,6 +_,7 @@
|
||||
}
|
||||
|
||||
private boolean shouldStopDancing() {
|
||||
@@ -52,16 +52,16 @@
|
||||
return this.jukeboxPos == null
|
||||
|| !this.jukeboxPos.closerToCenterThan(this.position(), GameEvent.JUKEBOX_PLAY.value().notificationRadius())
|
||||
|| !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
@@ -475,7 +_,7 @@
|
||||
this.readInventoryFromTag(compound, this.registryAccess());
|
||||
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
|
||||
this.vibrationData = compound.read("listener", VibrationSystem.Data.CODEC, registryOps).orElseGet(VibrationSystem.Data::new);
|
||||
- this.setDuplicationCooldown(compound.getIntOr("DuplicationCooldown", 0));
|
||||
+ this.setDuplicationCooldown(compound.getLongOr("DuplicationCooldown", 0)); // Paper - Load as long
|
||||
@@ -458,7 +_,7 @@
|
||||
super.readAdditionalSaveData(input);
|
||||
this.readInventoryFromTag(input);
|
||||
this.vibrationData = input.read("listener", VibrationSystem.Data.CODEC).orElseGet(VibrationSystem.Data::new);
|
||||
- this.setDuplicationCooldown(input.getIntOr("DuplicationCooldown", 0));
|
||||
+ this.setDuplicationCooldown(input.getLongOr("DuplicationCooldown", 0)); // Paper - Load as long
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -494,15 +_,17 @@
|
||||
@@ -477,15 +_,17 @@
|
||||
this.entityData.set(DATA_CAN_DUPLICATE, duplicationCooldown == 0L);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
@@ -142,10 +_,12 @@
|
||||
@@ -143,10 +_,12 @@
|
||||
ArmadilloAi.updateActivity(this);
|
||||
profilerFiller.pop();
|
||||
if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) {
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
this.scuteTime = this.pickNextScuteDropTime();
|
||||
}
|
||||
@@ -282,8 +_,11 @@
|
||||
@@ -283,8 +_,11 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -27,7 +27,7 @@
|
||||
if (!this.isNoAi() && !this.isDeadOrDying()) {
|
||||
if (damageSource.getEntity() instanceof LivingEntity) {
|
||||
this.getBrain().setMemoryWithExpiry(MemoryModuleType.DANGER_DETECTED_RECENTLY, true, 80L);
|
||||
@@ -294,6 +_,7 @@
|
||||
@@ -295,6 +_,7 @@
|
||||
this.rollOut();
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -312,7 +_,9 @@
|
||||
@@ -313,7 +_,9 @@
|
||||
return false;
|
||||
} else {
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
@@ -231,7 +_,7 @@
|
||||
@@ -233,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
public Axolotl.Variant getVariant() {
|
||||
@@ -449,10 +_,10 @@
|
||||
@@ -451,10 +_,10 @@
|
||||
if (effect == null || effect.endsWithin(2399)) {
|
||||
int i = effect != null ? effect.getDuration() : 0;
|
||||
int min = Math.min(2400, 100 + i);
|
||||
@@ -22,7 +22,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -544,6 +_,13 @@
|
||||
@@ -546,6 +_,13 @@
|
||||
) {
|
||||
return level.getBlockState(pos.below()).is(BlockTags.AXOLOTLS_SPAWNABLE_ON);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
@@ -398,12 +_,12 @@
|
||||
@@ -404,12 +_,12 @@
|
||||
} else {
|
||||
boolean flag = this.getHealth() < this.getMaxHealth();
|
||||
if (flag) {
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
|
||||
boolean isBaby = this.isBaby();
|
||||
@@ -463,9 +_,13 @@
|
||||
@@ -469,9 +_,13 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -566,7 +_,7 @@
|
||||
@@ -572,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void sitDown() {
|
||||
@@ -40,7 +40,7 @@
|
||||
this.makeSound(SoundEvents.CAMEL_SIT);
|
||||
this.setPose(Pose.SITTING);
|
||||
this.gameEvent(GameEvent.ENTITY_ACTION);
|
||||
@@ -575,7 +_,7 @@
|
||||
@@ -581,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void standUp() {
|
||||
@@ -49,7 +49,7 @@
|
||||
this.makeSound(SoundEvents.CAMEL_STAND);
|
||||
this.setPose(Pose.STANDING);
|
||||
this.gameEvent(GameEvent.ENTITY_ACTION);
|
||||
@@ -584,6 +_,7 @@
|
||||
@@ -590,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void standUpInstantly() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
@@ -287,7 +_,12 @@
|
||||
@@ -288,7 +_,12 @@
|
||||
|
||||
@Override
|
||||
public void spawnChildFromBreeding(ServerLevel level, Animal mate) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
@@ -63,6 +_,7 @@
|
||||
@@ -65,6 +_,7 @@
|
||||
MemoryModuleType.BREED_TARGET,
|
||||
MemoryModuleType.IS_PANICKING
|
||||
);
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public Tadpole(EntityType<? extends AbstractFish> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -114,7 +_,7 @@
|
||||
@@ -116,7 +_,7 @@
|
||||
@Override
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
@@ -17,22 +17,22 @@
|
||||
this.setAge(this.age + 1);
|
||||
}
|
||||
}
|
||||
@@ -123,12 +_,14 @@
|
||||
public void addAdditionalSaveData(CompoundTag compound) {
|
||||
super.addAdditionalSaveData(compound);
|
||||
compound.putInt("Age", this.age);
|
||||
+ compound.putBoolean("AgeLocked", this.ageLocked); // Paper
|
||||
@@ -125,12 +_,14 @@
|
||||
protected void addAdditionalSaveData(ValueOutput output) {
|
||||
super.addAdditionalSaveData(output);
|
||||
output.putInt("Age", this.age);
|
||||
+ output.putBoolean("AgeLocked", this.ageLocked); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag compound) {
|
||||
super.readAdditionalSaveData(compound);
|
||||
this.setAge(compound.getIntOr("Age", 0));
|
||||
+ this.ageLocked = compound.getBooleanOr("AgeLocked", false); // Paper
|
||||
protected void readAdditionalSaveData(ValueInput input) {
|
||||
super.readAdditionalSaveData(input);
|
||||
this.setAge(input.getIntOr("Age", 0));
|
||||
+ this.ageLocked = input.getBooleanOr("AgeLocked", false); // Paper
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -178,13 +_,19 @@
|
||||
@@ -180,13 +_,19 @@
|
||||
@Override
|
||||
public void saveToBucketTag(ItemStack stack) {
|
||||
Bucketable.saveDefaultDataToBucketTag(this, stack);
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -216,6 +_,7 @@
|
||||
@@ -218,6 +_,7 @@
|
||||
}
|
||||
|
||||
private void ageUp(int offset) {
|
||||
@@ -61,7 +61,7 @@
|
||||
this.setAge(this.age + offset * 20);
|
||||
}
|
||||
|
||||
@@ -228,12 +_,17 @@
|
||||
@@ -230,12 +_,17 @@
|
||||
|
||||
private void ageUp() {
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -234,13 +_,22 @@
|
||||
@@ -235,13 +_,22 @@
|
||||
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
if (itemInHand.is(Items.BUCKET) && !this.isBaby()) {
|
||||
@@ -25,7 +25,7 @@
|
||||
this.playEatingSound();
|
||||
}
|
||||
|
||||
@@ -352,8 +_,7 @@
|
||||
@@ -353,8 +_,7 @@
|
||||
double d1 = Mth.randomBetween(this.random, 0.3F, 0.7F);
|
||||
double d2 = Mth.randomBetween(this.random, -0.2F, 0.2F);
|
||||
ItemEntity itemEntity = new ItemEntity(this.level(), vec3.x(), vec3.y(), vec3.z(), itemStack, d, d1, d2);
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,4 +_,15 @@
|
||||
@@ -385,4 +_,15 @@
|
||||
) {
|
||||
return level.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
|
||||
@@ -70,6 +_,12 @@
|
||||
@@ -73,6 +_,12 @@
|
||||
super.dropEquipment(level);
|
||||
if (this.hasChest()) {
|
||||
this.spawnAtLocation(level, Blocks.CHEST);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
@@ -122,6 +_,7 @@
|
||||
@@ -123,6 +_,7 @@
|
||||
protected int gallopSoundCounter;
|
||||
@Nullable
|
||||
public EntityReference<LivingEntity> owner;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
protected AbstractHorse(EntityType<? extends AbstractHorse> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -250,7 +_,7 @@
|
||||
@@ -252,7 +_,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -17,7 +17,7 @@
|
||||
return !this.isVehicle();
|
||||
}
|
||||
|
||||
@@ -301,7 +_,7 @@
|
||||
@@ -303,7 +_,7 @@
|
||||
|
||||
public void createInventory() {
|
||||
SimpleContainer simpleContainer = this.inventory;
|
||||
@@ -26,7 +26,7 @@
|
||||
if (simpleContainer != null) {
|
||||
int min = Math.min(simpleContainer.getContainerSize(), this.inventory.getContainerSize());
|
||||
|
||||
@@ -395,7 +_,7 @@
|
||||
@@ -397,7 +_,7 @@
|
||||
}
|
||||
|
||||
public int getMaxTemper() {
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -450,7 +_,7 @@
|
||||
@@ -456,7 +_,7 @@
|
||||
i1 = 5;
|
||||
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
|
||||
flag = true;
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
} else if (stack.is(Items.GOLDEN_APPLE) || stack.is(Items.ENCHANTED_GOLDEN_APPLE)) {
|
||||
f = 10.0F;
|
||||
@@ -458,12 +_,12 @@
|
||||
@@ -464,12 +_,12 @@
|
||||
i1 = 10;
|
||||
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
|
||||
flag = true;
|
||||
@@ -59,7 +59,7 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -534,7 +_,7 @@
|
||||
@@ -540,7 +_,7 @@
|
||||
super.aiStep();
|
||||
if (this.level() instanceof ServerLevel serverLevel && this.isAlive()) {
|
||||
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
|
||||
@@ -68,7 +68,7 @@
|
||||
}
|
||||
|
||||
if (this.canEatGrass()) {
|
||||
@@ -637,6 +_,16 @@
|
||||
@@ -642,6 +_,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,36 +85,23 @@
|
||||
@Override
|
||||
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
||||
if (this.isVehicle() || this.isBaby()) {
|
||||
@@ -674,6 +_,12 @@
|
||||
this.setFlag(16, eating);
|
||||
}
|
||||
|
||||
+ // Paper start - Horse API
|
||||
+ public void setForceStanding(boolean standing) {
|
||||
+ this.setFlag(FLAG_STANDING, standing);
|
||||
+ }
|
||||
+ // Paper end - Horse API
|
||||
+
|
||||
public void setStanding(boolean standing) {
|
||||
if (standing) {
|
||||
this.setEating(false);
|
||||
@@ -785,6 +_,7 @@
|
||||
if (this.owner != null) {
|
||||
this.owner.store(compound, "Owner");
|
||||
}
|
||||
+ compound.putInt("Bukkit.MaxDomestication", this.maxDomestication); // Paper - max domestication
|
||||
@@ -788,6 +_,7 @@
|
||||
output.putInt("Temper", this.getTemper());
|
||||
output.putBoolean("Tame", this.isTamed());
|
||||
EntityReference.store(this.owner, output, "Owner");
|
||||
+ output.putInt("Bukkit.MaxDomestication", this.maxDomestication); // Paper - max domestication
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -795,6 +_,7 @@
|
||||
this.setTemper(compound.getIntOr("Temper", 0));
|
||||
this.setTamed(compound.getBooleanOr("Tame", false));
|
||||
this.owner = EntityReference.readWithOldOwnerConversion(compound, "Owner", this.level());
|
||||
+ this.maxDomestication = compound.getIntOr("Bukkit.MaxDomestication", this instanceof Llama ? 30 : 100); // Paper - max domestication
|
||||
@@ -798,6 +_,7 @@
|
||||
this.setTemper(input.getIntOr("Temper", 0));
|
||||
this.setTamed(input.getBooleanOr("Tame", false));
|
||||
this.owner = EntityReference.readWithOldOwnerConversion(input, "Owner", this.level());
|
||||
+ this.maxDomestication = input.getIntOr("Bukkit.MaxDomestication", this instanceof Llama ? 30 : 100); // Paper - max domestication
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -883,6 +_,17 @@
|
||||
@@ -886,6 +_,17 @@
|
||||
|
||||
@Override
|
||||
public void handleStartJump(int jumpPower) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
@@ -76,17 +_,23 @@
|
||||
@@ -77,17 +_,23 @@
|
||||
@Nullable
|
||||
private Llama caravanHead;
|
||||
@Nullable
|
||||
@@ -25,7 +25,7 @@
|
||||
private void setStrength(int strength) {
|
||||
this.entityData.set(DATA_STRENGTH_ID, Math.max(1, Math.min(5, strength)));
|
||||
}
|
||||
@@ -193,12 +_,12 @@
|
||||
@@ -194,12 +_,12 @@
|
||||
f = 10.0F;
|
||||
if (this.isTamed() && this.getAge() == 0 && this.canFallInLove()) {
|
||||
flag = true;
|
||||
@@ -40,7 +40,7 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -312,7 +_,7 @@
|
||||
@@ -313,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxTemper() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
|
||||
@@ -124,7 +_,7 @@
|
||||
@@ -125,7 +_,7 @@
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
if (this.isTrap() && this.trapTime++ >= 18000) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/horse/TraderLlama.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/TraderLlama.java
|
||||
@@ -88,7 +_,7 @@
|
||||
@@ -89,7 +_,7 @@
|
||||
this.despawnDelay = this.isLeashedToWanderingTrader() ? ((WanderingTrader)this.getLeashHolder()).getDespawnDelay() - 1 : this.despawnDelay - 1;
|
||||
if (this.despawnDelay <= 0) {
|
||||
this.removeLeash();
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +_,7 @@
|
||||
@@ -148,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/sheep/Sheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/sheep/Sheep.java
|
||||
@@ -161,7 +_,19 @@
|
||||
@@ -139,7 +_,19 @@
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
if (itemInHand.is(Items.SHEARS)) {
|
||||
if (this.level() instanceof ServerLevel serverLevel && this.readyForShearing()) {
|
||||
@@ -21,7 +21,7 @@
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
@@ -175,14 +_,28 @@
|
||||
@@ -153,14 +_,28 @@
|
||||
|
||||
@Override
|
||||
public void shear(ServerLevel level, SoundSource soundSource, ItemStack shears) {
|
||||
@@ -57,7 +57,7 @@
|
||||
if (itemEntity != null) {
|
||||
itemEntity.setDeltaMovement(
|
||||
itemEntity.getDeltaMovement()
|
||||
@@ -302,6 +_,7 @@
|
||||
@@ -280,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void ate() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
@@ -267,6 +_,13 @@
|
||||
@@ -278,6 +_,13 @@
|
||||
this.dropFromGiftLootTable(serverLevel, BuiltInLootTables.SNIFFER_DIGGING, (serverLevel1, itemStack) -> {
|
||||
ItemEntity itemEntity = new ItemEntity(this.level(), headBlock.getX(), headBlock.getY(), headBlock.getZ(), itemStack);
|
||||
itemEntity.setDefaultPickUpDelay();
|
||||
@@ -14,7 +14,7 @@
|
||||
serverLevel1.addFreshEntity(itemEntity);
|
||||
});
|
||||
this.playSound(SoundEvents.SNIFFER_DROP_SEED, 1.0F, 1.0F);
|
||||
@@ -325,12 +_,17 @@
|
||||
@@ -336,12 +_,17 @@
|
||||
|
||||
@Override
|
||||
public void spawnChildFromBreeding(ServerLevel level, Animal mate) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
|
||||
@@ -400,16 +_,18 @@
|
||||
@@ -399,16 +_,18 @@
|
||||
if (this.isInvulnerableTo(level, damageSource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -22,7 +22,7 @@
|
||||
ItemStack bodyArmorItem = this.getBodyArmorItem();
|
||||
int damageValue = bodyArmorItem.getDamageValue();
|
||||
int maxDamage = bodyArmorItem.getMaxDamage();
|
||||
@@ -429,6 +_,7 @@
|
||||
@@ -428,6 +_,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
private boolean canArmorAbsorb(DamageSource damageSource) {
|
||||
@@ -439,7 +_,7 @@
|
||||
@@ -438,7 +_,7 @@
|
||||
protected void applyTamingSideEffects() {
|
||||
if (this.isTame()) {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(40.0);
|
||||
@@ -39,7 +39,7 @@
|
||||
} else {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0);
|
||||
}
|
||||
@@ -459,7 +_,7 @@
|
||||
@@ -463,7 +_,7 @@
|
||||
this.usePlayerItem(player, hand, itemInHand);
|
||||
FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD);
|
||||
float f = foodProperties != null ? foodProperties.nutrition() : 1.0F;
|
||||
@@ -49,25 +49,15 @@
|
||||
}
|
||||
|
||||
@@ -492,7 +_,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
- this.setTarget(null);
|
||||
+ this.setTarget(null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // CraftBukkit - reason
|
||||
return InteractionResult.SUCCESS.withoutItem();
|
||||
}
|
||||
|
||||
@@ -504,7 +_,9 @@
|
||||
ItemStack bodyArmorItem = this.getBodyArmorItem();
|
||||
this.setBodyArmorItem(ItemStack.EMPTY);
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation(serverLevel, bodyArmorItem);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
- this.setTarget(null);
|
||||
+ this.setTarget(null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // CraftBukkit - reason
|
||||
return InteractionResult.SUCCESS.withoutItem();
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -512,6 +_,13 @@
|
||||
@@ -501,6 +_,13 @@
|
||||
|
||||
DyeColor dyeColor = dyeItem.getDyeColor();
|
||||
if (dyeColor != this.getCollarColor()) {
|
||||
@@ -81,7 +71,7 @@
|
||||
this.setCollarColor(dyeColor);
|
||||
itemInHand.consume(1, player);
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -526,7 +_,7 @@
|
||||
@@ -515,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void tryToTame(Player player) {
|
||||
|
||||
Reference in New Issue
Block a user