mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-30 12:19:08 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@3af5e77 Add Player#give (#11995) PaperMC/Paper@7e21cb8 fix PlayerChangedMainHandEvent javadoc (#12020) PaperMC/Paper@5a34bf0 Correctly retrun true for empty input shapes in EntityGetter#isUnobstructed PaperMC/Paper@a392d47 Make Watchdog thread extend TickThread PaperMC/Paper@1004374 Add further information to thread check errors PaperMC/Paper@e2f0efd Remove nms.Entity#isChunkLoaded PaperMC/Paper@54b2e9d Add buffer to CraftWorld#warnUnsafeChunk PaperMC/Paper@d4a9578 Experimental annotation changes (#12028) PaperMC/Paper@5bcfb12 Fix activation range config and water animal status (#12047) PaperMC/Paper@e0711af Deprecate UnsafeValues#getSpawnEggLayerColor (#12041) PaperMC/Paper@8927091 Do not record movement for vehicles/players unaffected by blocks PaperMC/Paper@5395ae3 Fix composter block setting bukkit owner twice (#12058)
67 lines
4.6 KiB
Diff
67 lines
4.6 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 47c8ed946cb2ad81a4469daf60dabc40c5e8beda..16b66b19157081c7717f73ee3dc9111662a31922 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
|
+++ b/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 - 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 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) {
|
|
@@ -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 - collide with non-solid blocks
|
|
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 - 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) {
|
|
mutablePos.set(blockX, blockY, blockZ);
|
|
blockCollision = blockData.getCollisionShape(world, mutablePos, collisionShape);
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index c5b840f990f9f357d4b63f7e450e91c431fd2d03..e72c6eed0280aab425ae1dfa1d104a2d87651b63 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -537,6 +537,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
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)) {
|
|
+ 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
|