hardfork from paper 😊

This commit is contained in:
granny
2025-03-31 23:15:31 -07:00
parent aa0bf38f14
commit 73f443461b
197 changed files with 108 additions and 1256 deletions

View File

@@ -22,9 +22,6 @@ index f34bc75f324454bf48f0ebf79111706bb027a54b..6ad266592c16bdeccfb689fb2ef2ee37
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1634,6 +1634,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
+ serverLevel.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur - Ridables
profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().location());
/* Drop global time updates
@@ -35,8 +32,6 @@ index 0e7405a480bffa81493ef2f2078c36ccda542cde..bc5c30430e79e2feb69c165d9e3e9b6a
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -212,6 +212,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public final java.util.UUID uuid;
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
+ public boolean hasRidableMoveEvent = false; // Purpur - Ridables
@Override
@@ -73,7 +68,6 @@ index 63e01ec7e4ab04bb7d389bff485dfedca344bfa2..84b1570d0d88f57f33ff8179f0a78d37
+
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
if ((target instanceof net.minecraft.world.entity.animal.Bucketable && target instanceof LivingEntity && origItem != null && origItem == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelectedItem().isEmpty() || !ServerGamePacketListenerImpl.this.player.getInventory().getSelectedItem().is(origItem))) {
target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index d1899b2411e90b4641dcbc58760e4a19b62846c5..1335a04edd053c06e290c070e3c03d02598d97e7 100644
--- a/net/minecraft/world/entity/Entity.java
@@ -110,7 +104,6 @@ index d1899b2411e90b4641dcbc58760e4a19b62846c5..1335a04edd053c06e290c070e3c03d02
@@ -4823,4 +4838,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return ((ServerLevel) this.level()).isPositionEntityTicking(this.blockPosition());
}
// Paper end - Expose entity id counter
+ // Purpur start - Ridables
+ @Nullable
+ private Player rider = null;
@@ -213,7 +206,6 @@ index a077e2f518be39bbdba4919ed7161bb28547e56b..a4a19d962bc4665e9368b97cae4b2534
@@ -3577,8 +3578,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.pushEntities();
profilerFiller.pop();
// Paper start - Add EntityMoveEvent
- if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof Player)) {
- if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
+ // Purpur start - Ridables
@@ -222,8 +214,7 @@ index a077e2f518be39bbdba4919ed7161bb28547e56b..a4a19d962bc4665e9368b97cae4b2534
+ // Purpur end - Ridables
Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
@@ -3588,6 +3591,21 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3588,6 +3591,21 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.absSnapTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
}
}
@@ -243,7 +234,6 @@ index a077e2f518be39bbdba4919ed7161bb28547e56b..a4a19d962bc4665e9368b97cae4b2534
+ }
+ // Purpur end - Ridables
}
// Paper end - Add EntityMoveEvent
if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterOrRain()) {
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index e3b804f2d612ed7971db450aeea6768109b63470..ca1d0164c90e695731f05de39c1d2fff947ecfc1 100644
@@ -534,7 +524,6 @@ index 4e81bc7215c845b316bcd46ce29f49af7f986088..61e7300bbf272398b2faebf5e537d9c2
// CraftBukkit start - Got milk?
org.bukkit.event.player.PlayerBucketFillEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerBucketFillEvent(player.level(), player, this.blockPosition(), this.blockPosition(), null, itemInHand, Items.MILK_BUCKET, hand);
if (event.isCancelled()) {
player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync
- return InteractionResult.PASS;
+ return tryRide(player, hand); // Purpur - Ridables
}
@@ -604,7 +593,6 @@ index 585131365c40136cf8a8a715b077982091ee38d5..65ee07e09bb9bafb60abeec4916fdbb0
public Bee(EntityType<? extends Bee> entityType, Level level) {
super(entityType, level);
+ final org.purpurmc.purpur.controller.FlyingMoveControllerWASD flyingController = new org.purpurmc.purpur.controller.FlyingMoveControllerWASD(this, 0.25F, 1.0F, false); // Purpur - Ridables
// Paper start - Fix MC-167279
class BeeFlyingMoveControl extends FlyingMoveControl {
public BeeFlyingMoveControl(final Mob entity, final int maxPitchChange, final boolean noGravity) {
@@ -157,11 +158,24 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -631,7 +619,6 @@ index 585131365c40136cf8a8a715b077982091ee38d5..65ee07e09bb9bafb60abeec4916fdbb0
+ // Purpur end - Ridables
}
this.moveControl = new BeeFlyingMoveControl(this, 20, true);
// Paper end - Fix MC-167279
@@ -173,6 +187,40 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
this.setPathfindingMalus(PathType.FENCE, -1.0F);
}
@@ -1167,7 +1154,6 @@ index 0931bab3f52ccc4e405be22559323df90bcc065e..f04342dd4addb2be47533f12a2a475f1
- if (event.isCancelled()) return InteractionResult.PASS;
+ if (event.isCancelled()) return tryRide(player, hand); // Purpur - Ridables
drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
// Paper end - custom shear drops
}
diff --git a/net/minecraft/world/entity/animal/Ocelot.java b/net/minecraft/world/entity/animal/Ocelot.java
index 48c8fdfea8687f37187b6092c285275c12963ea0..b8780911350ac5f4f10acdbed2b13523c8692344 100644
@@ -1727,7 +1713,6 @@ index 67c8f1e82c775818f906eeaa639e55d7c02834c6..aca62391131333d604d21c9aaf2bcea6
+ return tryRide(player, hand); // Purpur - Ridables
}
drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
// Paper end - custom shear drops
@@ -175,7 +195,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
return InteractionResult.SUCCESS;
// Purpur end - Snowman drop and put back pumpkin
@@ -2180,7 +2165,6 @@ index ebdfd3fb6c0de48982d392bb2aa415f3676c6056..4db2d63fbc021f28b8ad8d20cc1cc1bb
@@ -64,13 +64,50 @@ public class Tadpole extends AbstractFish {
MemoryModuleType.IS_PANICKING
);
public boolean ageLocked; // Paper
+ private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurController; // Purpur - Ridables
public Tadpole(EntityType<? extends AbstractFish> entityType, Level level) {
@@ -2350,7 +2334,6 @@ index d4467235e8dc9d10c61dfb6fd9dc32386903dd09..b60fa4cb07d8dc6b52e76b5e9f596baf
@@ -83,7 +83,51 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
super(entityType, level);
this.getNavigation().setRequiredPathLength(40.0F);
this.maxDomestication = 30; // Paper - Missing entity API; configure max temper instead of a hardcoded value
+ // Purpur start - Ridables
+ this.moveControl = new org.purpurmc.purpur.controller.MoveControllerWASD(this) {
+ @Override
@@ -2652,9 +2635,7 @@ index ea9d27a3205b3699b9577f42bb04254bd76e700e..a414934ae4332cc6cf622d4bb19c5937
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -91,6 +91,7 @@ public class EnderDragon extends Mob implements Enemy {
private final net.minecraft.world.level.Explosion explosionSource; // Paper - reusable source for CraftTNTPrimed.getSource()
@Nullable private BlockPos podium;
// Paper end
+ private boolean hadRider; // Purpur - Ridables
public EnderDragon(EntityType<? extends EnderDragon> entityType, Level level) {
@@ -2662,7 +2643,6 @@ index ea9d27a3205b3699b9577f42bb04254bd76e700e..a414934ae4332cc6cf622d4bb19c5937
@@ -107,6 +108,37 @@ public class EnderDragon extends Mob implements Enemy {
this.noPhysics = true;
this.phaseManager = new EnderDragonPhaseManager(this);
this.explosionSource = new net.minecraft.world.level.ServerExplosion(level.getMinecraftWorld(), this, null, null, new Vec3(Double.NaN, Double.NaN, Double.NaN), Float.NaN, true, net.minecraft.world.level.Explosion.BlockInteraction.DESTROY); // Paper
+
+ // Purpur start - Ridables
+ this.moveControl = new org.purpurmc.purpur.controller.FlyingMoveControllerWASD(this) {
@@ -2813,7 +2793,6 @@ index 2f7da367b58fd9c06c4e012e8eb7f59e5a7f9b6d..15e2c0d566256c4ba175e991d6d7fd4f
private final int[] idleHeadUpdates = new int[2];
private int destroyBlocksTick;
+ private int shootCooldown = 0; // Purpur - Ridables
private boolean canPortal = false; // Paper
public final ServerBossEvent bossEvent = (ServerBossEvent)new ServerBossEvent(
this.getDisplayName(), BossEvent.BossBarColor.PURPLE, BossEvent.BossBarOverlay.PROGRESS
@@ -79,9 +80,23 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -3252,7 +3231,6 @@ index c2327306f093c834da9574f9466236fbec572aec..562641cdb76e7a50706459bee8a2dcdf
this.targetSelector.addGoal(2, new HurtByTargetGoal(this));
}
@@ -310,6 +387,7 @@ public class Creeper extends Monster {
com.destroystokyo.paper.event.entity.CreeperIgniteEvent event = new com.destroystokyo.paper.event.entity.CreeperIgniteEvent((org.bukkit.entity.Creeper) getBukkitEntity(), ignited);
if (event.callEvent()) {
this.entityData.set(DATA_IS_IGNITED, event.isIgnited());
+ if (!event.isIgnited()) setSwellDir(-1); // Purpur - Ridables
@@ -3891,7 +3869,6 @@ index 73edb1a4e5daee16fa518c05de24e413847ab65d..2653cf2c353d7ae360201e74c4860a47
@@ -148,6 +209,7 @@ public class Phantom extends FlyingMob implements Enemy {
@Override
public void aiStep() {
if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API
+ if (getRider() == null || !this.isControllable()) // Purpur - Ridables
this.igniteForSeconds(8.0F);
}
@@ -4155,7 +4132,6 @@ index 6a8a5a76400beeaf69a17d53105a7a522ec5791e..9127e99d632bcd01c2f042c33dc87dd4
@@ -58,6 +58,7 @@ public class Slime extends Mob implements Enemy {
public float oSquish;
private boolean wasOnGround = false;
private boolean canWander = true; // Paper - Slime pathfinder events
+ protected boolean actualJump; // Purpur - Ridables
public Slime(EntityType<? extends Slime> entityType, Level level) {
@@ -4666,7 +4642,6 @@ index e15df574282e0f5ba5791435020bc6ac96860d15..f9233f0689b26a8c65d60ab9421c1216
@Override
protected void registerGoals() {
+ this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
if (this.level().paperConfig().entities.behavior.zombiesTargetTurtleEggs) this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0, 3)); // Paper - Add zombie targets turtle egg config
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
+ this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
@@ -4990,7 +4965,6 @@ index 49d43837b88d8f278baa5062aed83a297fe20ed8..15669f9157dc3d3d5e3fb76a668c7e3b
// Pufferfish start
- if (!inactive /*&& this.behaviorTick++ % this.activatedPriority == 0*/) {
+ if (!inactive && (getRider() == null || !this.isControllable()) /*&& this.behaviorTick++ % this.activatedPriority == 0*/) { // Purpur - Ridables
this.getBrain().tick(level, this); // Paper - EAR 2
}
else if (this.isLobotomized && shouldRestock()) restock(); // Purpur - Lobotomize stuck villagers
@@ -418,7 +440,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler

View File

@@ -11,7 +11,6 @@ index ccea424d813a4c137fa15612b7bcf4fdb5c9a811..a1304bc3b1ebb9fa246004ae418481d4
@@ -1029,6 +1029,27 @@ public abstract class PlayerList {
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
this.server.getCommands().sendCommands(player);
} // Paper - Add sendOpLevel API
+
+ // Purpur start - Barrels and enderchests 6 rows
+ if (org.purpurmc.purpur.PurpurConfig.enderChestSixRows && org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) {
@@ -41,7 +40,6 @@ index 2417c26a03decf756ad93cd54265277c95c653ca..87c8bc6f9128d2fcb19628bc3ef354e5
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -212,6 +212,7 @@ public abstract class Player extends LivingEntity {
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
public int burpDelay = 0; // Purpur - Burp delay
public boolean canPortalInstant = false; // Purpur - Add portal permission bypass
+ public int sixRowEnderchestSlotCount = -1; // Purpur - Barrels and enderchests 6 rows
@@ -120,7 +118,6 @@ index 5077a9ff7b78801bdc53536a37aee07b8d86ee4d..72794e204f7fcc31ece94913b7fd9f36
+ (containerId, playerInventory, player1) -> org.purpurmc.purpur.PurpurConfig.enderChestSixRows ? getEnderChestSixRows(containerId, playerInventory, player, enderChestInventory) : ChestMenu.threeRows(containerId, playerInventory, enderChestInventory), CONTAINER_TITLE
+ ) // Purpur - Barrels and enderchests 6 rows
).isPresent()) {
// Paper end - Fix InventoryOpenEvent cancellation - moved up;
player.awardStat(Stats.OPEN_ENDERCHEST);
@@ -100,6 +100,35 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
}

