make it compile \o/

This commit is contained in:
granny
2025-03-27 16:27:08 -07:00
parent f1e732aa3a
commit 73e0e17b6d
29 changed files with 134 additions and 147 deletions

View File

@@ -30,7 +30,7 @@ index f34bc75f324454bf48f0ebf79111706bb027a54b..6ad266592c16bdeccfb689fb2ef2ee37
/* Drop global time updates
if (this.tickCount % 20 == 0) {
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 1ee82020ba335946a54db380d2c3f8d71ce2371b..200c33de28100e42b91dee40e7a531e38d459c7d 100644
index fae2e1af2ea59b82b552bfc33c853e0e33ec90bc..f681d0766a3fec9e05396fe82111e9e99f751823 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -212,6 +212,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -42,7 +42,7 @@ index 1ee82020ba335946a54db380d2c3f8d71ce2371b..200c33de28100e42b91dee40e7a531e3
@Override
public @Nullable LevelChunk getChunkIfLoaded(int x, int z) {
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 6dc490bf9d032b5ed2d7bd458bffd3471f54ff06..cf26a10e4ccf0f28817ce53b3c5bf1df02259273 100644
index 839975cf328268e1f476f5c59e3323a395929395..bba6b5234b668827f90991e4885b5e19c2f97728 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -764,6 +764,15 @@ public class ServerPlayer extends Player {
@@ -75,7 +75,7 @@ index 63e01ec7e4ab04bb7d389bff485dfedca344bfa2..84b1570d0d88f57f33ff8179f0a78d37
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 9f6326da63fc8e0c284d565314f0b448b622c910..488dc3e2e6d6095d416bd81078b3bcbcf92f7ab9 100644
index 7b48f633223cc5e760c5c80d40424e04d791c43a..fc8fbfa5709895456f5aa0c480acedb8707b2ff5 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -2855,6 +2855,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -130,7 +130,7 @@ index 9f6326da63fc8e0c284d565314f0b448b622c910..488dc3e2e6d6095d416bd81078b3bcbc
+
+ public void onMount(Player rider) {
+ if (this instanceof Mob) {
+ ((Mob) this).setTarget(null, null, false);
+ ((Mob) this).setTarget(null, null);
+ ((Mob) this).getNavigation().stop();
+ }
+ rider.setJumping(false); // fixes jump on mount
@@ -177,7 +177,7 @@ index bda521cca91f070139f5e9bdef6a50e1497f53ff..351f92e1627f465a9a292d4a5e5c256a
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index a186784d6b5bae844604a0ca7a2b81857c074a3c..7e2258f0232beae3461ad3ef75b70e9bf1f8b772 100644
index 4d65d88c59a8536d27ec61c65373ab21fa534b3b..e5f296bf3671afd82ab76493646938783b53eef6 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -226,9 +226,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -235,9 +235,9 @@ index a186784d6b5bae844604a0ca7a2b81857c074a3c..7e2258f0232beae3461ad3ef75b70e9b
+ Location to = new Location(level().getWorld(), getX(), getY(), getZ(), this.getYRot(), this.getXRot());
+ org.purpurmc.purpur.event.entity.RidableMoveEvent event = new org.purpurmc.purpur.event.entity.RidableMoveEvent((org.bukkit.entity.Mob) getBukkitLivingEntity(), (org.bukkit.entity.Player) getRider().getBukkitEntity(), from, to.clone());
+ if (!event.callEvent()) {
+ absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
+ this.absSnapTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
+ } else if (!to.equals(event.getTo())) {
+ absMoveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
+ this.absSnapTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
+ }
+ }
+ }
@@ -596,7 +596,7 @@ index 363582056339f64dbe7e686b61451c095c538c00..2cf95769ec3a1662443ea31e1bc2ba01
double d = this.wantedX - this.fish.getX();
double d1 = this.wantedY - this.fish.getY();
diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java
index a6fd3a16e7a9e34ad582601f9ef22d98346fc31c..e55507fa09001b431519ef9c76bf444d7df3f7ea 100644
index 585131365c40136cf8a8a715b077982091ee38d5..65ee07e09bb9bafb60abeec4916fdbb065fc26eb 100644
--- a/net/minecraft/world/entity/animal/Bee.java
+++ b/net/minecraft/world/entity/animal/Bee.java
@@ -149,6 +149,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -1392,7 +1392,7 @@ index ca661c215d2eb719392a30c7b917bd622524c4dc..573efbc5f5f4ad0be30868c7faa058e6
this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this));
this.goalSelector.addGoal(2, new FollowOwnerGoal(this, 1.0, 5.0F, 1.0F));
diff --git a/net/minecraft/world/entity/animal/Pig.java b/net/minecraft/world/entity/animal/Pig.java
index 4a1eee02daf8d4161d21d28baf97b0d16a9b52ae..9e15bf55aa3986a227452fb1a5ebc4315f6f4d6c 100644
index 027d47b89d306bf6bc3d5457a163041f6aa7ab49..74d4be1761b9c9b45bf454f187d4454d9ee6a37f 100644
--- a/net/minecraft/world/entity/animal/Pig.java
+++ b/net/minecraft/world/entity/animal/Pig.java
@@ -65,9 +65,27 @@ public class Pig extends Animal implements ItemSteerable {
@@ -2585,7 +2585,7 @@ index d34dcbbdeae41d23d6fb497e0e8da038580b6d01..6c252b8021dbeb2a9ffee8a3744ac016
protected void defineSynchedData(SynchedEntityData.Builder builder) {
super.defineSynchedData(builder);
diff --git a/net/minecraft/world/entity/animal/wolf/Wolf.java b/net/minecraft/world/entity/animal/wolf/Wolf.java
index d25bd49c17478e73561e78bc66171d6e7bc187ba..127a57a477755101283ba7bbb4161a574692c252 100644
index 0487c463806509b1dd93dcfee3b518c95b0bdb19..7cac99a33a398528bbc55f90cc57a9848e56ff01 100644
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
@@ -187,9 +187,32 @@ public class Wolf extends TamableAnimal implements NeutralMob {
@@ -4121,7 +4121,7 @@ index 4e34833ea5c71b817c9f42a58320fe100981ec93..19dcc657fd2a995638d5e23c2b043d01
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
}
diff --git a/net/minecraft/world/entity/monster/Skeleton.java b/net/minecraft/world/entity/monster/Skeleton.java
index d1853db754065a79a04e1c4cfa2b54c10b041157..9a197c2be40e0a69f4a68ff045c2395802f0a5f3 100644
index 1f35105f6ddd33fc9558d19590a5696479d2de83..5394a5c302c4bd9417dfb304848747fcd2180f07 100644
--- a/net/minecraft/world/entity/monster/Skeleton.java
+++ b/net/minecraft/world/entity/monster/Skeleton.java
@@ -26,6 +26,23 @@ public class Skeleton extends AbstractSkeleton {
@@ -4340,7 +4340,7 @@ index f3de370ee4bafc2cca033293d0d8e5c9c2a6737b..4a7dbd1e4d927240433882a95822e9ed
EntityType<Stray> entityType, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
) {
diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java
index 9d27f55b1a3aa3b51a3b5079d5dd199eefa7d759..bb46a6ec3ad6a7d0943bf61028d5f9abf76bbeb7 100644
index 4b9e60d930bc3a4bfe9aad2e81391e57cfc45d40..ddd3a0d629f720b7acacf01bf2a7db53ee28724e 100644
--- a/net/minecraft/world/entity/monster/Strider.java
+++ b/net/minecraft/world/entity/monster/Strider.java
@@ -92,6 +92,23 @@ public class Strider extends Animal implements ItemSteerable {
@@ -4385,7 +4385,7 @@ index 9d27f55b1a3aa3b51a3b5079d5dd199eefa7d759..bb46a6ec3ad6a7d0943bf61028d5f9ab
if (isFood && !this.isSilent()) {
this.level()
diff --git a/net/minecraft/world/entity/monster/Vex.java b/net/minecraft/world/entity/monster/Vex.java
index bc74bdc3e13f1d51ed6d31470f3ac6f9855778c9..129c712f767fbbdcc7d0df83f838194102efcd15 100644
index bc74bdc3e13f1d51ed6d31470f3ac6f9855778c9..720060d422a6b77020da478b514e9581d8d7e4eb 100644
--- a/net/minecraft/world/entity/monster/Vex.java
+++ b/net/minecraft/world/entity/monster/Vex.java
@@ -58,6 +58,50 @@ public class Vex extends Monster implements TraceableEntity {
@@ -4431,7 +4431,7 @@ index bc74bdc3e13f1d51ed6d31470f3ac6f9855778c9..129c712f767fbbdcc7d0df83f8381941
+ }
+
+ @Override
+ public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
+ public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
+ return false; // no fall damage please
+ }
+ // Purpur end - Ridables

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Implement elytra settings
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 5208518ad9fe86e25b07aeffa9633407aa6f2f1c..7b635a3f047a7f645322bdd8ce5bfa8350d7a739 100644
index af03e75f445bff6dfe56f89fb422b5662a21c962..3ec3e89b0b53ebde5e1eaa49e28b6bacfe781085 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3644,7 +3644,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -29,7 +29,7 @@ index 5208518ad9fe86e25b07aeffa9633407aa6f2f1c..7b635a3f047a7f645322bdd8ce5bfa83
this.gameEvent(GameEvent.ELYTRA_GLIDE);
diff --git a/net/minecraft/world/item/FireworkRocketItem.java b/net/minecraft/world/item/FireworkRocketItem.java
index 18d63d2da49451a2d5e1da7bf0c00e05e2f192bc..ab35b0db023f48854476497d0dbdb0dffbeddb43 100644
index 18d63d2da49451a2d5e1da7bf0c00e05e2f192bc..1f081e098ce3bec61b7f374e9b737838783657bb 100644
--- 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 {
@@ -39,7 +39,7 @@ index 18d63d2da49451a2d5e1da7bf0c00e05e2f192bc..ab35b0db023f48854476497d0dbdb0df
+
+ // Purpur start - Implement elytra settings
+ if (level.purpurConfig.elytraDamagePerFireworkBoost > 0) {
+ List<net.minecraft.world.entity.EquipmentSlot> list = net.minecraft.world.entity.EquipmentSlot.VALUES.stream().filter((enumitemslot) -> net.minecraft.world.entity.LivingEntity.canGlideUsing(player.getItemBySlot(enumitemslot), enumitemslot)).toList();
+ java.util.List<net.minecraft.world.entity.EquipmentSlot> list = net.minecraft.world.entity.EquipmentSlot.VALUES.stream().filter((enumitemslot) -> net.minecraft.world.entity.LivingEntity.canGlideUsing(player.getItemBySlot(enumitemslot), enumitemslot)).toList();
+ net.minecraft.world.entity.EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, player.random);
+
+ ItemStack glideItem = player.getItemBySlot(enumitemslot);
@@ -72,7 +72,7 @@ index 8c9f64140f016edfadeeb75463655cc2f3fafc0c..84e7f1b119ccfdabf48ccac51278e197
onBreak.accept(item);
}
diff --git a/net/minecraft/world/item/TridentItem.java b/net/minecraft/world/item/TridentItem.java
index 5ed862c4eeb9995b25f6a0ee1b57b2fdafb92551..59b1a455895d2842e45d916dcf53dead32e1c72a 100644
index 5ed862c4eeb9995b25f6a0ee1b57b2fdafb92551..34bacb05324fd82cbf8b8836998e2619ede3bcb2 100644
--- a/net/minecraft/world/item/TridentItem.java
+++ b/net/minecraft/world/item/TridentItem.java
@@ -127,6 +127,18 @@ public class TridentItem extends Item implements ProjectileItem {
@@ -81,9 +81,9 @@ index 5ed862c4eeb9995b25f6a0ee1b57b2fdafb92551..59b1a455895d2842e45d916dcf53dead
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(player, stack, f, f1, f2); // CraftBukkit
+
+ // Purpur start - Implement elytra settings
+ List<EquipmentSlot> list = EquipmentSlot.VALUES.stream().filter((enumitemslot) -> LivingEntity.canGlideUsing(entity.getItemBySlot(enumitemslot), enumitemslot)).toList();
+ List<net.minecraft.world.entity.EquipmentSlot> list = net.minecraft.world.entity.EquipmentSlot.VALUES.stream().filter((enumitemslot) -> LivingEntity.canGlideUsing(entity.getItemBySlot(enumitemslot), enumitemslot)).toList();
+ if (!list.isEmpty()) {
+ EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, entity.random);
+ net.minecraft.world.entity.EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, entity.random);
+ ItemStack glideItem = entity.getItemBySlot(enumitemslot);
+ if (glideItem.has(net.minecraft.core.component.DataComponents.GLIDER) && level.purpurConfig.elytraDamagePerTridentBoost > 0) {
+ glideItem.hurtAndBreak(level.purpurConfig.elytraDamagePerTridentBoost, entity, enumitemslot);

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add mobGriefing bypass to everything affected
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 7b635a3f047a7f645322bdd8ce5bfa8350d7a739..2a7434872472b950fe09bfe8f5f334d9964b51d6 100644
index 3ec3e89b0b53ebde5e1eaa49e28b6bacfe781085..36636e35cfb3751d448ee330b51e5ab7c44c6014 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1905,7 +1905,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -320,7 +320,7 @@ index b370b955ac8636275dfada4f38a7ca10297f7dac..275eabf64977cdf262de55124c3e5f88
}
diff --git a/net/minecraft/world/level/block/FarmBlock.java b/net/minecraft/world/level/block/FarmBlock.java
index ba3b8b1e0c646c09e0b3566d632f2735c1ed9051..35c9a20116b971d184181d0dcb1e52c84f480383 100644
index 9883e6d1a1b76155c8ba1817fda6615b4742e18e..c816bd47577cbc898b10d0cfd9c40404429ef929 100644
--- a/net/minecraft/world/level/block/FarmBlock.java
+++ b/net/minecraft/world/level/block/FarmBlock.java
@@ -114,7 +114,7 @@ public class FarmBlock extends Block {
@@ -346,10 +346,10 @@ index 248ac9bc820a96fc7653471308b18834fc735a77..5c6ebde129289f2f7feb44dc1083aa03
}
// CraftBukkit end
diff --git a/net/minecraft/world/level/block/TurtleEggBlock.java b/net/minecraft/world/level/block/TurtleEggBlock.java
index 31851c5404ba3e60c8e8063c6bd0fa94acac6375..4cafcf185dcc0f6c1a380c40d3b654055b492a9a 100644
index a23626dbfacf98ef1bc7918ca35406fa71307bed..bb3bba0d0bf89e82b929fe95247f50ccba964c02 100644
--- a/net/minecraft/world/level/block/TurtleEggBlock.java
+++ b/net/minecraft/world/level/block/TurtleEggBlock.java
@@ -213,7 +213,7 @@ public class TurtleEggBlock extends Block {
@@ -214,7 +214,7 @@ public class TurtleEggBlock extends Block {
// Purpur end - Option to disable turtle egg trampling with feather falling
if (entity instanceof Player) return true;

View File

@@ -18,7 +18,7 @@ index 46022a0aabc9c319deeb75913d356eeb74f1a12c..9952eed6a8ac31c757d5c27e043b85d7
.put(EntityType.OCELOT, Ocelot.createAttributes().build())
.put(EntityType.PANDA, Panda.createAttributes().build())
diff --git a/net/minecraft/world/entity/animal/Cow.java b/net/minecraft/world/entity/animal/Cow.java
index 4bc6d0eb56b4674e2ac0f13010521314a95e0096..34700b4e599efa6fb9ea8c1d0da26bd7fe8fb9eb 100644
index 4bc6d0eb56b4674e2ac0f13010521314a95e0096..731f27cf8687ffa95c0df5601a4465b5174fe248 100644
--- a/net/minecraft/world/entity/animal/Cow.java
+++ b/net/minecraft/world/entity/animal/Cow.java
@@ -22,6 +22,8 @@ import net.minecraft.world.level.Level;
@@ -30,26 +30,22 @@ index 4bc6d0eb56b4674e2ac0f13010521314a95e0096..34700b4e599efa6fb9ea8c1d0da26bd7
private static final EntityDataAccessor<Holder<CowVariant>> DATA_VARIANT_ID = SynchedEntityData.defineId(Cow.class, EntityDataSerializers.COW_VARIANT);
public Cow(EntityType<? extends Cow> entityType, Level level) {
@@ -50,6 +52,7 @@ public class Cow extends AbstractCow {
@@ -48,8 +50,9 @@ public class Cow extends AbstractCow {
// Purpur start - Configurable entity base attributes
@Override
public void initAttributes() {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.cowMaxHealth);
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.cowScale);
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level().purpurConfig.cowNaturallyAggressiveToPlayersDamage); // Purpur - Cows naturally aggressive to players chance
- this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.cowMaxHealth);
- this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.cowScale);
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.cowMaxHealth);
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.SCALE).setBaseValue(this.level().purpurConfig.cowScale);
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_DAMAGE).setBaseValue(this.level().purpurConfig.cowNaturallyAggressiveToPlayersDamage); // Purpur - Cows naturally aggressive to players chance
}
// Purpur end - Configurable entity base attributes
@@ -67,6 +70,21 @@ public class Cow extends AbstractCow {
@@ -67,6 +70,13 @@ public class Cow extends AbstractCow {
}
// Purpur end - Toggle for water sensitive mob damage
+ // Purpur start - Cows naturally aggressive to players chance
+ @Override
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, net.minecraft.world.entity.SpawnGroupData entityData) {
+ this.isNaturallyAggressiveToPlayers = world.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= world.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance;
+ return super.finalizeSpawn(world, difficulty, spawnReason, entityData);
+ }
+ // Purpur end - Cows naturally aggressive to players chance
+
+ @Override
+ protected void registerGoals() {
+ super.registerGoals();
@@ -60,7 +56,7 @@ index 4bc6d0eb56b4674e2ac0f13010521314a95e0096..34700b4e599efa6fb9ea8c1d0da26bd7
@Override
protected void defineSynchedData(SynchedEntityData.Builder builder) {
super.defineSynchedData(builder);
@@ -79,6 +97,12 @@ public class Cow extends AbstractCow {
@@ -79,6 +89,12 @@ public class Cow extends AbstractCow {
VariantUtils.writeVariant(compound, this.getVariant());
}
@@ -73,3 +69,11 @@ index 4bc6d0eb56b4674e2ac0f13010521314a95e0096..34700b4e599efa6fb9ea8c1d0da26bd7
@Override
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
@@ -100,6 +116,7 @@ public class Cow extends AbstractCow {
public SpawnGroupData finalizeSpawn(
ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData spawnGroupData
) {
+ this.isNaturallyAggressiveToPlayers = level.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= level.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance; // Purpur - Cows naturally aggressive to players chance
CowVariants.selectVariantToSpawn(this.random, this.registryAccess(), SpawnContext.create(level, this.blockPosition())).ifPresent(this::setVariant);
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
}

View File

@@ -41,7 +41,7 @@ index 4d44b35ee34eb256b9aff9d74b1cb9ae1ac9503f..46aaba94e7b6bde26ad3b61fcf5e0aa0
public boolean isFlapping() {
return !this.isResting() && this.tickCount % 10.0F == 0.0F;
diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java
index 8da974e98f2207d76e8962eda54c75d0356ecc6f..531d18c5a47eb4676c3dd9b5353f8f9d49b17b54 100644
index 9a9b0d1ca7b30916e1ac3938924ced8d77dafdaf..e9dfff7e3726cd2229f89bb39fa1ca4815d99a6d 100644
--- a/net/minecraft/world/entity/animal/Bee.java
+++ b/net/minecraft/world/entity/animal/Bee.java
@@ -494,6 +494,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -113,12 +113,12 @@ index 6128ed595cb97cc11c1a0e1e1673b3af8e428fb8..7e08573cba6efcd78fcce37bccc2923f
public ItemStack getBucketItemStack() {
return new ItemStack(Items.COD_BUCKET);
diff --git a/net/minecraft/world/entity/animal/Cow.java b/net/minecraft/world/entity/animal/Cow.java
index 34700b4e599efa6fb9ea8c1d0da26bd7fe8fb9eb..4a68181d200c26485f290216f9e52b79965215eb 100644
index 731f27cf8687ffa95c0df5601a4465b5174fe248..6b504c2fdde020e086b0d01139cb56d65b7f9ad1 100644
--- a/net/minecraft/world/entity/animal/Cow.java
+++ b/net/minecraft/world/entity/animal/Cow.java
@@ -78,6 +78,13 @@ public class Cow extends AbstractCow {
@@ -70,6 +70,13 @@ public class Cow extends AbstractCow {
}
// Purpur end - Cows naturally aggressive to players chance
// Purpur end - Toggle for water sensitive mob damage
+ // Purpur start - Mobs always drop experience
+ @Override
@@ -257,7 +257,7 @@ index c1d4bcbc3bad5f2fcaecd4007db7318a07a63324..1b8350a09a9f2a708c8cd1b066982891
@Override
public SpawnGroupData finalizeSpawn(
diff --git a/net/minecraft/world/entity/animal/Pig.java b/net/minecraft/world/entity/animal/Pig.java
index 4618ea2c4d815c07cd94b7bd279167836a116aa7..ca1657a468469c51cf8dc75bf295b78ac9ce6518 100644
index c2718006f6a47dda0655818181881bcdcfef34dc..5bc370d45fc6e0a37cc77ac1b36e0caad959741c 100644
--- a/net/minecraft/world/entity/animal/Pig.java
+++ b/net/minecraft/world/entity/animal/Pig.java
@@ -104,6 +104,13 @@ public class Pig extends Animal implements ItemSteerable {
@@ -599,7 +599,7 @@ index 1ecfda9a5222d7c175108edbbff552ea036e0321..c53ab665a0c87d342adbe395c87e15a3
protected void registerGoals() {
this.eatBlockGoal = new EatBlockGoal(this);
diff --git a/net/minecraft/world/entity/animal/wolf/Wolf.java b/net/minecraft/world/entity/animal/wolf/Wolf.java
index 50fe10588a5cd7b263993db9a52309f332d47a3b..31a08b898cc5ea7d38ddbc045dd911ff18d8c56f 100644
index 243e848a6f4eaa2a72f02a1f056f20d9de23058f..936ee9e80239ad965be75ceeb38d5248243e9c4e 100644
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
@@ -231,6 +231,13 @@ public class Wolf extends TamableAnimal implements NeutralMob {
@@ -977,7 +977,7 @@ index af33bd8c472f7e7bfdab52558bac379166ff2253..a6d6cb3e122488328ff980ed5902caff
protected void registerGoals() {
this.friendsGoal = new Silverfish.SilverfishWakeUpFriendsGoal(this);
diff --git a/net/minecraft/world/entity/monster/Skeleton.java b/net/minecraft/world/entity/monster/Skeleton.java
index 4b0a27dc94313b021e56bef61671f95a31074dc7..724432786e280d41479b06d30d4be4fa91dabb49 100644
index fbf8818e0fd80705648f038647b718ec2a2cd1b6..48cbc3cb983da08cfec78828b15f148459a22b44 100644
--- a/net/minecraft/world/entity/monster/Skeleton.java
+++ b/net/minecraft/world/entity/monster/Skeleton.java
@@ -57,6 +57,13 @@ public class Skeleton extends AbstractSkeleton {
@@ -1049,7 +1049,7 @@ index e4ae604d4d0756edc9418634d9958338997c8203..e69a5c552d2f57bc373cb2b89690a7dd
EntityType<Stray> entityType, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
) {
diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java
index 7b19d64d6b1d61922a2368e38f2b31a42ea29a1a..69b3cd61d49e41ab5fdb861043b012b1f60f8995 100644
index 533801988cb4f8a916ef002a179990ca913b2f32..fe31c4a45afd61be8b74efe9d0858ccd0aced075 100644
--- a/net/minecraft/world/entity/monster/Strider.java
+++ b/net/minecraft/world/entity/monster/Strider.java
@@ -124,6 +124,13 @@ public class Strider extends Animal implements ItemSteerable {
@@ -1067,7 +1067,7 @@ index 7b19d64d6b1d61922a2368e38f2b31a42ea29a1a..69b3cd61d49e41ab5fdb861043b012b1
EntityType<Strider> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
) {
diff --git a/net/minecraft/world/entity/monster/Vex.java b/net/minecraft/world/entity/monster/Vex.java
index bc8727a4ae3f1f30f4de5ab81a79c15a8153e34a..96069c066f6f8fd822e05b264741205ce1077b03 100644
index 0808520f39d5ce96baad25180ead7a69922950f5..488e0605e9769d52faffecbc86c28c779d0ff25b 100644
--- a/net/minecraft/world/entity/monster/Vex.java
+++ b/net/minecraft/world/entity/monster/Vex.java
@@ -117,6 +117,13 @@ public class Vex extends Monster implements TraceableEntity {

View File

@@ -57,7 +57,7 @@
Profiler.get().pop();
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
+ // Purpur start - Configurable daylight cycle
+ int incrementTicks = isDay() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks;
+ int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks;
+ if (incrementTicks != 12000) {
+ this.preciseTime += 12000 / (double) incrementTicks;
+ this.setDayTime(this.preciseTime);

View File

@@ -58,7 +58,7 @@
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
// CraftBukkit end
+ this.portalPos = io.papermc.paper.util.MCUtil.toBlockPosition(exit); // Purpur - Fix stuck in portals
+ this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(exit); // Purpur - Fix stuck in portals
this.setServerLevel(level);
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();

View File

@@ -64,7 +64,7 @@
&& this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
&& (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
// Paper end - Configurable nether ceiling damage
+ if (this.level.purpurConfig.teleportOnNetherCeilingDamage && this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this instanceof ServerPlayer player) player.teleport(io.papermc.paper.util.MCUtil.toLocation(this.level, this.level.getSharedSpawnPos())); else // Purpur - Add option to teleport to spawn on nether ceiling damage
+ if (this.level.purpurConfig.teleportOnNetherCeilingDamage && this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this instanceof ServerPlayer player) player.teleport(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.level.getSharedSpawnPos(), this.level)); else // Purpur - Add option to teleport to spawn on nether ceiling damage
this.onBelowWorld();
}
}
@@ -107,7 +107,7 @@
+
+ // Purpur start - Fire immune API
+ if (compound.contains("Purpur.FireImmune")) {
+ immuneToFire = compound.getBoolean("Purpur.FireImmune");
+ immuneToFire = compound.getBoolean("Purpur.FireImmune").orElse(null);
+ }
+ // Purpur end - Fire immune API
+

View File

@@ -6,7 +6,7 @@
if (damagePerBlock > 0.0) {
+ // Purpur start - Add option to teleport to spawn if outside world border
+ if (this.level().purpurConfig.teleportIfOutsideBorder && this instanceof ServerPlayer serverPlayer) {
+ serverPlayer.teleport(io.papermc.paper.util.MCUtil.toLocation(this.level(), this.level().getSharedSpawnPos()));
+ serverPlayer.teleport(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.level().getSharedSpawnPos(), this.level()));
+ return;
+ }
+ // Purpur end - Add option to teleport to spawn if outside world border

View File

@@ -39,7 +39,7 @@
Bee.this.savedFlowerPos = optional.get();
Bee.this.navigation
.moveTo(Bee.this.savedFlowerPos.getX() + 0.5, Bee.this.savedFlowerPos.getY() + 0.5, Bee.this.savedFlowerPos.getZ() + 0.5, 1.2F);
+ new org.purpurmc.purpur.event.entity.BeeFoundFlowerEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(Bee.this.level(), Bee.this.savedFlowerPos)).callEvent(); // Purpur - Bee API
+ new org.purpurmc.purpur.event.entity.BeeFoundFlowerEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level())).callEvent(); // Purpur - Bee API
return true;
} else {
Bee.this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(Bee.this.random, 20, 60);
@@ -47,7 +47,7 @@
this.pollinating = false;
Bee.this.navigation.stop();
Bee.this.remainingCooldownBeforeLocatingNewFlower = 200;
+ new org.purpurmc.purpur.event.entity.BeeStopPollinatingEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), Bee.this.savedFlowerPos == null ? null : io.papermc.paper.util.MCUtil.toLocation(Bee.this.level(), Bee.this.savedFlowerPos), Bee.this.hasNectar()).callEvent(); // Purpur - Bee API
+ new org.purpurmc.purpur.event.entity.BeeStopPollinatingEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), Bee.this.savedFlowerPos == null ? null : org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level()), Bee.this.hasNectar()).callEvent(); // Purpur - Bee API
}
@Override
@@ -55,7 +55,7 @@
this.setWantedPos();
}
+ if (this.successfulPollinatingTicks == 0) new org.purpurmc.purpur.event.entity.BeeStartedPollinatingEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(Bee.this.level(), Bee.this.savedFlowerPos)).callEvent(); // Purpur - Bee API
+ if (this.successfulPollinatingTicks == 0) new org.purpurmc.purpur.event.entity.BeeStartedPollinatingEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level())).callEvent(); // Purpur - Bee API
this.successfulPollinatingTicks++;
if (Bee.this.random.nextFloat() < 0.05F && this.successfulPollinatingTicks > this.lastSoundPlayedTick + 60) {
this.lastSoundPlayedTick = this.successfulPollinatingTicks;

View File

@@ -6,7 +6,7 @@
boolean isFood = this.isFood(player.getItemInHand(hand));
+ // Purpur start - Pigs give saddle back
+ if (level().purpurConfig.pigGiveSaddleBack && player.isSecondaryUseActive() && !isFood && isSaddled() && !isVehicle()) {
+ this.steering.setSaddle(false);
+ this.setItemSlot(EquipmentSlot.SADDLE, ItemStack.EMPTY);
+ if (!player.getAbilities().instabuild) {
+ ItemStack saddle = new ItemStack(Items.SADDLE);
+ if (!player.getInventory().add(saddle)) {

View File

@@ -56,14 +56,14 @@
+ this.targetSelector.removeGoal(PATHFINDER_VANILLA);
+ this.targetSelector.removeGoal(PATHFINDER_RABID);
+ if (this.isRabid) {
+ setOwnerUUID(null);
+ this.setOwnerReference(null);
+ setTame(false, true);
+ this.targetSelector.addGoal(5, PATHFINDER_RABID);
+ if (modifyEffects) this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.CONFUSION, 1200));
+ if (modifyEffects) this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.NAUSEA, 1200));
+ } else {
+ this.targetSelector.addGoal(5, PATHFINDER_VANILLA);
+ this.stopBeingAngry();
+ if (modifyEffects) this.removeEffect(net.minecraft.world.effect.MobEffects.CONFUSION);
+ if (modifyEffects) this.removeEffect(net.minecraft.world.effect.MobEffects.NAUSEA);
+ }
+ }
+ // Purpur end - Configurable chance for wolves to spawn rabid
@@ -131,7 +131,7 @@
if (this.isAlive()) {
+ // Purpur start - Configurable chance for wolves to spawn rabid
+ if (this.age % 300 == 0 && this.isRabid()) {
+ this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.CONFUSION, 400));
+ this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.NAUSEA, 400));
+ }
+ // Purpur end - Configurable chance for wolves to spawn rabid
this.interestedAngleO = this.interestedAngle;

View File

@@ -32,7 +32,7 @@
+ return net.minecraft.world.InteractionResult.PASS;
+ }
+
+ skeleton.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ skeleton.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ skeleton.setHealth(this.getHealth());
+ skeleton.setAggressive(this.isAggressive());
+ skeleton.copyPosition(this);

View File

@@ -6,7 +6,7 @@
boolean isFood = this.isFood(player.getItemInHand(hand));
+ // Purpur start
+ if (level().purpurConfig.striderGiveSaddleBack && player.isSecondaryUseActive() && !isFood && isSaddled() && !isVehicle()) {
+ this.steering.setSaddle(false);
+ this.setItemSlot(EquipmentSlot.SADDLE, ItemStack.EMPTY);
+ if (!player.getAbilities().instabuild) {
+ ItemStack saddle = new ItemStack(Items.SADDLE);
+ if (!player.getInventory().add(saddle)) {

View File

@@ -21,7 +21,7 @@
+ // Purpur start - add PreExplodeEvents
+ if (this.source != null) {
+ Location location = new Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
+ if(!new org.purpurmc.purpur.event.entity.PreEntityExplodeEvent(this.source.getBukkitEntity(), location, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, org.bukkit.craftbukkit.CraftExplosionResult.toBukkit(getBlockInteraction())).callEvent()) {
+ if(!new org.purpurmc.purpur.event.entity.PreEntityExplodeEvent(this.source.getBukkitEntity(), location, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, org.bukkit.craftbukkit.CraftExplosionResult.toExplosionResult(getBlockInteraction())).callEvent()) {
+ this.wasCanceled = true;
+ return;
+ }
@@ -29,7 +29,7 @@
+ Location location = new Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
+ org.bukkit.block.Block block = location.getBlock();
+ org.bukkit.block.BlockState blockState = (this.damageSource.causingBlockSnapshot() != null) ? this.damageSource.causingBlockSnapshot() : block.getState();
+ if(!new org.purpurmc.purpur.event.PreBlockExplodeEvent(location.getBlock(), this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, blockState, org.bukkit.craftbukkit.CraftExplosionResult.toBukkit(getBlockInteraction())).callEvent()) {
+ if(!new org.purpurmc.purpur.event.PreBlockExplodeEvent(location.getBlock(), this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, blockState, org.bukkit.craftbukkit.CraftExplosionResult.toExplosionResult(getBlockInteraction())).callEvent()) {
+ this.wasCanceled = true;
+ return;
+ }

View File

@@ -1,21 +1,19 @@
--- a/net/minecraft/world/level/block/EnchantingTableBlock.java
+++ b/net/minecraft/world/level/block/EnchantingTableBlock.java
@@ -119,4 +_,18 @@
@@ -119,4 +_,16 @@
protected boolean isPathfindable(BlockState state, PathComputationType pathComputationType) {
return false;
}
+
+ // Purpur start - Enchantment Table Persists Lapis
+ @Override
+ public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean moved) {
+ protected void affectNeighborsAfterRemoval(BlockState state, net.minecraft.server.level.ServerLevel level, BlockPos pos, boolean movedByPiston) {
+ BlockEntity blockEntity = level.getBlockEntity(pos);
+
+ if (level.purpurConfig.enchantmentTableLapisPersists && blockEntity instanceof EnchantingTableBlockEntity enchantmentTable) {
+ net.minecraft.world.Containers.dropItemStack(level, pos.getX(), pos.getY(), pos.getZ(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.LAPIS_LAZULI, enchantmentTable.getLapis()));
+ level.updateNeighbourForOutputSignal(pos, this);
+ net.minecraft.world.Containers.updateNeighboursAfterDestroy(state, level, pos);
+ }
+
+ super.onRemove(state, level, pos, newState, moved);
+ }
+ // Purpur end - Enchantment Table Persists Lapis
}

View File

@@ -9,7 +9,7 @@
&& entity instanceof LivingEntity
&& (entity instanceof Player || serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))
&& entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
@@ -129,6 +_,27 @@
@@ -129,6 +_,28 @@
return;
}
@@ -27,8 +27,9 @@
+
+ // Purpur start - Farmland trampling changes
+ if (level.purpurConfig.farmlandTramplingFeatherFalling) {
+ java.util.Iterator<net.minecraft.world.item.ItemStack> armor = ((LivingEntity) entity).getArmorSlots().iterator();
+ if (armor.hasNext() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING, armor.next()) >= (int) entity.fallDistance) {
+ net.minecraft.world.item.ItemStack bootsItem = ((net.minecraft.world.entity.LivingEntity) entity).getItemBySlot(net.minecraft.world.entity.EquipmentSlot.FEET);
+
+ if (bootsItem != net.minecraft.world.item.ItemStack.EMPTY && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING, bootsItem) >= (int) entity.fallDistance) {
+ return;
+ }
+ }

View File

@@ -29,10 +29,10 @@
+ item.set(net.minecraft.core.component.DataComponents.CUSTOM_NAME, io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName));
+ }
+
+ List<String> lore = level.purpurConfig.silkTouchSpawnerLore;
+ java.util.List<String> lore = level.purpurConfig.silkTouchSpawnerLore;
+ if (lore != null && !lore.isEmpty()) {
+
+ List<Component> loreComponentList = new java.util.ArrayList<>();
+ java.util.List<net.minecraft.network.chat.Component> loreComponentList = new java.util.ArrayList<>();
+ for (String line : lore) {
+ net.kyori.adventure.text.Component lineComponent = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(line, net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.component("mob", mobName));
+ if (line.startsWith("<reset>")) {
@@ -43,7 +43,7 @@
+
+ item.set(net.minecraft.core.component.DataComponents.LORE, new net.minecraft.world.item.component.ItemLore(loreComponentList, loreComponentList));
+ }
+ item.set(net.minecraft.core.component.DataComponents.HIDE_ADDITIONAL_TOOLTIP, net.minecraft.util.Unit.INSTANCE);
+ item.set(net.minecraft.core.component.DataComponents.TOOLTIP_DISPLAY, net.minecraft.world.item.component.TooltipDisplay.DEFAULT.withHidden(net.minecraft.core.component.DataComponents.BLOCK_ENTITY_DATA, true));
+ }
+ popResource(level, pos, item);
+ }

View File

@@ -9,7 +9,7 @@
}
@Override
@@ -189,9 +_,31 @@
@@ -189,9 +_,32 @@
}
private boolean canDestroyEgg(ServerLevel level, Entity entity) {
@@ -35,8 +35,9 @@
+ }
+ // Purpur start - Option to disable turtle egg trampling with feather falling
+ if (level.purpurConfig.turtleEggsTramplingFeatherFalling) {
+ java.util.Iterator<ItemStack> armor = ((LivingEntity) entity).getArmorSlots().iterator();
+ return !armor.hasNext() || net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING, armor.next()) < (int) entity.fallDistance;
+ net.minecraft.world.item.ItemStack bootsItem = ((net.minecraft.world.entity.LivingEntity) entity).getItemBySlot(net.minecraft.world.entity.EquipmentSlot.FEET);
+
+ return bootsItem != net.minecraft.world.item.ItemStack.EMPTY || net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING, bootsItem) < (int) entity.fallDistance;
+ }
+ // Purpur end - Option to disable turtle egg trampling with feather falling
+ if (entity instanceof Player) return true;

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/BushBlock.java
+++ b/net/minecraft/world/level/block/BushBlock.java
@@ -44,4 +_,24 @@
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
BonemealableBlock.findSpreadableNeighbourPos(level, pos, state).ifPresent(blockPos -> level.setBlockAndUpdate(blockPos, this.defaultBlockState()));
--- a/net/minecraft/world/level/block/VegetationBlock.java
+++ b/net/minecraft/world/level/block/VegetationBlock.java
@@ -61,4 +_,24 @@
protected boolean isPathfindable(BlockState state, PathComputationType pathComputationType) {
return pathComputationType == PathComputationType.AIR && !this.hasCollision || super.isPathfindable(state, pathComputationType);
}
+
+ // Purpur start - Ability for hoe to replant crops

View File

@@ -1,36 +1,29 @@
--- a/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -104,6 +_,14 @@
@@ -104,6 +_,10 @@
this.persistentDataContainer.putAll((CompoundTag) persistentDataTag);
}
// Paper end - read persistent data container
+
+ // Purpur start - Persistent BlockEntity Lore and DisplayName
+ if (tag.contains("Purpur.persistentLore")) {
+ net.minecraft.world.item.component.ItemLore.CODEC.decode(net.minecraft.nbt.NbtOps.INSTANCE, tag.getCompound("Purpur.persistentLore")).result()
+ .ifPresent(tag1 -> this.persistentLore = tag1.getFirst());
+ }
+ // Purpur end - Persistent BlockEntity Lore and DisplayName
+
+ this.persistentLore = tag.read("Purpur.persistentLore", net.minecraft.world.item.component.ItemLore.CODEC).orElse(null); // Purpur - Persistent BlockEntity Lore and DisplayName
+
}
public final void loadWithComponents(CompoundTag tag, HolderLookup.Provider registries) {
@@ -116,6 +_,15 @@
this.loadAdditional(tag, registries);
@@ -117,6 +_,12 @@
}
+ // Purpur start - Persistent BlockEntity Lore and DisplayName
+ protected void saveAdditional(CompoundTag nbt) {
+ if (this.persistentLore != null) {
+ net.minecraft.world.item.component.ItemLore.CODEC.encodeStart(net.minecraft.nbt.NbtOps.INSTANCE, this.persistentLore).result()
+ .ifPresent(tag -> nbt.put("Purpur.persistentLore", tag));
+ }
+ }
+ // Purpur end - Persistent BlockEntity Lore and DisplayName
+
protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) {
+ // Purpur start - Persistent BlockEntity Lore and DisplayName
+ if (this.persistentLore != null) {
+ net.minecraft.resources.RegistryOps<net.minecraft.nbt.Tag> registryOps = registries.createSerializationContext(NbtOps.INSTANCE);
+ tag.store("Purpur.persistentLore", net.minecraft.world.item.component.ItemLore.CODEC, registryOps, this.persistentLore);
+ }
+ // Purpur end - Persistent BlockEntity Lore and DisplayName
}
public final CompoundTag saveWithFullMetadata(HolderLookup.Provider registries) {
@@ -377,4 +_,17 @@
private ComponentHelper() {
}

View File

@@ -35,7 +35,7 @@
);
}
}
@@ -297,6 +_,28 @@
@@ -297,6 +_,26 @@
// CraftBukkit - this
return new CommandSourceStack(commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel)level, 2, string, component, level.getServer(), player); // Paper - Fix commands from signs not firing command events
}
@@ -51,10 +51,8 @@
+ final String line = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().serialize(component);
+ final var text = net.kyori.adventure.text.Component.text(line);
+ final String json = net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(text);
+ if (!nbt.contains(side)) nbt.put(side, new CompoundTag());
+ final CompoundTag sideNbt = nbt.getCompound(side);
+ if (!sideNbt.contains("messages")) sideNbt.put("messages", new net.minecraft.nbt.ListTag());
+ final net.minecraft.nbt.ListTag messagesNbt = sideNbt.getList("messages", Tag.TAG_STRING);
+ final CompoundTag sideNbt = nbt.getCompoundOrEmpty(side);
+ final net.minecraft.nbt.ListTag messagesNbt = sideNbt.getListOrEmpty("messages");
+ messagesNbt.set(i, net.minecraft.nbt.StringTag.valueOf(json));
+ }
+ nbt.putString("PurpurEditor", "true");

View File

@@ -37,7 +37,7 @@ index 1a4f42c9e6012a6a074c9d5451d8dc11530a5c5b..67b9963afd91af84459d439697f6230f
+ // Purpur end - Ridables
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index a7e3afe04ffbb0fd5fa5fcf7cd15efd7cea1c4e0..9c88a5b6b054636a9f326d0253f65496cf3babc3 100644
index a7e3afe04ffbb0fd5fa5fcf7cd15efd7cea1c4e0..f32316b0357f1cb0501a052361a0221f8e9d1438 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -514,6 +514,15 @@ public class CraftEventFactory {
@@ -45,10 +45,10 @@ index a7e3afe04ffbb0fd5fa5fcf7cd15efd7cea1c4e0..9c88a5b6b054636a9f326d0253f65496
craftServer.getPluginManager().callEvent(event);
+ // Purpur start - Ridables
+ if (who != null) {
+ if (player != null) {
+ switch (action) {
+ case LEFT_CLICK_BLOCK, LEFT_CLICK_AIR -> who.processClick(InteractionHand.MAIN_HAND);
+ case RIGHT_CLICK_BLOCK, RIGHT_CLICK_AIR -> who.processClick(InteractionHand.OFF_HAND);
+ case LEFT_CLICK_BLOCK, LEFT_CLICK_AIR -> player.processClick(InteractionHand.MAIN_HAND);
+ case RIGHT_CLICK_BLOCK, RIGHT_CLICK_AIR -> player.processClick(InteractionHand.OFF_HAND);
+ }
+ }
+ // Purpur end - Ridables

View File

@@ -13,7 +13,7 @@
CompoundTag data = this.getData();
if (data == null) {
return null;
@@ -571,4 +_,191 @@
@@ -571,4 +_,183 @@
manager.save();
}
}
@@ -26,9 +26,8 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return false;
+ if (!data.contains("abilities")) return false;
+ CompoundTag abilities = data.getCompound("abilities");
+ return abilities.getByte("mayfly") == (byte) 1;
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return false;
+ return abilities.getByteOr("mayfly", (byte) 0) == (byte) 1;
+ }
+ }
+
@@ -39,8 +38,7 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return;
+ if (!data.contains("abilities")) return;
+ CompoundTag abilities = data.getCompound("abilities");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return;
+ abilities.putByte("mayfly", (byte) (flight ? 1 : 0));
+ data.put("abilities", abilities);
+ save(data);
@@ -54,9 +52,8 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return false;
+ if (!data.contains("abilities")) return false;
+ CompoundTag abilities = data.getCompound("abilities");
+ return abilities.getByte("flying") == (byte) 1;
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return false;
+ return abilities.getByteOr("flying", (byte) 0) == (byte) 1;
+ }
+ }
+
@@ -67,8 +64,7 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return;
+ if (!data.contains("abilities")) return;
+ CompoundTag abilities = data.getCompound("abilities");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return;
+ abilities.putByte("mayfly", (byte) (value ? 1 : 0));
+ data.put("abilities", abilities);
+ save(data);
@@ -83,8 +79,7 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return;
+ if (!data.contains("abilities")) return;
+ CompoundTag abilities = data.getCompound("abilities");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return;
+ abilities.putFloat("flySpeed", value);
+ data.put("abilities", abilities);
+ save(data);
@@ -98,9 +93,8 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return 0;
+ if (!data.contains("abilities")) return 0;
+ CompoundTag abilities = data.getCompound("abilities");
+ return abilities.getFloat("flySpeed");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return 0;
+ return abilities.getFloatOr("flySpeed", 0);
+ }
+ }
+
@@ -112,8 +106,7 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return;
+ if (!data.contains("abilities")) return;
+ CompoundTag abilities = data.getCompound("abilities");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return;
+ abilities.putFloat("walkSpeed", value);
+ data.put("abilities", abilities);
+ save(data);
@@ -127,9 +120,8 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return 0;
+ if (!data.contains("abilities")) return 0;
+ CompoundTag abilities = data.getCompound("abilities");
+ return abilities.getFloat("walkSpeed");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return 0;
+ return abilities.getFloatOr("walkSpeed", 0);
+ }
+ }
+

View File

@@ -6,7 +6,7 @@
+ // Purpur start - Add local difficulty api
+ public float getLocalDifficultyAt(Location location) {
+ return getHandle().getCurrentDifficultyAt(io.papermc.paper.util.MCUtil.toBlockPosition(location)).getEffectiveDifficulty();
+ return getHandle().getCurrentDifficultyAt(org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(location)).getEffectiveDifficulty();
+ }
+ // Purpur end - Add local difficulty api
+
@@ -28,7 +28,7 @@
+
+ @Override
+ public void sendBlockHighlight(Location location, int duration, String text, int argb) {
+ net.minecraft.network.protocol.game.DebugPackets.sendGameTestAddMarker(getHandle(), io.papermc.paper.util.MCUtil.toBlockPosition(location), text, argb, duration);
+ net.minecraft.network.protocol.game.DebugPackets.sendGameTestAddMarker(getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(location), text, argb, duration);
+ }
+
+ @Override

View File

@@ -94,7 +94,7 @@
+ @Override
+ public void sendBlockHighlight(Location location, int duration, String text, int argb) {
+ if (this.getHandle().connection == null) return;
+ this.getHandle().connection.send(new net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket(new net.minecraft.network.protocol.common.custom.GameTestAddMarkerDebugPayload(io.papermc.paper.util.MCUtil.toBlockPosition(location), argb, text, duration)));
+ this.getHandle().connection.send(new net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket(new net.minecraft.network.protocol.common.custom.GameTestAddMarkerDebugPayload(org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(location), argb, text, duration)));
+ }
+
+ @Override

View File

@@ -3,9 +3,9 @@ package org.purpurmc.purpur.entity;
import io.papermc.paper.adventure.PaperAdventure;
import net.kyori.adventure.text.Component;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.nbt.NbtOps;
import net.minecraft.network.chat.ComponentSerialization;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.item.component.CustomData;
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
import org.bukkit.block.EntityBlockStorage;
import org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer;
@@ -32,12 +32,11 @@ public class PurpurStoredBee implements StoredEntity<Bee> {
this.blockStorage = blockStorage;
CompoundTag customData = handle.occupant.entityData().copyTag();
this.customName = customData.contains("CustomName")
? PaperAdventure.asAdventure(net.minecraft.network.chat.Component.Serializer.fromJson(customData.getString("CustomName"), MinecraftServer.getDefaultRegistryAccess()))
: null;
net.minecraft.network.chat.Component customNameMinecraft = customData.read("CustomName", ComponentSerialization.CODEC, MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE)).orElse(null);
this.customName = customNameMinecraft == null ? null : PaperAdventure.asAdventure(customNameMinecraft);
if(customData.contains("BukkitValues", Tag.TAG_COMPOUND)) {
this.persistentDataContainer.putAll(customData.getCompound("BukkitValues"));
if (customData.get("BukkitValues") instanceof CompoundTag compoundTag) {
this.persistentDataContainer.putAll(compoundTag);
}
}

View File

@@ -70,7 +70,7 @@ public class PhantomFlames extends LlamaSpit {
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
} else if (this.level().getBlockStates(this.getBoundingBox()).noneMatch(BlockBehaviour.BlockStateBase::isAir)) {
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
} else if (this.isInWaterOrBubble()) {
} else if (this.isInWater()) {
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
} else {
this.setDeltaMovement(mot.scale(0.99D));

View File

@@ -1,5 +1,6 @@
package org.purpurmc.purpur.item;
import java.util.Optional;
import net.minecraft.core.BlockPos;
import net.minecraft.core.component.DataComponents;
import net.minecraft.nbt.CompoundTag;
@@ -27,11 +28,11 @@ public class SpawnerItem extends BlockItem {
BlockEntity blockEntity = level.getBlockEntity(pos);
if (blockEntity instanceof SpawnerBlockEntity spawner) {
CompoundTag customData = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY).copyTag();
if (customData.contains("Purpur.mob_type")) {
EntityType.byString(customData.getString("Purpur.mob_type")).ifPresent(type -> spawner.getSpawner().setEntityId(type, level, level.random, pos));
Optional<String> mobTypeStringOptional = customData.getString("Purpur.mob_type");
if (mobTypeStringOptional.isPresent()) {
EntityType.byString(mobTypeStringOptional.get()).ifPresent(type -> spawner.getSpawner().setEntityId(type, level, level.random, pos));
} else if (customData.contains("Purpur.SpawnData")) {
net.minecraft.world.level.SpawnData.CODEC.parse(net.minecraft.nbt.NbtOps.INSTANCE, customData.getCompound("Purpur.SpawnData")).result()
.ifPresent(spawnData -> spawner.getSpawner().nextSpawnData = spawnData);
customData.read("SpawnData", net.minecraft.world.level.SpawnData.CODEC).ifPresent(spawnData -> spawner.getSpawner().nextSpawnData = spawnData);
}
}
}