9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-30 12:19:08 +00:00
Files
SakuraMC/sakura-server/minecraft-patches/features/0019-Collide-with-non-solid-blocks.patch
Samsuik b45393fe53 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@81b7a57 Fixed Ender Dragon using wrong tracking range (#13046)
PaperMC/Paper@7b9a472 Fix inverted disabled in CraftCrafter#setSlotDisabled (#13195)
PaperMC/Paper@3799cbe Use Adventure properties default override provider to set a global flattener nesting limit (#13156)
PaperMC/Paper@ae1e6b7 Add PersistentDataContainerView#getSize (#13157)
PaperMC/Paper@dd8f9f8 Expose PlayerConnection#isConnected (#13166)
PaperMC/Paper@952a024 Fix some issues with PlayerLeashEntityEvent (#13015)
PaperMC/Paper@7845cba Fix help.yml index-topics not working for non-console senders (#13193)
PaperMC/Paper@1e67ca8 Add SpawnReason for REANIMATE a Copper Golem Statue (#13126)
PaperMC/Paper@e75678b Update Mache for Java 25 setup runtime support
PaperMC/Paper@bac3da1 Migrate external JD links from javadoc.io to javadocs.dev (#13205)
PaperMC/Paper@080a72f [ci skip] Add myself (roro1506HD) to MIT licensing (#13212)
PaperMC/Paper@d98142e Rework API teleportation to better align with Vanilla (#13181)
PaperMC/Paper@b278a92 Don't run player loot table for spectators (#11801)
PaperMC/Paper@b5b7c79 Promote build channel from ALPHA to BETA
PaperMC/Paper@2a1871b Use static ThreadLocal for light engine propagator
2025-10-26 16:57:26 +00:00

67 lines
4.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Sun, 26 Nov 2023 17:57:50 +0000
Subject: [PATCH] Collide with non-solid blocks
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
index 4c18fcd50c79e767bfea908ca6660b667f9d359b..5d95d8747c4816d27bab6455b3bdfb7b50ae265f 100644
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
@@ -1906,6 +1906,7 @@ public final class CollisionUtil {
public static final int COLLISION_FLAG_CHECK_ONLY = 1 << 3;
public static final int COLLISION_FLAG_ADD_TICKET = 1 << 4; // Sakura - load chunks on movement
public static final int COLLISION_FLAG_SKIP_EDGES = 1 << 5; // Sakura - configure server mechanics
+ public static final int COLLISION_FLAG_FULL_BLOCKS = 1 << 6; // Sakura - collide with non-solid blocks
public static boolean getCollisionsForBlocksOrWorldBorder(final Level world, final Entity entity, final AABB aabb,
final List<VoxelShape> intoVoxel, final List<AABB> intoAABB,
@@ -1960,6 +1961,7 @@ public final class CollisionUtil {
final boolean loadChunks = (collisionFlags & COLLISION_FLAG_LOAD_CHUNKS) != 0;
final boolean addTicket = (collisionFlags & COLLISION_FLAG_ADD_TICKET) != 0; // Sakura - load chunks on movement
final boolean skipEdges = (collisionFlags & COLLISION_FLAG_SKIP_EDGES) != 0; // Sakura - configure server mechanics
+ final boolean fullBlocks = (collisionFlags & COLLISION_FLAG_FULL_BLOCKS) != 0; // Sakura - collide with non-solid blocks
final ChunkSource chunkSource = world.getChunkSource();
for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
@@ -2002,7 +2004,7 @@ public final class CollisionUtil {
continue;
}
- final boolean hasSpecial = !skipEdges && ((BlockCountingChunkSection)section).moonrise$hasSpecialCollidingBlocks(); // Sakura - configure server mechanics
+ final boolean hasSpecial = !fullBlocks && !skipEdges && ((BlockCountingChunkSection)section).moonrise$hasSpecialCollidingBlocks(); // Sakura - configure server mechanics
final int sectionAdjust = !hasSpecial ? 1 : 0;
final PalettedContainer<BlockState> blocks = section.states;
@@ -2041,6 +2043,11 @@ public final class CollisionUtil {
mutablePos.set(blockX, blockY, blockZ);
if (useEntityCollisionShape) {
blockCollision = collisionShape.getCollisionShape(blockData, world, mutablePos);
+ // Sakura start - collide with non-solid blocks
+ // todo: move this logic above emptyCollisionShape and consider all blocks as a solid except scaffolding and liquids
+ } else if (fullBlocks && blockData.moonrise$getConstantContextCollisionShape() != null) {
+ blockCollision = net.minecraft.world.phys.shapes.Shapes.block();
+ // Sakura end - collide with non-solid blocks
} else if (blockCollision == null) {
blockCollision = blockData.getCollisionShape(world, mutablePos, collisionShape);
}
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 0446539327d5c1d1e58b19863dbe08b593e5727c..f44f835b6b7e42ea32e11bbeb9fe8bfe0363acdf 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -548,6 +548,14 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
flags |= ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_ADD_TICKET;
}
+ // Sakura start - collide with non-solid blocks
+ if (this.level().sakuraConfig().cannons.treatAllBlocksAsFullWhenMoving && (this.isPrimedTNT || this.isFallingBlock)) {
+ final double horizontalMovementSqr = this.getDeltaMovement().horizontalDistanceSqr();
+ if (horizontalMovementSqr > Math.pow(this.level().sakuraConfig().cannons.treatAllBlocksAsFullWhenMovingFasterThan, 2.0)) {
+ flags |= ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_FULL_BLOCKS;
+ }
+ }
+ // Sakura end - collide with non-solid blocks
return flags;
}
// Sakura end - load chunks on movement