mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-22 16:39:22 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@5e2a3bc0 Call EntityChangeBlockEvent with correct block when waxing (#12154) PaperMC/Paper@ab984a07 Always pass event block to damage source (#12158) PaperMC/Paper@7b4d44f5 Revert "Always pass event block to damage source (#12158)" PaperMC/Paper@e5a8ee84 Hide soul speed particles for vanished players (#12152) PaperMC/Paper@fcb2e815 Clear lastSection on game event listener removal PaperMC/Paper@636ae0cd Add missing Paper comments to player movement patch PaperMC/Paper@9be4e07a Pin snapshot dependencies (#12185) PaperMC/Paper@f12d33f0 Track codec writing PaperMC/Paper@1d9b3994 Add config option for failed beehive release cooldowns (#12186) PaperMC/Paper@5f2ee83e Fix first execution of async delayed/repeating tasks being sync (#12166) PaperMC/Paper@b00875f8 Add a method on Registry to get the size (#12182) PaperMC/Paper@ca261090 Don't process empty rcon commands (#12188) PaperMC/Paper@a501c459 Deprecate server config getters (#12189) PaperMC/Paper@7f3d3591 Use MiniMessage#deserialize(String, Pointered) in sendRichMessage for send messages (#12177) PaperMC/Paper@9b9f046f Remove broken code (#12171) PaperMC/Paper@fc56c728 Add methods for Creaking (#12094) PaperMC/Paper@f63dbeaf Fix cancelled HangingPlaceEvent inventory desync (#12161) PaperMC/Paper@9421f223 Make CustomArgumentType use parse(reader,source) (#12191) PaperMC/Paper@0a6e7435 Fix invulnerability damage and armour (#12190) Gale Changes: Dreeam-qwq/Gale@b2c11564 Updated Upstream (Paper) Dreeam-qwq/Gale@a9e4baae Updated Upstream (Paper) Dreeam-qwq/Gale@32a291bc [ci/skip] Update comment Purpur Changes: PurpurMC/Purpur@62cbd47a Updated Upstream (Paper) PurpurMC/Purpur@d41aaca1 Updated Upstream (Paper) PurpurMC/Purpur@3f8e6134 Fix EntityTameEvent not being called when `always-tame-in-creative` option is enabled (#1645) PurpurMC/Purpur@b34d675f fix `zombie_horse.spawn-chance` option not working
95 lines
5.4 KiB
Diff
95 lines
5.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
|
Date: Wed, 27 Nov 2024 23:13:12 -0500
|
|
Subject: [PATCH] Only player pushable
|
|
|
|
Useful for extreme cases like massive entities collide together in a small area
|
|
|
|
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
|
index 00233a7066d751821566b43993e8c45e7dad95d0..03c9edad5c2f5e902b7a766c6d0be61bf3c263ae 100644
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3631,7 +3631,7 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf
|
|
this.checkAutoSpinAttack(boundingBox, this.getBoundingBox());
|
|
}
|
|
|
|
- this.pushEntities();
|
|
+ if (!org.dreeam.leaf.config.modules.gameplay.OnlyPlayerPushable.enabled) this.pushEntities(); // Leaf - Only player pushable
|
|
// Paper start - Add EntityMoveEvent
|
|
// Purpur start - Ridables
|
|
if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
|
|
@@ -3769,7 +3769,14 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf
|
|
return;
|
|
}
|
|
// Paper end - don't run getEntities if we're not going to use its result
|
|
- List<Entity> entities = this.level().getEntities(this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - Climbing should not bypass cramming gamerule
|
|
+ // Leaf start - Only player pushable
|
|
+ final AABB box = this.getBoundingBox();
|
|
+ final Predicate<Entity> conditions = EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule);
|
|
+
|
|
+ List<Entity> entities = org.dreeam.leaf.config.modules.gameplay.OnlyPlayerPushable.enabled
|
|
+ ? getNearbyPushablePlayers(this, box, conditions)
|
|
+ : this.level().getEntities(this, box, conditions); // Paper - Climbing should not bypass cramming gamerule
|
|
+ // Leaf end - Only player pushable
|
|
if (!entities.isEmpty()) {
|
|
// Paper - don't run getEntities if we're not going to use its result; moved up
|
|
if (_int > 0 && entities.size() > _int - 1 && this.random.nextInt(4) == 0) {
|
|
@@ -3802,6 +3809,44 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf
|
|
}
|
|
}
|
|
|
|
+ // Leaf start - Only player pushable
|
|
+ public List<Entity> getNearbyPushablePlayers(Entity entity, AABB box, Predicate<Entity> conditions) {
|
|
+ final Vec3 vec = entity.position;
|
|
+ final net.minecraft.core.BlockPos.MutableBlockPos mutablePos = new net.minecraft.core.BlockPos.MutableBlockPos();
|
|
+
|
|
+ mutablePos.set(vec.x, vec.y, vec.z);
|
|
+
|
|
+ final ca.spottedleaf.moonrise.common.list.ReferenceList<ServerPlayer> players = ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel) this.level()).moonrise$getNearbyPlayers().getPlayers(
|
|
+ mutablePos, ca.spottedleaf.moonrise.common.misc.NearbyPlayers.NearbyMapType.SPAWN_RANGE
|
|
+ );
|
|
+
|
|
+ if (players == null) {
|
|
+ return new ArrayList<>();
|
|
+ }
|
|
+
|
|
+ List<Entity> ret = null;
|
|
+
|
|
+ final ServerPlayer[] raw = players.getRawDataUnchecked();
|
|
+ final int len = players.size();
|
|
+
|
|
+ java.util.Objects.checkFromIndexSize(0, len, raw.length);
|
|
+
|
|
+ for (int i = 0; i < len; ++i) {
|
|
+ final ServerPlayer player = raw[i];
|
|
+ if (player != entity && box.intersects(player.getBoundingBox()) && conditions.test(player)) {
|
|
+ if (ret == null) {
|
|
+ ret = new ArrayList<>(len - i);
|
|
+ ret.add(player);
|
|
+ } else {
|
|
+ ret.add(player);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return ret == null ? new ArrayList<>() : ret;
|
|
+ }
|
|
+ // Leaf end - Only player pushable
|
|
+
|
|
protected void checkAutoSpinAttack(AABB boundingBoxBeforeSpin, AABB boundingBoxAfterSpin) {
|
|
AABB aabb = boundingBoxBeforeSpin.minmax(boundingBoxAfterSpin);
|
|
List<Entity> entities = this.level().getEntities(this, aabb);
|
|
diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
index 21153f37c169e987d7876d1b914105223ac10ee7..a8bd9f027b5ce360b9e720a7734451bcf9f701d4 100644
|
|
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
@@ -326,7 +326,7 @@ public class ArmorStand extends LivingEntity implements net.caffeinemc.mods.lith
|
|
|
|
@Override
|
|
protected void pushEntities() {
|
|
- if (!this.level().paperConfig().entities.armorStands.doCollisionEntityLookups) return; // Paper - Option to prevent armor stands from doing entity lookups
|
|
+ if (org.dreeam.leaf.config.modules.gameplay.OnlyPlayerPushable.enabled || !this.level().paperConfig().entities.armorStands.doCollisionEntityLookups) return; // Paper - Option to prevent armor stands from doing entity lookups // Leaf - Only player pushable
|
|
for (Entity entity : this.level().getEntitiesOfClass(AbstractMinecart.class, this.getBoundingBox(), RIDABLE_MINECARTS)) { // Paper - optimise collisions
|
|
if (this.distanceToSqr(entity) <= 0.2) {
|
|
entity.push(this);
|