mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-21 07:49:29 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@4eda045 Backport fix for MC-296337 (Fixes #12617) (#12619) PaperMC/Paper@7ebc94c Add Registry#getTagValues (#12603) PaperMC/Paper@e87320d Fix UOE when using generateTree with pale oak (#12616) PaperMC/Paper@94f2903 Do not blow up accessing unregistered memories from API (Fixes #12618) (#12639) PaperMC/Paper@03efecf Do not fire PlayerDropItemEvent for /give command PaperMC/Paper@3527ccd feat: expose updateDemand and restock on Villager (#12608) PaperMC/Paper@320f25c fix sponge-absorb deleting chest content (#12647) PaperMC/Paper@95565e0 Add missing attribute serialization updater PaperMC/Paper@519e422 Fix infinite loop in RegionFile IO PaperMC/Paper@ba7fb23 Finish moving over to Holderable (#12646) PaperMC/Paper@39203a6 [ci skip] Publish PR API and dev bundles (#12672) PaperMC/Paper@a1b3058 Provide env environment variable and copy spigots sys prop for overriding default repository
67 lines
4.5 KiB
Diff
67 lines
4.5 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 194db5ff2a473b10fded4491c1173d420f46424d..c09658eb8c2824ac0c887f94771d9b467ecab8b1 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 {
|
|
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 162062200a4ffa7bc669093779377f0d8d83172e..d61ac5aae3deb9bd145787351fb85051d4ff1aed 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -531,6 +531,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
|