mirror of
https://github.com/Samsuik/Sakura.git
synced 2026-01-03 22:16:38 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@5a362b8 Use ConcurrentUtil from Paper repo PaperMC/Paper@ef0670c Update paperweight and Gradle wrapper PaperMC/Paper@e5bf173 Always fork jvm for compile, even when using the Gradle runtime jvm PaperMC/Paper@cbd578c Fix api build script deprecation PaperMC/Paper@7e601ad Implement new CustomModelData PaperMC/Paper@3b35456 Implement assetid PaperMC/Paper@d0645d9 Update readme, set updatingMinecraft to false PaperMC/Paper@747cac4 Updated Upstream (CraftBukkit) PaperMC/Paper@416a733 Apply coordinate offset only to VoxelShape PaperMC/Paper@1cc86be Update setup-gradle action PaperMC/Paper@b0d7153 fix item meta PaperMC/Paper@2206b9a fix components PaperMC/Paper@e73d396 fix asset id PaperMC/Paper@2a4ba00 add missing effect cause, for bee being poisoned PaperMC/Paper@4806ce5 properly override push/knockback methods PaperMC/Paper@bb4fb53 call EntityInsideBlockEvent for eyeblossom PaperMC/Paper@ae060b3 Finish PlayerPickItemEvent PaperMC/Paper@c54c062 Port exact choice improvements (#11705) PaperMC/Paper@e4e24f3 Move around patches again PaperMC/Paper@4c39ea2 More moving around of hunks PaperMC/Paper@77afb9a Add new bundle animation (#11708) PaperMC/Paper@346b9b8 Fixup PlayerPickItemEvent docs more
67 lines
4.8 KiB
Diff
67 lines
4.8 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 079aa846fa9b5650675ae855ba0bb61ca42a6b52..7953ddb67530396c35b42496594a80e1b3f1b349 100644
|
|
--- a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
|
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
|
@@ -1908,6 +1908,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 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 fullBlocks = (collisionFlags & COLLISION_FLAG_FULL_BLOCKS) != 0; // Sakura - treat solid blocks as full when moving fast
|
|
final ChunkSource chunkSource = world.getChunkSource();
|
|
|
|
for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
|
|
@@ -1999,7 +2001,7 @@ public final class CollisionUtil {
|
|
continue;
|
|
}
|
|
|
|
- final boolean hasSpecial = ((BlockCountingChunkSection)section).moonrise$hasSpecialCollidingBlocks();
|
|
+ final boolean hasSpecial = !fullBlocks && ((BlockCountingChunkSection)section).moonrise$hasSpecialCollidingBlocks(); // Sakura - treat solid blocks as full when moving fast
|
|
final int sectionAdjust = !hasSpecial ? 1 : 0;
|
|
|
|
final PalettedContainer<BlockState> blocks = section.states;
|
|
@@ -2038,6 +2040,11 @@ public final class CollisionUtil {
|
|
if (useEntityCollisionShape) {
|
|
mutablePos.set(blockX, blockY, blockZ);
|
|
blockCollision = collisionShape.getCollisionShape(blockData, world, mutablePos);
|
|
+ // 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
|
|
+ } else if (fullBlocks && blockData.moonrise$getConstantContextCollisionShape() != null) {
|
|
+ blockCollision = net.minecraft.world.phys.shapes.Shapes.block();
|
|
+ // Sakura end - treat solid blocks as full when moving fast
|
|
} else if (blockCollision == null) {
|
|
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 6ab4c1db02846123e72a805a2e8070c398d726e3..21ef61cc82df99aae6be1e6c3f603058cbeb548f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -583,6 +583,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
|