9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-27 18:59:06 +00:00
Files
SakuraMC/patches/server/0044-Treat-solid-blocks-as-full-when-moving-fast.patch
Samsuik 8491db8c0a Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@9aea240 Properly lookup plugin classes when looked up by spark
PaperMC/Paper@7e91a2c Update the bundled spark version
PaperMC/Paper@3a47518 Deprecate more Timings things for removal (#11126)
PaperMC/Paper@aa36ae6 Fix EntityUnleashEvent cancellation on distance cause (#11131)
PaperMC/Paper@73a863b Fix horse inventories indices (#11139)
PaperMC/Paper@5512af7 [ci skip] remove timings from issue templates (#11127)
PaperMC/Paper@5a5035b Fix a couple of ItemMeta related NPEs (#11149)
PaperMC/Paper@e1462a9 Bump MCUtils#asyncExecutor core size
PaperMC/Paper@645a677 Make max interaction range configurable (#11164)
PaperMC/Paper@66165f7 Fix PickupStatus getting reset (#11154)
PaperMC/Paper@dcbd99d Fix Owen's typos (#11179)
PaperMC/Paper@f82bea6 Add argument for FinePosition to brig API (#11094)
PaperMC/Paper@694b120 Remove Entity tracker field
PaperMC/Paper@f774787 Copy missed changes to chunk system from Folia
PaperMC/Paper@50bdfc3 Null check tracker in Entity#resendPossiblyDesyncedEntityData
PaperMC/Paper@3234b20 Do not allow chunk unloading outside of the regular tick loop
PaperMC/Paper@0246a9d Add mob bucket items to item id to entity map in DataConverter
PaperMC/Paper@438863c Shutdown L4J cordially if the server stops before it's even started (#11172)
PaperMC/Paper@100d75a Don't entirely die just because a plugin jar was bad
PaperMC/Paper@227544c Move TickThread changes from Moonrise patch to MCUtils
PaperMC/Paper@67d414a Allow plugin aliases to override vanilla commands (#11186)
PaperMC/Paper@58c7ea3 Preserve command node when re-registering modern commands through old API (#11184)
PaperMC/Paper@0a1be9a Make loadChunksForMoveAsync use new chunk system load calls
PaperMC/Paper@df3b654 ConcurrentUtil: Fix concurrent long map resize chain pull function
PaperMC/Paper@5a5c3a4 Remove chunk unload trace debug
PaperMC/Paper@7e44684 Fix wrong assumption about locale being null in the login phase (#11204)
PaperMC/Paper@042f15f [ci skip] chore: fix incorrect commit hash in PR builds (#11198)
PaperMC/Paper@4e6a2a1 Check for block type in SculkSensorBlock#canActivate
2024-08-09 20:10:59 +01:00

69 lines
5.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
Date: Sun, 26 Nov 2023 17:57:50 +0000
Subject: [PATCH] Treat solid blocks as full when moving fast
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
index aa23d2665d5804e31b7c1b7021377010e74e4718..a93dc86f8c75e7021f42025d8f80c846598c2ca0 100644
--- a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
@@ -1597,6 +1597,7 @@ public final class CollisionUtil {
public static final int COLLISION_FLAG_CHECK_BORDER = 1 << 2;
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_FULL_BLOCKS = 1 << 5; // Sakura - treat solid blocks as full when moving fast
public static boolean getCollisionsForBlocksOrWorldBorder(final net.minecraft.world.level.Level world, final net.minecraft.world.entity.Entity entity, final net.minecraft.world.phys.AABB aabb,
final java.util.List<net.minecraft.world.phys.shapes.VoxelShape> intoVoxel, final java.util.List<net.minecraft.world.phys.AABB> intoAABB,
@@ -1648,6 +1649,7 @@ public final class CollisionUtil {
final boolean loadChunks = (collisionFlags & COLLISION_FLAG_LOAD_CHUNKS) != 0;
final boolean addTicket = (collisionFlags & COLLISION_FLAG_ADD_TICKET) != 0; // Sakura
+ final boolean fullBlocks = (collisionFlags & COLLISION_FLAG_FULL_BLOCKS) != 0; // Sakura - treat solid blocks as full when moving fast
final net.minecraft.world.level.chunk.ChunkSource chunkSource = world.getChunkSource();
for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
@@ -1688,7 +1690,7 @@ public final class CollisionUtil {
continue;
}
- final boolean hasSpecial = ((ca.spottedleaf.moonrise.patches.block_counting.BlockCountingChunkSection)section).moonrise$getSpecialCollidingBlocks() != 0;
+ final boolean hasSpecial = !fullBlocks && ((ca.spottedleaf.moonrise.patches.block_counting.BlockCountingChunkSection)section).moonrise$getSpecialCollidingBlocks() != 0; // Sakura - treat solid blocks as full when moving fast
final int sectionAdjust = !hasSpecial ? 1 : 0;
final net.minecraft.world.level.chunk.PalettedContainer<net.minecraft.world.level.block.state.BlockState> blocks = section.states;
@@ -1724,7 +1726,12 @@ public final class CollisionUtil {
net.minecraft.world.phys.shapes.VoxelShape blockCollision = ((ca.spottedleaf.moonrise.patches.collisions.block.CollisionBlockState)blockData).moonrise$getConstantCollisionShape();
if (edgeCount == 0 || ((edgeCount != 1 || blockData.hasLargeCollisionShape()) && (edgeCount != 2 || blockData.getBlock() == net.minecraft.world.level.block.Blocks.MOVING_PISTON))) {
- if (blockCollision == null) {
+ // Sakura start - treat solid blocks as full when moving fast
+ // todo: move this logic above emptyCollisionShape and consider all blocks as a solid except scaffolding and liquids
+ if (fullBlocks && blockData.moonrise$getConstantCollisionAABB() != null) {
+ blockCollision = net.minecraft.world.phys.shapes.Shapes.block();
+ } else if (blockCollision == null) {
+ // Sakura end - treat solid blocks as full when moving fast
mutablePos.set(blockX, blockY, blockZ);
blockCollision = blockData.getCollisionShape(world, mutablePos, collisionShape);
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 13f0184f5cf5687b3641d3e94625c0599ed2afb1..6d3e350635f978cadb56961121638e124a00a059 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -564,6 +564,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
flags |= ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_ADD_TICKET;
}
+ // Sakura start - treat solid blocks as full when moving fast
+ if (this.level().sakuraConfig().cannons.treatAllBlocksAsFullWhenMoving && (this.isPrimedTNT || this.isFallingBlock)) {
+ 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 - treat solid blocks as full when moving fast
return flags;
}
// Sakura end - load chunks on movement