43/103 rejected minecraft source files applied

(idk what i was counting in the previous commit...)
This commit is contained in:
granny
2026-03-11 21:06:08 -07:00
parent 5eb960544c
commit 1f72458912
71 changed files with 1302 additions and 1656 deletions

View File

@@ -1,178 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 118ba985eff209ff97dd2c8b2749a75113f5ce43..5efb94bf1029fdbbd48937c1f3925421d6daacfd 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -153,6 +153,7 @@ import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
public abstract class Entity implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, SlotProvider, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker
+ public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur - Configurable entity base attributes
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
static boolean isLevelAtLeast(ValueInput input, int level) {
@@ -282,8 +283,9 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
public double xOld;
public double yOld;
public double zOld;
+ public float maxUpStep; // Purpur - Add option to set armorstand step height
public boolean noPhysics;
- public final RandomSource random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
+ public final RandomSource random; // Paper - Share random for entities to make them more random // Add toggle for RNG manipulation
public int tickCount;
private int remainingFireTicks;
public boolean wasTouchingWater;
@@ -316,8 +318,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
public @Nullable PortalProcessor portalProcess;
public int portalCooldown;
private boolean invulnerable;
- protected UUID uuid = Mth.createInsecureUUID(this.random);
- protected String stringUUID = this.uuid.toString();
+ protected UUID uuid; // Purpur - Add toggle for RNG manipulation
+ protected String stringUUID; // Purpur - Add toggle for RNG manipulation
private boolean hasGlowingTag;
private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
@@ -373,6 +375,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive;
public long activatedImmunityTick = Integer.MIN_VALUE;
+ public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API
public void inactiveTick() {
}
@@ -535,10 +538,22 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
// Paper end - optimise entity tracker
+ // Purpur start - Add canSaveToDisk to Entity
+ public boolean canSaveToDisk() {
+ return true;
+ }
+ // Purpur end - Add canSaveToDisk to Entity
+
public Entity(EntityType<?> type, Level level) {
this.type = type;
this.level = level;
this.dimensions = type.getDimensions();
+ this.maxAirTicks = level == null ? Entity.TOTAL_AIR_SUPPLY : this.level.purpurConfig.drowningAirTicks; // Purpur - Drowning Settings
+ // Purpur start - Add toggle for RNG manipulation
+ this.random = level == null || level.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create();
+ this.uuid = Mth.createInsecureUUID(this.random);
+ this.stringUUID = this.uuid.toString();
+ // Purpur end - Add toggle for RNG manipulation
this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO;
@@ -931,6 +946,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
&& 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(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.level.levelData.getRespawnData().pos(), this.level)); else // Purpur - Add option to teleport to spawn on nether ceiling damage
this.onBelowWorld();
}
}
@@ -1960,7 +1976,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
public boolean fireImmune() {
- return this.getType().fireImmune();
+ return this.immuneToFire != null ? immuneToFire : this.getType().fireImmune(); // Purpur - add fire immune API
}
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -2572,7 +2588,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
output.putBoolean("Bukkit.invisible", this.persistentInvisibility);
}
// SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
- if (this.maxAirTicks != this.getDefaultMaxAirSupply()) {
+ if (this.maxAirTicks != this.getDefaultMaxAirSupply() && this.getDefaultMaxAirSupply() != this.level().purpurConfig.drowningAirTicks) { // Purpur - Drowning Settings
output.putInt("Bukkit.MaxAirSupply", this.getMaxAirSupply());
}
output.putInt("Spigot.ticksLived", this.totalEntityAge); // Paper
@@ -2659,6 +2675,11 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
output.putBoolean("Paper.FreezeLock", true);
}
// Paper end
+ // Purpur start - Fire immune API
+ if (immuneToFire != null) {
+ output.putBoolean("Purpur.FireImmune", immuneToFire);
+ }
+ // Purpur end - Fire immune API
} catch (Throwable var7) {
CrashReport crashReport = CrashReport.forThrowable(var7, "Saving entity NBT");
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being saved");
@@ -2779,6 +2800,9 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
freezeLocked = input.getBooleanOr("Paper.FreezeLock", false);
// Paper end
+
+ immuneToFire = input.read("Purpur.FireImmune", com.mojang.serialization.Codec.BOOL).orElse(null); // Purpur - Fire immune API
+
} catch (Throwable var7) {
CrashReport crashReport = CrashReport.forThrowable(var7, "Loading entity NBT");
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
@@ -3042,6 +3066,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
if (this.isAlive() && this instanceof Leashable leashable2) {
if (leashable2.getLeashHolder() == player) {
if (!this.level().isClientSide()) {
+ if (hand == InteractionHand.OFF_HAND && (level().purpurConfig.villagerCanBeLeashed || level().purpurConfig.wanderingTraderCanBeLeashed) && this instanceof net.minecraft.world.entity.npc.villager.AbstractVillager) return InteractionResult.CONSUME; // Purpur - Allow leashing villagers
// Paper start - EntityUnleashEvent
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
leashable2, player, hand, !player.hasInfiniteMaterials(), true
@@ -3472,15 +3497,18 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
return Vec3.directionFromRotation(this.getRotationVector());
}
+ public BlockPos portalPos = BlockPos.ZERO; // Purpur - Fix stuck in portals
public void setAsInsidePortal(Portal portal, BlockPos pos) {
if (this.isOnPortalCooldown()) {
+ if (!(level().purpurConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(this.portalPos))) // Purpur - Fix stuck in portals
this.setPortalCooldown();
- } else {
+ } else if (this.level.purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer) { // Purpur - Entities can use portals
if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) {
this.portalProcess = new PortalProcessor(portal, pos.immutable());
} else if (!this.portalProcess.isInsidePortalThisTick()) {
this.portalProcess.updateEntryPosition(pos.immutable());
this.portalProcess.setAsInsidePortalThisTick(true);
+ this.portalPos = BlockPos.ZERO; // Purpur - Fix stuck in portals
}
}
}
@@ -4220,7 +4248,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
public boolean canUsePortal(boolean allowPassengers) {
- return (allowPassengers || !this.isPassenger()) && this.isAlive();
+ return (allowPassengers || !this.isPassenger()) && this.isAlive() && (this.level.purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer); // Purpur - Entities can use portals
}
public boolean canTeleport(Level fromLevel, Level toLevel) {
@@ -4739,6 +4767,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
return Mth.lerp(partialTick, this.yRotO, this.yRot);
}
+ // Purpur start - Stop squids floating on top of water
+ public AABB getAxisForFluidCheck() {
+ return this.getBoundingBox().deflate(0.001D);
+ }
+ // Purpur end - Stop squids floating on top of water
+
// Paper start - optimise collisions
public boolean updateFluidHeightAndDoFluidPushing(final TagKey<Fluid> fluid, final double flowScale) {
if (this.touchingUnloadedChunk()) {
@@ -5159,7 +5193,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
public float maxUpStep() {
- return 0.0F;
+ return maxUpStep; // Purpur - Add option to set armorstand step height
}
public void onExplosionHit(@Nullable Entity entity) {

View File

@@ -1,52 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java
index a3cba4a65687c61fefbfcf3c35625ceed2e50bfb..f0731609fbfb06ea23baba2a8b3694003a470b7d 100644
--- a/net/minecraft/world/entity/EntityType.java
+++ b/net/minecraft/world/entity/EntityType.java
@@ -1240,6 +1240,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return register(vanillaEntityId(key), builder);
}
+ // Purpur start - PlayerSetSpawnerTypeWithEggEvent
+ public static EntityType<?> getFromBukkitType(org.bukkit.entity.EntityType bukkitType) {
+ return getFromKey(Identifier.parse(bukkitType.getKey().toString()));
+ }
+
+ public static EntityType<?> getFromKey(Identifier location) {
+ return BuiltInRegistries.ENTITY_TYPE.getValue(location);
+ }
+ // Purpur end - PlayerSetSpawnerTypeWithEggEvent
+
public static Identifier getKey(EntityType<?> entityType) {
return BuiltInRegistries.ENTITY_TYPE.getKey(entityType);
}
@@ -1467,6 +1477,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return this.category;
}
+ // Purpur start - PlayerSetSpawnerTypeWithEggEvent
+ public String getName() {
+ return BuiltInRegistries.ENTITY_TYPE.getKey(this).getPath();
+ }
+
+ public String getTranslatedName() {
+ return getDescription().getString();
+ }
+ // Purpur end - PlayerSetSpawnerTypeWithEggEvent
+
public String getDescriptionId() {
return this.descriptionId;
}
@@ -1528,6 +1548,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
// Paper start - Add logging for debugging entity tags with invalid ids
() -> {
LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]"));
+ LOGGER.warn("Location: {} {}", level.getWorld().getName(), input.read("Pos", net.minecraft.world.phys.Vec3.CODEC).orElse(net.minecraft.world.phys.Vec3.ZERO)); // Purpur - log skipped entity's position
if ((DEBUG_ENTITIES_WITH_INVALID_IDS || level.getCraftServer().getServer().isDebugging()) && input instanceof TagValueInput tagInput) {
LOGGER.warn("Skipped entity tag: {}", tagInput.input);
}

View File

@@ -1,28 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/ExperienceOrb.java b/net/minecraft/world/entity/ExperienceOrb.java
index f2ec0bd8cca3c08d558790537e17a8a2f95f1953..c655689cdd2d4e655dfc872edd231dcdfb7c0995 100644
--- a/net/minecraft/world/entity/ExperienceOrb.java
+++ b/net/minecraft/world/entity/ExperienceOrb.java
@@ -355,7 +355,7 @@ public class ExperienceOrb extends Entity {
public void playerTouch(Player entity) {
if (entity instanceof ServerPlayer serverPlayer) {
if (entity.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(serverPlayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent
- entity.takeXpDelay = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerXpCooldownEvent(entity, 2, org.bukkit.event.player.PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entity.takeXpDelay = 2;
+ entity.takeXpDelay = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerXpCooldownEvent(entity, this.level().purpurConfig.playerExpPickupDelay, org.bukkit.event.player.PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entity.takeXpDelay = 2; // Purpur - Configurable player pickup exp delay
entity.take(this, 1);
int i = this.repairPlayerItems(serverPlayer, this.getValue());
if (i > 0) {
@@ -371,7 +371,7 @@ public class ExperienceOrb extends Entity {
}
private int repairPlayerItems(ServerPlayer player, int value) {
- Optional<EnchantedItemInUse> randomItemWith = EnchantmentHelper.getRandomItemWith(
+ Optional<EnchantedItemInUse> randomItemWith = level().purpurConfig.useBetterMending ? EnchantmentHelper.getMostDamagedItemWith(EnchantmentEffectComponents.REPAIR_WITH_XP, player) : EnchantmentHelper.getRandomItemWith( // Purpur - Add option to mend the most damaged equipment first
EnchantmentEffectComponents.REPAIR_WITH_XP, player, ItemStack::isDamaged
);
if (randomItemWith.isPresent()) {

View File

@@ -1,195 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 54f31965213309a2cd228b7211e96ae1b9c219d4..527db90fa6faa6f39a80e64db16e28f1d616ce4d 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -447,6 +447,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
if (d < 0.0) {
double damagePerBlock = serverLevel1.getWorldBorder().getDamagePerBlock();
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(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.level().levelData.getRespawnData().pos(), this.level()));
+ return;
+ }
+ // Purpur end - Add option to teleport to spawn if outside world border
this.hurtServer(serverLevel1, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-d * damagePerBlock)));
}
}
@@ -462,7 +468,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
if (this.shouldTakeDrowningDamage()) {
this.setAirSupply(0);
serverLevel1.broadcastEntityEvent(this, EntityEvent.DROWN_PARTICLES);
- this.hurtServer(serverLevel1, this.damageSources().drown(), 2.0F);
+ this.hurtServer(serverLevel1, this.damageSources().drown(), (float) this.level().purpurConfig.damageFromDrowning); // Purpur - Drowning Settings
}
} else if (this.getAirSupply() < this.getMaxAirSupply() && MobEffectUtil.shouldEffectsRefillAirsupply(this)) {
this.setAirSupply(this.increaseAirSupply(this.getAirSupply()));
@@ -522,7 +528,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
protected boolean shouldTakeDrowningDamage() {
- return this.getAirSupply() <= -20;
+ return this.getAirSupply() <= -this.level().purpurConfig.drowningDamageInterval; // Purpur - Drowning Settings
}
@Override
@@ -1050,15 +1056,33 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
if (lookingEntity != null) {
ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
EntityType<?> type = lookingEntity.getType();
- if (type == EntityType.SKELETON && itemBySlot.is(Items.SKELETON_SKULL)
- || type == EntityType.ZOMBIE && itemBySlot.is(Items.ZOMBIE_HEAD)
- || type == EntityType.PIGLIN && itemBySlot.is(Items.PIGLIN_HEAD)
- || type == EntityType.PIGLIN_BRUTE && itemBySlot.is(Items.PIGLIN_HEAD)
- || type == EntityType.CREEPER && itemBySlot.is(Items.CREEPER_HEAD)) {
- d *= 0.5;
+ // Purpur start - Mob head visibility percent
+ if (type == EntityType.SKELETON && itemBySlot.is(Items.SKELETON_SKULL)) {
+ d *= lookingEntity.level().purpurConfig.skeletonHeadVisibilityPercent;
+ }
+ else if (type == EntityType.ZOMBIE && itemBySlot.is(Items.ZOMBIE_HEAD)) {
+ d *= lookingEntity.level().purpurConfig.zombieHeadVisibilityPercent;
+ }
+ else if ((type == EntityType.PIGLIN || type == EntityType.PIGLIN_BRUTE) && itemBySlot.is(Items.PIGLIN_HEAD)) {
+ d *= lookingEntity.level().purpurConfig.piglinHeadVisibilityPercent;
}
+ else if (type == EntityType.CREEPER && itemBySlot.is(Items.CREEPER_HEAD)) {
+ d *= lookingEntity.level().purpurConfig.creeperHeadVisibilityPercent;
+ }
+ // Purpur end - Mob head visibility percent
}
+ // Purpur start - Configurable mob blindness
+ if (lookingEntity instanceof LivingEntity entityliving) {
+ if (entityliving.hasEffect(MobEffects.BLINDNESS)) {
+ int amplifier = entityliving.getEffect(MobEffects.BLINDNESS).getAmplifier();
+ for (int i = 0; i < amplifier; i++) {
+ d *= this.level().purpurConfig.mobsBlindnessMultiplier;
+ }
+ }
+ }
+ // Purpur end - Configurable mob blindness
+
return d;
}
@@ -1104,6 +1128,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
Iterator<MobEffectInstance> iterator = this.activeEffects.values().iterator();
while (iterator.hasNext()) {
MobEffectInstance effect = iterator.next();
+ if (cause == EntityPotionEffectEvent.Cause.MILK && !this.level().purpurConfig.milkClearsBeneficialEffects && effect.getEffect().value().isBeneficial()) continue; // Purpur - Milk Keeps Beneficial Effects
EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
if (event.isCancelled()) {
continue;
@@ -1436,6 +1461,24 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.stopSleeping();
}
+ // Purpur start - One Punch Man!
+ if (damageSource.getEntity() instanceof net.minecraft.world.entity.player.Player player && damageSource.getEntity().level().purpurConfig.creativeOnePunch && !damageSource.is(DamageTypeTags.IS_PROJECTILE)) {
+ if (player.isCreative()) {
+ org.apache.commons.lang3.mutable.MutableDouble attackDamage = new org.apache.commons.lang3.mutable.MutableDouble();
+ player.getMainHandItem().forEachModifier(EquipmentSlot.MAINHAND, (attributeHolder, attributeModifier) -> {
+ if (attributeModifier.operation() == AttributeModifier.Operation.ADD_VALUE) {
+ attackDamage.addAndGet(attributeModifier.amount());
+ }
+ });
+
+ if (attackDamage.doubleValue() == 0.0D) {
+ // One punch!
+ amount = 9999F;
+ }
+ }
+ }
+ // Purpur end - One Punch Man!
+
this.noActionTime = 0;
if (amount < 0.0F) {
amount = 0.0F;
@@ -1697,10 +1740,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
protected @Nullable Player resolvePlayerResponsibleForDamage(DamageSource damageSource) {
Entity entity = damageSource.getEntity();
if (entity instanceof Player player) {
- this.setLastHurtByPlayer(player, 100);
+ this.setLastHurtByPlayer(player, this.level().purpurConfig.mobLastHurtByPlayerTime); // Purpur - Config for mob last hurt by player time
} else if (entity instanceof Wolf wolf && wolf.isTame()) {
if (wolf.getOwnerReference() != null) {
- this.setLastHurtByPlayer(wolf.getOwnerReference().getUUID(), 100);
+ this.setLastHurtByPlayer(wolf.getOwnerReference().getUUID(), this.level().purpurConfig.mobLastHurtByPlayerTime); // Purpur - Config for mob last hurt by player time
} else {
this.lastHurtByPlayer = null;
this.lastHurtByPlayerMemoryTime = 0;
@@ -1751,6 +1794,30 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
}
+ // Purpur start - Totems work in inventory
+ if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemStack == null || itemStack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) {
+ for (ItemStack item : player.getInventory().getNonEquipmentItems()) {
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
+ itemInHand = item;
+ itemStack = item.copy();
+ break;
+ }
+ }
+ }
+ // Purpur end - Totems work in inventory
+
+ // Purpur start - Totems work in inventory
+ if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemStack == null || itemStack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) {
+ for (ItemStack item : player.getInventory().getNonEquipmentItems()) {
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
+ itemInHand = item;
+ itemStack = item.copy();
+ break;
+ }
+ }
+ }
+ // Purpur end - Totems work in inventory
+
final org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
event.setCancelled(itemStack == null);
@@ -1932,6 +1999,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
boolean flag = this.lastHurtByPlayerMemoryTime > 0;
this.dropEquipment(level); // CraftBukkit - from below
if (this.shouldDropLoot(level)) {
+ if (!(damageSource.is(net.minecraft.world.damagesource.DamageTypes.CRAMMING) && level().purpurConfig.disableDropsOnCrammingDeath)) { // Purpur - Disable loot drops on death by cramming
this.dropFromLootTable(level, damageSource, flag);
// Paper start
final boolean prev = this.clearEquipmentSlots;
@@ -1940,6 +2008,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
// Paper end
this.dropCustomDeathLoot(level, damageSource, flag);
this.clearEquipmentSlots = prev; // Paper
+ } // Purpur - Disable loot drops on death by cramming
}
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
@@ -3214,6 +3283,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
float f = (float)(d * 10.0 - 3.0);
if (f > 0.0F) {
this.playSound(this.getFallDamageSound((int)f), 1.0F, 1.0F);
+ if (level().purpurConfig.elytraKineticDamage) // Purpur - Toggle for kinetic damage
this.hurt(this.damageSources().flyIntoWall(), f);
}
}
@@ -4680,6 +4750,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType());
}
+ // Purpur start - Dispenser curse of binding protection
+ public @Nullable EquipmentSlot getEquipmentSlotForDispenserItem(ItemStack itemstack) {
+ return EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.BINDING_CURSE, itemstack) > 0 ? null : this.getEquipmentSlotForItem(itemstack);
+ }
+ // Purpur end - Dispenser curse of binding protection
+
private static SlotAccess createEquipmentSlotAccess(LivingEntity entity, EquipmentSlot slot) {
return slot != EquipmentSlot.HEAD && slot != EquipmentSlot.MAINHAND && slot != EquipmentSlot.OFFHAND
? SlotAccess.forEquipmentSlot(entity, slot, itemStack -> itemStack.isEmpty() || entity.getEquipmentSlotForItem(itemStack) == slot)

View File

@@ -1,88 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index 92175cc019750e829fcad7691a937024c2649882..cf2cbc3bf5e0000737ebeac3867f12d7e07bda01 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -150,6 +150,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
private int homeRadius = -1;
public boolean aware = true; // CraftBukkit
public net.kyori.adventure.util.TriState despawnInPeacefulOverride = net.kyori.adventure.util.TriState.NOT_SET; // Paper - allow changing despawnInPeaceful
+ public int ticksSinceLastInteraction; // Purpur - Entity lifespan
protected Mob(EntityType<? extends Mob> type, Level level) {
super(type, level);
@@ -292,6 +293,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
target = null;
}
}
+ if (target instanceof net.minecraft.server.level.ServerPlayer) this.ticksSinceLastInteraction = 0; // Purpur - Entity lifespan
this.target = target;
return true;
// CraftBukkit end
@@ -335,8 +337,28 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
profilerFiller.pop();
+ incrementTicksSinceLastInteraction(); // Purpur - Entity lifespan
}
+ // Purpur start - Entity lifespan
+ private void incrementTicksSinceLastInteraction() {
+ ++this.ticksSinceLastInteraction;
+ if (getRider() != null) {
+ this.ticksSinceLastInteraction = 0;
+ return;
+ }
+ if (this.level().purpurConfig.entityLifeSpan <= 0) {
+ return; // feature disabled
+ }
+ if (!this.removeWhenFarAway(0) || isPersistenceRequired() || requiresCustomPersistence() || hasCustomName()) {
+ return; // mob persistent
+ }
+ if (this.ticksSinceLastInteraction > this.level().purpurConfig.entityLifeSpan) {
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
+ }
+ }
+ // Purpur end - Entity lifespan
+
@Override
protected void playHurtSound(DamageSource damageSource) {
this.resetAmbientSoundTime();
@@ -439,6 +461,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
output.putString("Paper.DespawnInPeacefulOverride", this.despawnInPeacefulOverride.name());
}
// Paper end - allow changing despawnInPeaceful
+ output.putInt("Purpur.ticksSinceLastInteraction", this.ticksSinceLastInteraction); // Purpur - Entity lifespan
}
@Override
@@ -466,6 +489,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
this.lootTableSeed = input.getLongOr("DeathLootTableSeed", 0L);
this.setNoAi(input.getBooleanOr("NoAI", false));
this.aware = input.getBooleanOr("Bukkit.Aware", true); // CraftBukkit
+ this.ticksSinceLastInteraction = input.getIntOr("Purpur.ticksSinceLastInteraction", 0); // Purpur- Entity lifespan
// Paper start - allow changing despawnInPeaceful
this.despawnInPeacefulOverride = readDespawnInPeacefulOverride(input);
}
@@ -1246,7 +1270,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
);
}
- this.setLeftHanded(random.nextFloat() < 0.05F);
+ this.setLeftHanded(random.nextFloat() < level.getLevel().purpurConfig.entityLeftHandedChance); // Purpur - Changeable Mob Left Handed Chance
return spawnGroupData;
}
@@ -1597,6 +1621,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
this.lungeForwardMaybe();
+ if (target instanceof net.minecraft.server.level.ServerPlayer) this.ticksSinceLastInteraction = 0; // Purpur - Entity lifespan
return flag;
}

