diff --git a/patches/server/Add-BeaconEffectEvent.patch b/patches/server/Add-BeaconEffectEvent.patch index 337cb0a396..a630681152 100644 --- a/patches/server/Add-BeaconEffectEvent.patch +++ b/patches/server/Add-BeaconEffectEvent.patch @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Player entityhuman; + // Paper start - BeaconEffectEvent -+ org.bukkit.block.Block block = ((Player) list.get(0)).level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()); ++ org.bukkit.block.Block block = ((Player) list.get(0)).level().getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()); + PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(effects, i, b0, true, true)); + // Paper end diff --git a/patches/server/Add-LivingEntity-getTargetEntity.patch b/patches/server/Add-LivingEntity-getTargetEntity.patch index 893dba6419..6bc3b68b91 100644 --- a/patches/server/Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/Add-LivingEntity-getTargetEntity.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.world.phys.Vec3; import net.minecraft.world.scores.PlayerTeam; @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - return level.clip(raytrace); + return this.level().clip(raytrace); } + public @Nullable EntityHitResult getTargetEntity(int maxDistance) { @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Vec3 direction = this.getLookAngle(); + Vec3 end = start.add(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance); + -+ List entityList = level.getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(Entity::isPickable)); ++ List entityList = this.level().getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(Entity::isPickable)); + + double distance = 0.0D; + EntityHitResult result = null; @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return result; + } + - public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay; + public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay; public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/patches/server/Add-TNTPrimeEvent.patch b/patches/server/Add-TNTPrimeEvent.patch index 0fa4d85002..cf2e230e71 100644 --- a/patches/server/Add-TNTPrimeEvent.patch +++ b/patches/server/Add-TNTPrimeEvent.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 craftBlock.getNMS().spawnAfterBreak((ServerLevel) this.level(), blockposition, ItemStack.EMPTY, false); } + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = level.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ org.bukkit.block.Block tntBlock = this.level().getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getIndirectSourceEntity().getBukkitEntity()).callEvent()) + continue; + // Paper end diff --git a/patches/server/Add-ray-tracing-methods-to-LivingEntity.patch b/patches/server/Add-ray-tracing-methods-to-LivingEntity.patch index b3b54d3695..92ca765ddb 100644 --- a/patches/server/Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/server/Add-ray-tracing-methods-to-LivingEntity.patch @@ -23,10 +23,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Vec3 end = new Vec3(start.x + dir.getX(), start.y + dir.getY(), start.z + dir.getZ()); + ClipContext raytrace = new ClipContext(start, end, ClipContext.Block.OUTLINE, fluidCollisionOption, this); + -+ return level.clip(raytrace); ++ return this.level().clip(raytrace); + } + - public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay; + public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay; public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/patches/server/Cap-Entity-Collisions.patch b/patches/server/Cap-Entity-Collisions.patch index 1eee6382b0..0d2146a0b4 100644 --- a/patches/server/Cap-Entity-Collisions.patch +++ b/patches/server/Cap-Entity-Collisions.patch @@ -32,8 +32,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - for (j = 0; j < list.size(); ++j) { -+ this.numCollisions = Math.max(0, this.numCollisions - this.level.paperConfig().collisions.maxEntityCollisions); // Paper -+ for (j = 0; j < list.size() && this.numCollisions < this.level.paperConfig().collisions.maxEntityCollisions; ++j) { // Paper ++ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper ++ for (j = 0; j < list.size() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions; ++j) { // Paper Entity entity = (Entity) list.get(j); + entity.numCollisions++; // Paper + this.numCollisions++; // Paper diff --git a/patches/server/Check-Drowned-for-Villager-Aggression-Config.patch b/patches/server/Check-Drowned-for-Villager-Aggression-Config.patch index e43addaffe..5acf1221f4 100644 --- a/patches/server/Check-Drowned-for-Villager-Aggression-Config.patch +++ b/patches/server/Check-Drowned-for-Villager-Aggression-Config.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget)); - this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); -+ if (this.level.spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper ++ if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Axolotl.class, true, false)); this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); diff --git a/patches/server/Configurable-end-credits.patch b/patches/server/Configurable-end-credits.patch index 9508553f3a..fcb80adcd5 100644 --- a/patches/server/Configurable-end-credits.patch +++ b/patches/server/Configurable-end-credits.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.unRide(); this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.wonGame) { -+ if (level.paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits ++ if (this.level().paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits this.wonGame = true; this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, this.seenCredits ? 0.0F : 1.0F)); this.seenCredits = true; diff --git a/patches/server/Configurable-projectile-relative-velocity.patch b/patches/server/Configurable-projectile-relative-velocity.patch index 5bb06a4255..80913cc63b 100644 --- a/patches/server/Configurable-projectile-relative-velocity.patch +++ b/patches/server/Configurable-projectile-relative-velocity.patch @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Vec3 vec3d = shooter.getDeltaMovement(); - this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); -+ if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity ++ if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity } // CraftBukkit start - call projectile hit event diff --git a/patches/server/Disable-explosion-knockback.patch b/patches/server/Disable-explosion-knockback.patch index 960725faea..a30e0836a9 100644 --- a/patches/server/Disable-explosion-knockback.patch +++ b/patches/server/Disable-explosion-knockback.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ boolean knockbackCancelled = level.paperConfig().environment.disableExplosionKnockback && source.is(DamageTypeTags.IS_EXPLOSION) && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback ++ boolean knockbackCancelled = this.level().paperConfig().environment.disableExplosionKnockback && source.is(DamageTypeTags.IS_EXPLOSION) && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback if (flag1) { if (flag) { this.level().broadcastEntityEvent(this, (byte) 29); @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ if (knockbackCancelled) this.level.broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback ++ if (knockbackCancelled) this.level().broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback if (this.isDeadOrDying()) { if (!this.checkTotemDeathProtection(source)) { SoundEvent soundeffect = this.getDeathSound(); diff --git a/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch index b6c61e4b0d..a000688fe9 100644 --- a/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.move(MoverType.SELF, this.getDeltaMovement()); + // Paper start - Configurable TNT entity height nerf -+ if (this.level.paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) { ++ if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) { + this.discard(); + return; + } @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super.tick(); if (this.fuse > 0) { + // Paper start - Configurable TNT entity height nerf -+ if (this.level.paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) { ++ if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) { + this.discard(); + return; + } diff --git a/patches/server/Entity-Activation-Range-2.0.patch b/patches/server/Entity-Activation-Range-2.0.patch index e4bf2f788b..16efe9b7f4 100644 --- a/patches/server/Entity-Activation-Range-2.0.patch +++ b/patches/server/Entity-Activation-Range-2.0.patch @@ -266,10 +266,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.setUnhappyCounter(this.getUnhappyCounter() - 1); } + if (this.isEffectiveAi()) { -+ if (level.spigotConfig.tickInactiveVillagers) { ++ if (this.level().spigotConfig.tickInactiveVillagers) { + this.customServerAiStep(); + } else { -+ this.mobTick(true); ++ this.customServerAiStep(true); + } + } + maybeDecayGossip(); @@ -453,7 +453,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }; + + private static int checkInactiveWakeup(Entity entity) { -+ Level world = entity.level; ++ Level world = entity.level(); + SpigotWorldConfig config = world.spigotConfig; + long inactiveFor = MinecraftServer.currentTick - entity.activatedTick; + if (entity.activationType == ActivationType.VILLAGER) { @@ -574,7 +574,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static int checkEntityImmunities(Entity entity) // Paper - return # of ticks to get immunity { + // Paper start -+ SpigotWorldConfig config = entity.level.spigotConfig; ++ SpigotWorldConfig config = entity.level().spigotConfig; + int inactiveWakeUpImmunity = checkInactiveWakeup(entity); + if (inactiveWakeUpImmunity > -1) { + return inactiveWakeUpImmunity; @@ -595,7 +595,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return 100; // Paper + } + // Paper start -+ if ( !entity.isOnGround() || entity.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D ) ++ if ( !entity.onGround() || entity.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D ) + { + return 100; } diff --git a/patches/server/Entity-Origin-API.patch b/patches/server/Entity-Origin-API.patch index f8faf46245..5796490661 100644 --- a/patches/server/Entity-Origin-API.patch +++ b/patches/server/Entity-Origin-API.patch @@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int srcX = nbt.getInt("SourceLoc_x"); + int srcY = nbt.getInt("SourceLoc_y"); + int srcZ = nbt.getInt("SourceLoc_z"); -+ this.setOrigin(new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ)); ++ this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ)); + } + // Paper end } @@ -125,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int srcX = nbt.getInt("SourceLoc_x"); + int srcY = nbt.getInt("SourceLoc_y"); + int srcZ = nbt.getInt("SourceLoc_z"); -+ this.setOrigin(new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ)); ++ this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ)); + } + // Paper end } diff --git a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index f816de736c..182d02e7e7 100644 --- a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + try { + this.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason); + } catch (Exception e) { -+ this.level.getCraftServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason); ++ this.level().getCraftServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason); + } + } + } diff --git a/patches/server/Improve-death-events.patch b/patches/server/Improve-death-events.patch index 09436a5b20..2396bfe874 100644 --- a/patches/server/Improve-death-events.patch +++ b/patches/server/Improve-death-events.patch @@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public float getBukkitYaw() { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - if (knockbackCancelled) this.level.broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback + if (knockbackCancelled) this.level().broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback if (this.isDeadOrDying()) { if (!this.checkTotemDeathProtection(source)) { - SoundEvent soundeffect = this.getDeathSound(); diff --git a/patches/server/MC-145656-Fix-Follow-Range-Initial-Target.patch b/patches/server/MC-145656-Fix-Follow-Range-Initial-Target.patch index 8014be04e6..7536365315 100644 --- a/patches/server/MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/patches/server/MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.randomInterval = reducedTickDelay(reciprocalChance); this.setFlags(EnumSet.of(Goal.Flag.TARGET)); this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate); -+ if (mob.level.paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper ++ if (mob.level().paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper } @Override diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 2c18cf1da0..3fe2d5dfcd 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -7288,7 +7288,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // I don't want to know why this is a generic type. + Entity entityCasted = (Entity)entity; + boolean wasRemoved = entityCasted.isRemoved(); -+ io.papermc.paper.chunk.system.ChunkSystem.onEntityPreAdd((net.minecraft.server.level.ServerLevel)entityCasted.level, entityCasted); ++ io.papermc.paper.chunk.system.ChunkSystem.onEntityPreAdd((net.minecraft.server.level.ServerLevel) entityCasted.level(), entityCasted); + if (!wasRemoved && entityCasted.isRemoved()) { + // removed by callback + return false; diff --git a/patches/server/Make-shield-blocking-delay-configurable.patch b/patches/server/Make-shield-blocking-delay-configurable.patch index 1f64361780..29f436921e 100644 --- a/patches/server/Make-shield-blocking-delay-configurable.patch +++ b/patches/server/Make-shield-blocking-delay-configurable.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper start -+ public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay; ++ public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay; + + public int getShieldBlockingDelay() { + return shieldBlockingDelay; diff --git a/patches/server/Mob-Pathfinding-API.patch b/patches/server/Mob-Pathfinding-API.patch index 50cf90dcbf..70ca818c8f 100644 --- a/patches/server/Mob-Pathfinding-API.patch +++ b/patches/server/Mob-Pathfinding-API.patch @@ -156,7 +156,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + private Location toLoc(Node point) { -+ return new Location(entity.level.getWorld(), point.x, point.y, point.z); ++ return new Location(entity.level().getWorld(), point.x, point.y, point.z); + } +} diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java diff --git a/patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 50284e53a7..fc68fcfec7 100644 --- a/patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (enumcreaturetype != MobCategory.MISC) { + // Paper start - Only count natural spawns -+ if (!entity.level.paperConfig().entities.spawning.countAllMobsForSpawning && ++ if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning && + !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL || + entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { + continue; diff --git a/patches/server/Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/Optimise-EntityGetter-getPlayerByUUID.patch index 3293354c66..e7b96b515b 100644 --- a/patches/server/Optimise-EntityGetter-getPlayerByUUID.patch +++ b/patches/server/Optimise-EntityGetter-getPlayerByUUID.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public Player getPlayerByUUID(UUID uuid) { + final Player player = this.getServer().getPlayerList().getPlayer(uuid); -+ return player != null && player.level == this ? player : null; ++ return player != null && player.level() == this ? player : null; + } + // Paper end + diff --git a/patches/server/Turtle-API.patch b/patches/server/Turtle-API.patch index b1da56d16d..3bc720aeee 100644 --- a/patches/server/Turtle-API.patch +++ b/patches/server/Turtle-API.patch @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.turtle.isInWater() && this.isReachedTarget()) { if (this.turtle.layEggCounter < 1) { - this.turtle.setLayingEgg(true); -+ this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level, this.getTargetPosition())).callEvent()); // Paper ++ this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.getTargetPosition())).callEvent()); // Paper } else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) { Level world = this.turtle.level(); @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) { + // Paper start + int eggCount = this.turtle.random.nextInt(4) + 1; -+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level, this.blockPos.above()), eggCount); ++ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos.above()), eggCount); + if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount())).isCancelled()) { world.playSound((Player) null, blockposition, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F); BlockPos blockposition1 = this.blockPos.above(); diff --git a/patches/unapplied/server/FallingBlock-auto-expire-setting.patch b/patches/unapplied/server/FallingBlock-auto-expire-setting.patch index 1c195aabfe..f8008ef6fb 100644 --- a/patches/unapplied/server/FallingBlock-auto-expire-setting.patch +++ b/patches/unapplied/server/FallingBlock-auto-expire-setting.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity { int srcZ = nbt.getInt("SourceLoc_z"); - this.setOrigin(new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ)); + this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ)); } + + if (nbt.contains("Paper.AutoExpire")) {