View File

@@ -32,7 +32,6 @@ index 99617c08cbd989092ba357d8df928786fd04c89a..9d88b260528c3cea2c5fe8e2760094b0
+ public double storedMaxSpeed;
+ public boolean isNewBehavior;
+ // Purpur end - Minecart settings and WASD controls
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
// CraftBukkit end
@@ -111,8 +115,13 @@ public abstract class AbstractMinecart extends VehicleEntity {

View File

@@ -1,49 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 27 Feb 2020 21:42:19 -0600
Subject: [PATCH] Configurable void damage height and damage
temporarily migrate to paper's config
drop patch on the next minecraft release
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 6ad266592c16bdeccfb689fb2ef2ee37e79a7b41..e950e74d7c14d2e180e5ca879eb1048866d85051 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1140,6 +1140,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Purpur end - config for startup commands
+ // Purpur start - Configurable void damage height and damage
+ if (org.purpurmc.purpur.configuration.transformation.VoidDamageHeightMigration.HAS_BEEN_REGISTERED) {
+ try {
+ org.purpurmc.purpur.PurpurConfig.config.save((java.io.File) this.options.valueOf("purpur-settings"));
+ } catch (IOException ex) {
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Could not save " + this.options.valueOf("purpur-settings"), ex);
+ }
+ }
+ // Purpur end - Configurable void damage height and damage
+
while (this.running) {
long l;
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index 19bb96242fed268c23381a6f3eaef21e723666c5..127935326dbfa0aa454dc12d52dcef328fcf2771 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -168,6 +168,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
+ // Purpur start - Configurable void damage height and damage
+ try {
+ org.purpurmc.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
+ } catch (Exception e) {
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
+ return false;
+ }
+ org.purpurmc.purpur.PurpurConfig.registerCommands();
+ // Purpur end - Configurable void damage height and damage
// Paper start - initialize global and world-defaults configuration
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());

View File

@@ -33,7 +33,6 @@ index 18d63d2da49451a2d5e1da7bf0c00e05e2f192bc..1f081e098ce3bec61b7f374e9b737838
--- a/net/minecraft/world/item/FireworkRocketItem.java
+++ b/net/minecraft/world/item/FireworkRocketItem.java
@@ -62,6 +62,19 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) delayed.projectile().getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand));
if (event.callEvent() && delayed.attemptSpawn()) {
player.awardStat(Stats.ITEM_USED.get(this)); // Moved up from below
+
@@ -57,7 +56,6 @@ index 8c9f64140f016edfadeeb75463655cc2f3fafc0c..84e7f1b119ccfdabf48ccac51278e197
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -725,6 +725,14 @@ public final class ItemStack implements DataComponentHolder {
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(serverPlayer, this); // Paper - Add EntityDamageItemEvent
}
// CraftBukkit end
+

View File

@@ -11,7 +11,6 @@ index 57f9f705c62706902efe9a7873f0e3866820f7d9..90ac1e4bdca5b6233eeae9bc84549770
@@ -26,6 +26,12 @@ public class EndCrystal extends Entity {
private static final boolean DEFAULT_SHOW_BOTTOM = true;
public int time;
public boolean generatedByDragonFight = false; // Paper - Fix invulnerable end crystals
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
+ private net.minecraft.world.entity.monster.Phantom targetPhantom;
+ private int phantomBeamTicks = 0;
@@ -22,7 +21,6 @@ index 57f9f705c62706902efe9a7873f0e3866820f7d9..90ac1e4bdca5b6233eeae9bc84549770
public EndCrystal(EntityType<? extends EndCrystal> entityType, Level level) {
super(entityType, level);
@@ -94,6 +100,49 @@ public class EndCrystal extends Entity {
// Paper end - Fix invulnerable end crystals
if (this.level().purpurConfig.endCrystalCramming > 0 && this.level().getEntitiesOfClass(EndCrystal.class, getBoundingBox()).size() > this.level().purpurConfig.endCrystalCramming) this.hurt(this.damageSources().cramming(), 6.0F); // Purpur - End Crystal Cramming
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
@@ -80,7 +78,6 @@ index 2f14561a3722f8175a234ad656ef64d4c58e3b96..6c41a2cc9a772c216abfc2b241429ec7
public BlockPos anchorPoint;
Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
+ Vec3 crystalPosition; // Purpur - Phantoms attracted to crystals and crystals shoot phantoms
// Paper start
@Nullable
public java.util.UUID spawningEntity;
@@ -119,6 +120,25 @@ public class Phantom extends FlyingMob implements Enemy {

View File

@@ -11,7 +11,6 @@ index 6c41a2cc9a772c216abfc2b241429ec712119bb4..eaa5f2db1bc6b01ef6a508cc5a60ff1e
@@ -54,6 +54,7 @@ public class Phantom extends FlyingMob implements Enemy {
public java.util.UUID spawningEntity;
public boolean shouldBurnInDay = true;
// Paper end
+ private static final net.minecraft.world.item.crafting.Ingredient TORCH = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.item.Items.TORCH, net.minecraft.world.item.Items.SOUL_TORCH); // Purpur - Phantoms burn in light
public Phantom(EntityType<? extends Phantom> entityType, Level level) {
@@ -20,11 +19,9 @@ index 6c41a2cc9a772c216abfc2b241429ec712119bb4..eaa5f2db1bc6b01ef6a508cc5a60ff1e
@Override
public void aiStep() {
- if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API
+ // Purpur start - Phantoms burn in light
+ boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
+ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
+ if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - shouldBurnInDay API
+ // Purpur end - Phantoms burn in light
if (getRider() == null || !this.isControllable()) // Purpur - Ridables
this.igniteForSeconds(8.0F);

View File

@@ -36,7 +36,6 @@ index 2ce0099460c14a6dd8b128f268ee915ea4be5183..1cae770340e969ec4f037b9121142878
@@ -283,8 +284,10 @@ public abstract class Animal extends AgeableMob {
player.awardStat(Stats.ANIMALS_BRED);
CriteriaTriggers.BRED_ANIMALS.trigger(player, this, animal, baby);
} // Paper - Call EntityBreedEvent
- this.setAge(6000);
- animal.setAge(6000);
+ // Purpur start - Make entity breeding times configurable

View File

@@ -11,12 +11,9 @@ index fb3b4e57e98b45adb3a908ddbc2d4ac066e22034..e0489ff30373c214927f34d78787fb85
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -492,6 +492,7 @@ public class ArmorStand extends LivingEntity {
private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(ServerLevel level, DamageSource damageSource) { // Paper
ItemStack itemStack = new ItemStack(Items.ARMOR_STAND);
+ if (level.purpurConfig.persistentDroppableEntityDisplayNames) // Purpur - Apply display names from item forms of entities to entities and vice versa
itemStack.set(DataComponents.CUSTOM_NAME, this.getCustomName());
this.drops.add(new DefaultDrop(itemStack, stack -> Block.popResource(this.level(), this.blockPosition(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior
return this.brokenByAnything(level, damageSource); // Paper
diff --git a/net/minecraft/world/entity/decoration/ItemFrame.java b/net/minecraft/world/entity/decoration/ItemFrame.java
index f9a97000b75db7999b1cbe1f72d680d4d7b803b7..9dfadb5639e840e69274b35f3366322141527104 100644
--- a/net/minecraft/world/entity/decoration/ItemFrame.java

View File

@@ -45,7 +45,6 @@ index de89e45ecd4ac4c6db8b74bbe3dd6b4a7cf21671..f15e4cfd8c0ac5e08779dbe6b9aa40bf
Block block1 = level.getBlockState(this.aboveFarmlandPos.below()).getBlock();
- if (block instanceof CropBlock && ((CropBlock)block).isMaxAge(blockState)) {
+ if (block instanceof CropBlock && ((CropBlock)block).isMaxAge(blockState) && !this.clericWartFarmer || this.clericWartFarmer && block == net.minecraft.world.level.block.Blocks.NETHER_WART && blockState.getValue(net.minecraft.world.level.block.NetherWartBlock.AGE) == 3) { // Purpur - Option for Villager Clerics to farm Nether Wart
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(owner, this.aboveFarmlandPos, blockState.getFluidState().createLegacyBlock())) { // CraftBukkit // Paper - fix wrong block state
level.destroyBlock(this.aboveFarmlandPos, true, owner);
} // CraftBukkit
}

View File

@@ -11,7 +11,6 @@ index bdae20191d2e5765761442eb06924968e710b189..476b570ffe9d2df173bd57b57fe65372
@@ -1904,7 +1904,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.level() instanceof ServerLevel serverLevel) {
boolean var6 = false;
if (this.dead && entitySource instanceof WitherBoss) { // Paper
- if (serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (serverLevel.purpurConfig.witherBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
BlockPos blockPos = this.blockPosition();
@@ -62,10 +61,6 @@ index 7a75415a469bc99f45a5cfaab038181717903f1d..fc244a1fbd401f6ea92e7428b9738939
+++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
@@ -67,7 +67,7 @@ public class EatBlockGoal extends Goal {
BlockPos blockPos = this.mob.blockPosition();
final BlockState blockState = this.level.getBlockState(blockPos); // Paper - fix wrong block state
if (IS_EDIBLE.test(blockState)) { // Paper - fix wrong block state
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).purpurConfig.sheepBypassMobGriefing == !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state // Purpur - Add mobGriefing bypass to everything affected
this.level.destroyBlock(blockPos, false);
}
@@ -73,8 +68,6 @@ index 7a75415a469bc99f45a5cfaab038181717903f1d..fc244a1fbd401f6ea92e7428b9738939
} else {
BlockPos blockPos1 = blockPos.below();
if (this.level.getBlockState(blockPos1).is(Blocks.GRASS_BLOCK)) {
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).purpurConfig.sheepBypassMobGriefing == !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state // Purpur - Add mobGriefing bypass to everything affected
this.level.levelEvent(2001, blockPos1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
this.level.setBlock(blockPos1, Blocks.DIRT.defaultBlockState(), 2);
}
@@ -221,9 +214,6 @@ index c200d57841304ba0d7a76fdd9a440fe9f2b25136..ff3761507f2025fd1e652afee03a18de
Block block = blockState.getBlock();
if (block instanceof InfestedBlock) {
// CraftBukkit start
- BlockState afterState = getServerLevel(level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? blockState.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(level.getBlockState(blockPos1)); // Paper - fix wrong block state
+ BlockState afterState = getServerLevel(level).purpurConfig.silverfishBypassMobGriefing ^ getServerLevel(level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? blockState.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(level.getBlockState(blockPos1)); // Paper - fix wrong block state // Purpur - Add mobGriefing bypass to everything affected
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockPos1, afterState)) { // Paper - fix wrong block state
continue;
}
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -301,8 +291,6 @@ index e81ae747fe95c22321fc69791a6509d601826fd6..77bb3aa7ff042aab6464aac55c846cb9
}
private boolean cannotPickUpBanner() {
- if (!getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
+ if (!this.mob.level().purpurConfig.pillagerBypassMobGriefing == !getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing bypass to everything affected
if (!this.mob.hasActiveRaid()) {
return true;
} else if (this.mob.getCurrentRaid().isOver()) {
@@ -313,8 +301,7 @@ index b370b955ac8636275dfada4f38a7ca10297f7dac..275eabf64977cdf262de55124c3e5f88
@@ -169,7 +169,7 @@ public class CropBlock extends VegetationBlock implements BonemealableBlock {
@Override
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) {
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list
if (!new - if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list
+ if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.purpurConfig.ravagerBypassMobGriefing == !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list // Purpur - Add mobGriefing bypass to everything affected
serverLevel.destroyBlock(pos, true, entity);
}

View File

@@ -21,9 +21,7 @@ index 68914268ca9350a6c1d794e011e1f9a8aecd609c..8e53b45dbf740de6c6fe499ef424d11b
--- a/net/minecraft/world/level/block/EndGatewayBlock.java
+++ b/net/minecraft/world/level/block/EndGatewayBlock.java
@@ -99,6 +99,13 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal {
org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, level), org.bukkit.PortalType.END_GATEWAY); // Paper - add portal type
if (!event.callEvent()) return;
// Paper end - call EntityPortalEnterEvent
+ // Purpur start - Add EntityTeleportHinderedEvent
+ if (level.purpurConfig.imposeTeleportRestrictionsOnGateways && (entity.isVehicle() || entity.isPassenger())) {
+ if (!new org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_GATEWAY).callEvent()) {
@@ -40,8 +38,7 @@ index cf2b105c98a3b22b9bea59cbafcd598657dc92b5..65d3477ed32c3f0db58aab6ab87d8f17
+++ b/net/minecraft/world/level/block/EndPortalBlock.java
@@ -59,6 +59,13 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) {
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity.canUsePortal(false)) {
if (!new if (entity.canUsePortal(false)) {
+ // Purpur start - Add EntityTeleportHinderedEvent
+ if (level.purpurConfig.imposeTeleportRestrictionsOnEndPortals && (entity.isVehicle() || entity.isPassenger())) {
+ if (!new org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL).callEvent()) {
@@ -50,7 +47,6 @@ index cf2b105c98a3b22b9bea59cbafcd598657dc92b5..65d3477ed32c3f0db58aab6ab87d8f17
+ }
+ // Purpur end - Add EntityTeleportHinderedEvent
// CraftBukkit start - Entity in portal
org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, level), org.bukkit.PortalType.ENDER); // Paper - add portal type
level.getCraftServer().getPluginManager().callEvent(event);
diff --git a/net/minecraft/world/level/block/NetherPortalBlock.java b/net/minecraft/world/level/block/NetherPortalBlock.java
index fa0d6baa40c6052c993d870d124af911e8621f0a..1c58af94050b75cd8f405a201448c822792e594a 100644
@@ -58,8 +54,7 @@ index fa0d6baa40c6052c993d870d124af911e8621f0a..1c58af94050b75cd8f405a201448c822
+++ b/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -118,6 +118,13 @@ public class NetherPortalBlock extends Block implements Portal {
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) {
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity.canUsePortal(false)) {
if (!new if (entity.canUsePortal(false)) {
+ // Purpur start - Add EntityTeleportHinderedEvent
+ if (level.purpurConfig.imposeTeleportRestrictionsOnNetherPortals && (entity.isVehicle() || entity.isPassenger())) {
+ if (!new org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.NETHER_PORTAL).callEvent()) {
@@ -68,5 +63,4 @@ index fa0d6baa40c6052c993d870d124af911e8621f0a..1c58af94050b75cd8f405a201448c822
+ }
+ // Purpur end - Add EntityTeleportHinderedEvent
// CraftBukkit start - Entity in portal
org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, level), org.bukkit.PortalType.NETHER); // Paper - add portal type
level.getCraftServer().getPluginManager().callEvent(event);

View File

@@ -45,7 +45,6 @@ index afe7fd92348e6a2a26f8f258373b0c57bb5f4f3f..8da974e98f2207d76e8962eda54c75d0
--- a/net/minecraft/world/entity/animal/Bee.java
+++ b/net/minecraft/world/entity/animal/Bee.java
@@ -181,7 +181,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
// Paper end - Fix MC-167279
this.lookControl = new Bee.BeeLookControl(this);
this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F);
- if (this.level().purpurConfig.beeCanInstantlyStartDrowning) this.setPathfindingMalus(PathType.WATER, -1.0F); // Purpur - bee can instantly start drowning in water option

View File

@@ -39,9 +39,6 @@ index 476b570ffe9d2df173bd57b57fe65372cb35fa1d..4586d7afb4f0a27c7d61abb80af24205
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -273,6 +273,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay; // Paper - Make shield blocking delay configurable
+ protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur - API for any mob to burn daylight
// CraftBukkit end
@@ -55,7 +52,6 @@ index 476b570ffe9d2df173bd57b57fe65372cb35fa1d..4586d7afb4f0a27c7d61abb80af24205
this.lastHurtByPlayer.store(compound, "last_hurt_by_player");
compound.putInt("last_hurt_by_player_memory_time", this.lastHurtByPlayerMemoryTime);
@@ -891,6 +893,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
} // Paper - The sleeping pos will always also set the actual pos, so a desync suggests something is wrong
}, this::clearSleepingPos);
compound.getCompound("Brain").ifPresent(compoundTag -> this.brain = this.makeBrain(new Dynamic<>(NbtOps.INSTANCE, compoundTag)));
+ this.shouldBurnInDay = compound.getBooleanOr("Purpur.ShouldBurnInDay", false); // Purpur - API for any mob to burn daylight
@@ -69,7 +65,6 @@ index 476b570ffe9d2df173bd57b57fe65372cb35fa1d..4586d7afb4f0a27c7d61abb80af24205
+
+ // Purpur start - copied from Zombie - API for any mob to burn daylight
+ if (this.isAlive()) {
+ boolean flag = this.shouldBurnInDay() && this.isSunBurnTick(); // Paper - shouldBurnInDay API // Purpur - use shouldBurnInDay() method to handle Phantoms properly - API for any mob to burn daylight
+ if (flag) {
+ ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
+ if (!itemBySlot.isEmpty()) {
@@ -129,8 +124,6 @@ index 0a5de00d41c59528e9f85a7cf82363c45e24d2bc..185edd9878f5193c44b75a126e8182ca
AbstractSkeleton.this.setAggressive(true);
}
};
- private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API
+ //private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> entityType, Level level) {
super(entityType, level);
@@ -143,7 +136,6 @@ index 0a5de00d41c59528e9f85a7cf82363c45e24d2bc..185edd9878f5193c44b75a126e8182ca
@Override
public void aiStep() {
- boolean isSunBurnTick = this.shouldBurnInDay && this.isSunBurnTick(); // Paper - shouldBurnInDay API
- if (isSunBurnTick) {
- ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
- if (!itemBySlot.isEmpty()) {
@@ -172,19 +164,8 @@ index 0a5de00d41c59528e9f85a7cf82363c45e24d2bc..185edd9878f5193c44b75a126e8182ca
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
this.reassessWeaponGoal();
- this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API
+ //this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
}
// Paper start - shouldBurnInDay API
@Override
public void addAdditionalSaveData(final net.minecraft.nbt.CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
- nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ //nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
}
// Paper end - shouldBurnInDay API
diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java
index 9baec22561093d64157d93449e84c23b3f238b39..3f331215ef49c52fa3a53bcf744159d2221111f5 100644
--- a/net/minecraft/world/entity/monster/Husk.java
@@ -242,7 +223,6 @@ index 409e98d0981aa8be0d35bc5c93f7130a9ce16860..c2bc638b0029ac46cf388187ca745450
- // Purpur start - Phantoms burn in light
- boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
- boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
- if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - shouldBurnInDay API
- // Purpur end - Phantoms burn in light
- if (getRider() == null || !this.isControllable()) // Purpur - Ridables
- this.igniteForSeconds(8.0F);
@@ -252,24 +232,6 @@ index 409e98d0981aa8be0d35bc5c93f7130a9ce16860..c2bc638b0029ac46cf388187ca745450
super.aiStep();
}
@@ -294,7 +297,7 @@ public class Phantom extends FlyingMob implements Enemy {
this.setPhantomSize(compound.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.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
// Paper end
}
@@ -305,7 +308,7 @@ public class Phantom extends FlyingMob implements Enemy {
compound.putInt("size", this.getPhantomSize());
// Paper start
compound.storeNullable("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity);
- compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ //compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
// Paper end
}
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
index 7f9ee637f443f55ae901d1a0aebedd8f7411996d..aed6db357f5b4550407a424a5b83c590044568ee 100644
--- a/net/minecraft/world/entity/monster/Zombie.java
@@ -278,12 +240,9 @@ index 7f9ee637f443f55ae901d1a0aebedd8f7411996d..aed6db357f5b4550407a424a5b83c590
private boolean canBreakDoors = false;
private int inWaterTime = 0;
public int conversionTime;
- private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
+ //private boolean shouldBurnInDay = true; // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
public Zombie(EntityType<? extends Zombie> entityType, Level level) {
super(entityType, level);
this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(level.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(entityType, level.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
}
@@ -325,14 +284,11 @@ index 7f9ee637f443f55ae901d1a0aebedd8f7411996d..aed6db357f5b4550407a424a5b83c590
+ public boolean shouldBurnInDay() { return this.isSunSensitive(); } // Purpur - for ABI compatibility - API for any mob to burn daylight
public boolean isSunSensitive() {
return this.shouldBurnInDay; // Paper - Add more Zombie API
}
@@ -512,7 +492,7 @@ public class Zombie extends Monster {
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
+ //compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
}
@Override
@@ -340,8 +296,6 @@ index 7f9ee637f443f55ae901d1a0aebedd8f7411996d..aed6db357f5b4550407a424a5b83c590
} else {
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, false);
}
- this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - Add more Zombie API
+ //this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
}
@Override