View File

@@ -1,49 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/npc/CatSpawner.java b/net/minecraft/world/entity/npc/CatSpawner.java
index 5401976c4fa86e2db6622743c8e8ea7381f72878..278a4000d06690a41e58a059d54e0044944a51fe 100644
--- a/net/minecraft/world/entity/npc/CatSpawner.java
+++ b/net/minecraft/world/entity/npc/CatSpawner.java
@@ -23,7 +23,7 @@ public class CatSpawner implements CustomSpawner {
public void tick(ServerLevel level, boolean spawnEnemies) {
this.nextTick--;
if (this.nextTick <= 0) {
- this.nextTick = 1200;
+ this.nextTick = level.purpurConfig.catSpawnDelay; // Purpur - Cat spawning options
Player randomPlayer = level.getRandomPlayer();
if (randomPlayer != null) {
RandomSource randomSource = level.random;
@@ -45,9 +45,12 @@ public class CatSpawner implements CustomSpawner {
}
private void spawnInVillage(ServerLevel level, BlockPos pos) {
- int i = 48;
- if (level.getPoiManager().getCountInRange(holder -> holder.is(PoiTypes.HOME), pos, 48, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
- List<Cat> entitiesOfClass = level.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(48.0, 8.0, 48.0));
+ // Purpur start - Cat spawning options
+ int range = level.purpurConfig.catSpawnVillageScanRange;
+ if (range <= 0) return;
+ if (level.getPoiManager().getCountInRange(holder -> holder.is(PoiTypes.HOME), pos, range, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
+ List<Cat> entitiesOfClass = level.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
+ // Purpur end - Cat spawning options
if (entitiesOfClass.size() < 5) {
this.spawnCat(pos, level, false);
}
@@ -55,8 +58,11 @@ public class CatSpawner implements CustomSpawner {
}
private void spawnInHut(ServerLevel level, BlockPos pos) {
- int i = 16;
- List<Cat> entitiesOfClass = level.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(16.0, 8.0, 16.0));
+ // Purpur start - Cat spawning options
+ int range = level.purpurConfig.catSpawnSwampHutScanRange;
+ if (range <= 0) return;
+ List<Cat> entitiesOfClass = level.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
+ // Purpur end - Cat spawning options
if (entitiesOfClass.isEmpty()) {
this.spawnCat(pos, level, true);
}

View File

@@ -1,44 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java b/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
index 3eb6ee2ffecbdeb6057d81b7936b80e205db7cdc..aceeb9919473f5ff1b84efe950d10aa4dbc10121 100644
--- a/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
+++ b/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
@@ -61,6 +61,13 @@ public class WanderingTrader extends AbstractVillager implements Consumable.Over
super(type, level);
}
+ // Purpur start - Allow leashing villagers
+ @Override
+ public boolean canBeLeashed() {
+ return level().purpurConfig.wanderingTraderCanBeLeashed;
+ }
+ // Purpur end - Allow leashing villagers
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
@@ -81,7 +88,7 @@ public class WanderingTrader extends AbstractVillager implements Consumable.Over
this,
new ItemStack(Items.MILK_BUCKET),
SoundEvents.WANDERING_TRADER_REAPPEARED,
- wanderingTrader -> this.canDrinkMilk && this.level().isBrightOutside() && wanderingTrader.isInvisible() // Paper - Add more WanderingTrader API
+ wanderingTrader -> level().purpurConfig.milkClearsBeneficialEffects && this.canDrinkMilk && this.level().isBrightOutside() && wanderingTrader.isInvisible() // Paper - Add more WanderingTrader API // // Purpur - Milk Keeps Beneficial Effects
)
);
this.goalSelector.addGoal(1, new TradeWithPlayerGoal(this));
@@ -124,8 +131,10 @@ public class WanderingTrader extends AbstractVillager implements Consumable.Over
return InteractionResult.CONSUME;
}
+ if (this.level().purpurConfig.wanderingTraderAllowTrading) { // Purpur - Add config for villager trading
this.setTradingPlayer(player);
this.openTradingScreen(player, this.getDisplayName(), 1);
+ } // Purpur - Add config for villager trading
}
return InteractionResult.SUCCESS;

View File

@@ -1,119 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index e5540b85cfa159d102a5710b4ccea5c3b61b7f1d..616c1aafcda05ae1d2a833f2f725b9eefb52cbc6 100644
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -179,11 +179,20 @@ public abstract class Player extends Avatar implements ContainerUser {
private int currentImpulseContextResetGraceTime = 0;
public boolean affectsSpawning = true; // Paper - Affects Spawning API
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
// CraftBukkit start
public boolean fauxSleeping;
public int oldLevel = -1;
+ // Purpur start - AFK API
+ public abstract void setAfk(boolean afk);
+
+ public boolean isAfk() {
+ return false;
+ }
+ // Purpur end - AFK API
@Override
public org.bukkit.craftbukkit.entity.CraftHumanEntity getBukkitEntity() {
return (org.bukkit.craftbukkit.entity.CraftHumanEntity) super.getBukkitEntity();
@@ -245,6 +254,12 @@ public abstract class Player extends Avatar implements ContainerUser {
@Override
public void tick() {
+ // Purpur start - Burp delay
+ if (this.burpDelay > 0 && --this.burpDelay == 0) {
+ this.level().playSound(null, getX(), getY(), getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 1.0F, this.level().random.nextFloat() * 0.1F + 0.9F);
+ }
+ // Purpur end - Burp delay
+
this.noPhysics = this.isSpectator();
if (this.isSpectator() || this.isPassenger()) {
this.setOnGround(false);
@@ -302,6 +317,17 @@ public abstract class Player extends Avatar implements ContainerUser {
this.turtleHelmetTick();
}
+ // Purpur start - Full netherite armor grants fire resistance
+ if (this.level().purpurConfig.playerNetheriteFireResistanceDuration > 0 && this.level().getGameTime() % 20 == 0) {
+ if (this.getItemBySlot(EquipmentSlot.HEAD).is(Items.NETHERITE_HELMET)
+ && this.getItemBySlot(EquipmentSlot.CHEST).is(Items.NETHERITE_CHESTPLATE)
+ && this.getItemBySlot(EquipmentSlot.LEGS).is(Items.NETHERITE_LEGGINGS)
+ && this.getItemBySlot(EquipmentSlot.FEET).is(Items.NETHERITE_BOOTS)) {
+ this.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, this.level().purpurConfig.playerNetheriteFireResistanceDuration, this.level().purpurConfig.playerNetheriteFireResistanceAmplifier, this.level().purpurConfig.playerNetheriteFireResistanceAmbient, this.level().purpurConfig.playerNetheriteFireResistanceShowParticles, this.level().purpurConfig.playerNetheriteFireResistanceShowIcon), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.NETHERITE_ARMOR);
+ }
+ }
+ // Purpur end - Full netherite armor grants fire resistance
+
this.cooldowns.tick();
this.updatePlayerPose();
if (this.currentImpulseContextResetGraceTime > 0) {
@@ -510,7 +536,7 @@ public abstract class Player extends Avatar implements ContainerUser {
List<Entity> list = Lists.newArrayList();
for (Entity entity : entities) {
- if (entity.getType() == EntityType.EXPERIENCE_ORB) {
+ if (entity.getType() == EntityType.EXPERIENCE_ORB && entity.level().purpurConfig.playerExpPickupDelay >= 0) { // Purpur - Configurable player pickup exp delay
list.add(entity);
} else if (!entity.isRemoved()) {
this.touch(entity);
@@ -1052,7 +1078,7 @@ public abstract class Player extends Avatar implements ContainerUser {
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
if (flag2) {
damageSource = damageSource.critical(); // Paper - critical damage API
- f *= 1.5F;
+ f *= (float) this.level().purpurConfig.playerCriticalDamageMultiplier; // Purpur - Add config change multiplier critical damage value
}
float f2 = f + f1;
@@ -1764,7 +1790,23 @@ public abstract class Player extends Avatar implements ContainerUser {
@Override
protected int getBaseExperienceReward(ServerLevel level) {
- return !level.getGameRules().get(GameRules.KEEP_INVENTORY) && !this.isSpectator() ? Math.min(this.experienceLevel * 7, 100) : 0;
+ // Purpur start - Add player death exp control options
+ if (!level.getGameRules().get(GameRules.KEEP_INVENTORY) && !this.isSpectator()) {
+ int toDrop;
+ try {
+ toDrop = Math.round(((Number) scriptEngine.eval("let expLevel = " + experienceLevel + "; " +
+ "let expTotal = " + totalExperience + "; " +
+ "let exp = " + experienceProgress + "; " +
+ level().purpurConfig.playerDeathExpDropEquation)).floatValue());
+ } catch (javax.script.ScriptException e) {
+ e.printStackTrace();
+ toDrop = experienceLevel * 7;
+ }
+ return Math.min(toDrop, level().purpurConfig.playerDeathExpDropMax);
+ } else {
+ return 0;
+ }
+ // Purpur end - Add player death exp control options
}
@Override
@@ -1808,6 +1850,13 @@ public abstract class Player extends Avatar implements ContainerUser {
return this.inventory.add(stack);
}
+ // Purpur start - Player ridable in water option
+ @Override
+ public boolean dismountsUnderwater() {
+ return !level().purpurConfig.playerRidableInWater;
+ }
+ // Purpur end - Player ridable in water option
+
public abstract @Nullable GameType gameMode();
@Override

View File

@@ -1,19 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/projectile/arrow/ThrownTrident.java b/net/minecraft/world/entity/projectile/arrow/ThrownTrident.java
index 483b8247d3be5839f9d764912ae5b879a9f729aa..fc29a8c27ce02ce81e3799fc999aba70b9800c10 100644
--- a/net/minecraft/world/entity/projectile/arrow/ThrownTrident.java
+++ b/net/minecraft/world/entity/projectile/arrow/ThrownTrident.java
@@ -72,7 +72,7 @@ public class ThrownTrident extends AbstractArrow {
Entity owner = this.getOwner();
int i = this.entityData.get(ID_LOYALTY);
- if (i > 0 && (this.dealtDamage || this.isNoPhysics()) && owner != null) {
+ if (i > 0 && (this.dealtDamage || this.isNoPhysics() || (level().purpurConfig.tridentLoyaltyVoidReturnHeight < 0.0D && getY() < level().purpurConfig.tridentLoyaltyVoidReturnHeight)) && owner != null) { // Purpur - Add option to allow loyalty on tridents to work in the void
if (!this.isAcceptibleReturnOwner()) {
if (this.level() instanceof ServerLevel serverLevel && this.pickup == AbstractArrow.Pickup.ALLOWED) {
this.spawnAtLocation(serverLevel, this.getPickupItem(), 0.1F);

View File

@@ -1,52 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java
index 89a061cd0a2b39fc05ea96ac0f5d5a8c26582f97..3dfe7eef12d40d986d2eb3f750b09b47ee04aecc 100644
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java
@@ -53,10 +53,40 @@ public class Snowball extends ThrowableItemProjectile {
protected void onHitEntity(EntityHitResult result) {
super.onHitEntity(result);
Entity entity = result.getEntity();
- int i = entity instanceof Blaze ? 3 : 0;
+ int i = entity.level().purpurConfig.snowballDamage >= 0 ? entity.level().purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur - Add configurable snowball damage
entity.hurt(this.damageSources().thrown(this, this.getOwner()), i);
}
+ // Purpur start - options to extinguish fire blocks with snowballs - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire
+ @Override
+ protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) {
+ super.onHitBlock(blockHitResult);
+
+ if (!this.level().isClientSide()) {
+ net.minecraft.core.BlockPos pos = blockHitResult.getBlockPos();
+ net.minecraft.core.BlockPos relativePos = pos.relative(blockHitResult.getDirection());
+
+ net.minecraft.world.level.block.state.BlockState blockState = this.level().getBlockState(pos);
+
+ if (this.level().purpurConfig.snowballExtinguishesFire && this.level().getBlockState(relativePos).is(net.minecraft.world.level.block.Blocks.FIRE)) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, relativePos, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
+ this.level().removeBlock(relativePos, false);
+ }
+ } else if (this.level().purpurConfig.snowballExtinguishesCandles && net.minecraft.world.level.block.AbstractCandleBlock.isLit(blockState)) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, pos, blockState.setValue(net.minecraft.world.level.block.AbstractCandleBlock.LIT, false))) {
+ net.minecraft.world.level.block.AbstractCandleBlock.extinguish(null, blockState, this.level(), pos);
+ }
+ } else if (this.level().purpurConfig.snowballExtinguishesCampfires && net.minecraft.world.level.block.CampfireBlock.isLitCampfire(blockState)) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, pos, blockState.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false))) {
+ this.level().levelEvent(null, 1009, pos, 0);
+ net.minecraft.world.level.block.CampfireBlock.dowse(this.getOwner(), this.level(), pos, blockState);
+ this.level().setBlockAndUpdate(pos, blockState.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false));
+ }
+ }
+ }
+ }
+ // Purpur end - options to extinguish fire blocks with snowballs
+
@Override
protected void onHit(HitResult result) {
super.onHit(result);

View File

@@ -1,31 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
index 66df6c69a95c5ca6b07294fdb3b13eee6651d22d..6ad07d8f82c0f745d3c3c742f25d05b9b38193c2 100644
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
@@ -112,9 +112,10 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
return;
}
// CraftBukkit end
- if (this.random.nextFloat() < 0.05F && serverLevel.isSpawningMonsters()) {
+ if (this.random.nextFloat() < serverLevel.purpurConfig.enderPearlEndermiteChance && serverLevel.isSpawningMonsters()) { // Purpur - Configurable Ender Pearl RNG
Endermite endermite = EntityType.ENDERMITE.create(serverLevel, EntitySpawnReason.TRIGGERED);
if (endermite != null) {
+ endermite.setPlayerSpawned(true); // Purpur - Add back player spawned endermite API
endermite.snapTo(preTeleportX, preTeleportY, preTeleportZ, preTeleportYRot, preTeleportXRot); // Paper - spawn endermite at pre teleport position as teleport has been moved up
serverLevel.addFreshEntity(endermite, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.ENDER_PEARL); // Paper - add reason
}
@@ -134,7 +135,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
if (serverPlayer1 != null) {
serverPlayer1.resetFallDistance();
serverPlayer1.resetCurrentImpulseContext();
- serverPlayer1.hurtServer(serverPlayer.level(), this.damageSources().enderPearl().eventEntityDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
+ serverPlayer1.hurtServer(serverPlayer.level(), this.damageSources().enderPearl().eventEntityDamager(this), this.level().purpurConfig.enderPearlDamage); // CraftBukkit // Paper - fix DamageSource API // Purpur - Configurable Ender Pearl damage
}
this.playSound(serverLevel, vec3);

View File

@@ -1,50 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/raid/Raids.java b/net/minecraft/world/entity/raid/Raids.java
index 9ded4e75da1efd2fb351fa1544dca33da8455d98..f96d8c241bc0aa44750da7231edbbc5abd802619 100644
--- a/net/minecraft/world/entity/raid/Raids.java
+++ b/net/minecraft/world/entity/raid/Raids.java
@@ -31,6 +31,7 @@ import org.jspecify.annotations.Nullable;
public class Raids extends SavedData {
private static final String RAID_FILE_ID = "raids";
+ public final java.util.Map<java.util.UUID, Integer> playerCooldowns = com.google.common.collect.Maps.newHashMap(); // Purpur - Raid cooldown setting
public static final Codec<Raids> CODEC = RecordCodecBuilder.create(
instance -> instance.group(
Raids.RaidWithId.CODEC
@@ -82,6 +83,17 @@ public class Raids extends SavedData {
public void tick(ServerLevel level) {
this.tick++;
+ // Purpur start - Raid cooldown setting
+ if (level.purpurConfig.raidCooldownSeconds != 0 && this.tick % 20 == 0) {
+ com.google.common.collect.ImmutableMap.copyOf(playerCooldowns).forEach((uuid, i) -> {
+ if (i < 1) {
+ playerCooldowns.remove(uuid);
+ } else {
+ playerCooldowns.put(uuid, i - 1);
+ }
+ });
+ }
+ // Purpur end - Raid cooldown setting
Iterator<Raid> iterator = this.raidMap.values().iterator();
while (iterator.hasNext()) {
@@ -144,11 +156,11 @@ public class Raids extends SavedData {
// }
if (!raid.isStarted() || (raid.isInProgress() && raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel())) { // CraftBukkit - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished
- // CraftBukkit start
+ if (serverLevel.purpurConfig.raidCooldownSeconds != 0 && playerCooldowns.containsKey(player.getUUID())) return null; // Purpur - Raid cooldown setting// CraftBukkit start
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(serverLevel, raid, player)) {
player.removeEffect(net.minecraft.world.effect.MobEffects.RAID_OMEN);
return null;
- }
+ }if (serverLevel.purpurConfig.raidCooldownSeconds != 0) playerCooldowns.put(player.getUUID(), serverLevel.purpurConfig.raidCooldownSeconds); // Purpur - Raid cooldown setting
if (!raid.isStarted() && !this.raidMap.containsValue(raid)) {
this.raidMap.put(this.getUniqueId(), raid);

View File

@@ -1,18 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
index 6b337848d91cc4f24655d053bc69b0cd22447dda..d17269c9274bd29c761403138bfc56355c800d9c 100644
--- a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
+++ b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
@@ -431,6 +431,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {
float groundFriction = this.getGroundFriction();
if (groundFriction > 0.0F) {
this.landFriction = groundFriction;
+ if (level().purpurConfig.boatEjectPlayersOnLand) ejectPassengers(); // Purpur - Add option for boats to eject players on land
return AbstractBoat.Status.ON_LAND;
} else {
return AbstractBoat.Status.IN_AIR;

View File

@@ -1,19 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java b/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java
index 7cc494d53c9a6d2fa0d34a60da50a9d199d65340..84b11654411eaa561a9b58ffa1210ca3d3b5a7cd 100644
--- a/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java
+++ b/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java
@@ -391,7 +391,7 @@ public class NewMinecartBehavior extends MinecartBehavior {
private Vec3 calculateBoostTrackSpeed(Vec3 speed, BlockPos pos, BlockState state) {
if (state.is(Blocks.POWERED_RAIL) && state.getValue(PoweredRailBlock.POWERED)) {
if (speed.length() > 0.01) {
- return speed.normalize().scale(speed.length() + 0.06);
+ return speed.normalize().scale(speed.length() + this.level().purpurConfig.poweredRailBoostModifier); // Purpur - Configurable powered rail boost modifier
} else {
Vec3 redstoneDirection = this.minecart.getRedstoneDirection(pos);
return redstoneDirection.lengthSqr() <= 0.0 ? speed : redstoneDirection.scale(speed.length() + 0.2);

View File

@@ -1,21 +0,0 @@
From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 05:37:42 -0800
Subject: [PATCH] purpur File Patches
diff --git a/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java b/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java
index 780b53eab14a087436e5f27c8d646042f4b357c9..7ab2542ddd7494585f240657906ccee80cd7944e 100644
--- a/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java
+++ b/net/minecraft/world/entity/vehicle/minecart/OldMinecartBehavior.java
@@ -243,8 +243,8 @@ public class OldMinecartBehavior extends MinecartBehavior {
Vec3 deltaMovement1 = this.getDeltaMovement();
double d13 = deltaMovement1.horizontalDistance();
if (d13 > 0.01) {
- double d14 = 0.06;
- this.setDeltaMovement(deltaMovement1.add(deltaMovement1.x / d13 * 0.06, 0.0, deltaMovement1.z / d13 * 0.06));
+ double d14 = level.purpurConfig.poweredRailBoostModifier; // Purpur - Configurable powered rail boost modifier
+ this.setDeltaMovement(deltaMovement1.add(deltaMovement1.x / d13 * level.purpurConfig.poweredRailBoostModifier, 0.0, deltaMovement1.z / d13 * level.purpurConfig.poweredRailBoostModifier)); // Purpur - Configurable powered rail boost modifier
} else {
Vec3 deltaMovement2 = this.getDeltaMovement();
double d15 = deltaMovement2.x;