mirror of
https://github.com/Samsuik/Sakura.git
synced 2026-01-06 15:41:49 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@6cfa2f7 [ci skip] Add missing nullability annotation to sendEquipmentChange method (#12112) PaperMC/Paper@9b9de82 Update Alternate Current patch to v1.9.1 (#12115) PaperMC/Paper@c62252e Add lore content guard (#12116) PaperMC/Paper@4041678 [ci-skip] Mention missing World#regenerateChunk implementation in jd (#12109) PaperMC/Paper@a6e82d9 [ci skip] Clarify getChunkAtAsyncUrgently javadocs (#12125) PaperMC/Paper@cb25c0c [ci skip] Fix annotation fields used in NMS getBukkitEntity (#12120) PaperMC/Paper@0070126 [ci skip] improvement example in javadoc for DatapackRegistrar (#12122) PaperMC/Paper@608f004 add method on ItemStack to edit pdc (#12022) PaperMC/Paper@7bee997 Cleanup damage source a bit (#12106) PaperMC/Paper@b9023b5 Add EntityAttemptSmashAttackEvent (#12113) PaperMC/Paper@a3781ff Separate tick count to ensure vanilla parity (#12077) PaperMC/Paper@2a4a115 Add EntityEquipmentChangedEvent (#12011) PaperMC/Paper@06f96dd Improvement in /plugins command (#12121) PaperMC/Paper@28d07dc use correct spigot plugin count PaperMC/Paper@60394c5 Fix PlayerReadyArrowEvent cancellation desync (#12111) PaperMC/Paper@b27e11c Fix bad world to chunk coordinate example in javadocs (#12131) PaperMC/Paper@88cdd22 Fixup luck and random implementation in CB loot-tables (#11926) PaperMC/Paper@84609dc Don't auto-create any brig redirects (#11954) PaperMC/Paper@8eb8e44 Allow For Default Titles in InventoryView Builders (#12013)
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 c74e20f1b20076e2eb289246f63d8363de2bc5e8..9a71820b766edd0b4d366735d96ae1241dba2047 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -538,6 +538,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
|