mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-26 18:29:07 +00:00
Start work on reintroducing old spigot/paper bugs
This commit is contained in:
@@ -20,6 +20,7 @@ public final class MechanicVersion {
|
||||
public static final short v1_18_2 = MinecraftVersionEncoding.v1xy(18, 2);
|
||||
public static final short v1_19_3 = MinecraftVersionEncoding.v1xy(19, 3);
|
||||
public static final short v1_20 = MinecraftVersionEncoding.v1xy(20, 0);
|
||||
public static final short v1_20_2 = MinecraftVersionEncoding.v1xy(20, 2);
|
||||
public static final short v1_21_2 = MinecraftVersionEncoding.v1xy(21, 2);
|
||||
public static final short v1_21_5 = MinecraftVersionEncoding.v1xy(21, 5);
|
||||
public static final short v1_21_6 = MinecraftVersionEncoding.v1xy(21, 6);
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Configure cannon physics
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
index 5cc6fe6984d59a94c037b2c327a5d72b5a2a740d..432bc933c4e31dff9737748e8b81521bfc45530a 100644
|
||||
index 5cc6fe6984d59a94c037b2c327a5d72b5a2a740d..82689f3a737a80c1c3fd5c46aa271e70fc7b8866 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
@@ -1774,6 +1774,13 @@ public final class CollisionUtil {
|
||||
@@ -31,7 +31,7 @@ index 5cc6fe6984d59a94c037b2c327a5d72b5a2a740d..432bc933c4e31dff9737748e8b81521b
|
||||
|
||||
if (xSmaller && z != 0.0) {
|
||||
z = performAABBCollisionsZ(axisalignedbb, z, potentialCollisions);
|
||||
@@ -1811,9 +1818,18 @@ public final class CollisionUtil {
|
||||
@@ -1811,9 +1818,21 @@ public final class CollisionUtil {
|
||||
public static Vec3 performCollisions(final Vec3 moveVector, AABB axisalignedbb,
|
||||
final List<VoxelShape> voxels,
|
||||
final List<AABB> aabbs) {
|
||||
@@ -43,6 +43,9 @@ index 5cc6fe6984d59a94c037b2c327a5d72b5a2a740d..432bc933c4e31dff9737748e8b81521b
|
||||
+ final List<VoxelShape> voxels,
|
||||
+ final List<AABB> aabbs,
|
||||
+ final me.samsuik.sakura.mechanics.MinecraftMechanicsTarget mechanicsTarget) {
|
||||
+ if (mechanicsTarget.isServerType(me.samsuik.sakura.mechanics.ServerType.PAPER) && mechanicsTarget.between(me.samsuik.sakura.mechanics.MechanicVersion.v1_18_2, me.samsuik.sakura.mechanics.MechanicVersion.v1_20_2)) {
|
||||
+ me.samsuik.sakura.mechanics.EntityBehaviour.convertVoxelsIntoAABBs(moveVector, axisalignedbb, voxels, aabbs);
|
||||
+ }
|
||||
+ // Sakura end - configure server mechanics
|
||||
if (voxels.isEmpty()) {
|
||||
// fast track only AABBs
|
||||
@@ -51,7 +54,7 @@ index 5cc6fe6984d59a94c037b2c327a5d72b5a2a740d..432bc933c4e31dff9737748e8b81521b
|
||||
}
|
||||
|
||||
double x = moveVector.x;
|
||||
@@ -1828,7 +1844,7 @@ public final class CollisionUtil {
|
||||
@@ -1828,7 +1847,7 @@ public final class CollisionUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +63,25 @@ index 5cc6fe6984d59a94c037b2c327a5d72b5a2a740d..432bc933c4e31dff9737748e8b81521b
|
||||
|
||||
if (xSmaller && z != 0.0) {
|
||||
z = performAABBCollisionsZ(axisalignedbb, z, aabbs);
|
||||
diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index ca02c4c71a0a5a1a0ae8bbb40f0b1b7eac64e6fd..476b1330455cb30a582147bcf95d4f199ade3c6f 100644
|
||||
--- a/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -462,6 +462,14 @@ public interface DispenseItemBehavior {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Sakura start - configure server mechanics
|
||||
+ final me.samsuik.sakura.mechanics.MinecraftMechanicsTarget mechanicTarget = serverLevel.localConfig().at(blockPos).mechanicsTarget;
|
||||
+ if (!mechanicTarget.isServerType(me.samsuik.sakura.mechanics.ServerType.VANILLA)
|
||||
+ && mechanicTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_9)
|
||||
+ && !mechanicTarget.isLegacy()) {
|
||||
+ event.getVelocity().setY(event.getVelocity().getY() + 0.5);
|
||||
+ }
|
||||
+ // Sakura end - configure server mechanics
|
||||
PrimedTnt primedTnt = new PrimedTnt(serverLevel, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), null);
|
||||
// CraftBukkit end
|
||||
serverLevel.addFreshEntity(primedTnt);
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index eaa57560a20841a2b218ff2fd9059f82339a678c..098b5a8cfe1ce37f5c1ed51c2bb913990a820838 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
@@ -462,18 +484,28 @@ index 2146efa860d8323a88f3ad365c0cdb66de42154a..b6ddb1ad889a115daeba64321d38b236
|
||||
if (!visitor.visit(blockPos, 0)) {
|
||||
return false;
|
||||
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
|
||||
index e6ca200bf17e097f65204d7cead78306573e4782..5ac921b85f4dd200dd9932c7a702c07cfad36e63 100644
|
||||
index e6ca200bf17e097f65204d7cead78306573e4782..41a9da18ec229f9e489de2ac3af9d9e5f9b58963 100644
|
||||
--- a/net/minecraft/world/level/ServerExplosion.java
|
||||
+++ b/net/minecraft/world/level/ServerExplosion.java
|
||||
@@ -376,6 +376,7 @@ public class ServerExplosion implements Explosion {
|
||||
@@ -376,6 +376,17 @@ public class ServerExplosion implements Explosion {
|
||||
return this.damageCalculator.getBlockExplosionResistance(this, this.level, pos, blockState, fluidState);
|
||||
}
|
||||
// Sakura end - explosion durable blocks
|
||||
+ protected final me.samsuik.sakura.mechanics.MinecraftMechanicsTarget mechanicsTarget; // Sakura - configure server mechanics
|
||||
+ // Sakura start - configure server mechanics
|
||||
+ protected final me.samsuik.sakura.mechanics.MinecraftMechanicsTarget mechanicsTarget;
|
||||
+
|
||||
+ private float sakura$getSeenPercent(final Vec3 explosionPos, final Entity entity) {
|
||||
+ if (this.mechanicsTarget.atLeast(me.samsuik.sakura.mechanics.MechanicVersion.v1_16)) {
|
||||
+ return this.getSeenFraction(explosionPos, entity, this.directMappedBlockCache, this.mutablePos); // Paper - collision optimisations
|
||||
+ } else {
|
||||
+ return getSeenPercent(explosionPos, entity);
|
||||
+ }
|
||||
+ }
|
||||
+ // Sakura end - configure server mechanics
|
||||
|
||||
public ServerExplosion(
|
||||
ServerLevel level,
|
||||
@@ -400,6 +401,7 @@ public class ServerExplosion implements Explosion {
|
||||
@@ -400,6 +411,7 @@ public class ServerExplosion implements Explosion {
|
||||
this.yield = Double.isFinite(this.yield) ? this.yield : 0; // Paper - Don't allow infinite default yields
|
||||
// Paper end - add yield
|
||||
this.consistentExplosionRadius = level.localConfig().at(this.center).consistentExplosionRadius; // Sakura - consistent explosion radius
|
||||
@@ -481,7 +513,7 @@ index e6ca200bf17e097f65204d7cead78306573e4782..5ac921b85f4dd200dd9932c7a702c07c
|
||||
}
|
||||
|
||||
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
|
||||
@@ -429,8 +431,15 @@ public class ServerExplosion implements Explosion {
|
||||
@@ -429,8 +441,15 @@ public class ServerExplosion implements Explosion {
|
||||
final float density = entity.level().densityCache.getKnownDensity(vec3);
|
||||
if (density != me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
|
||||
hitResult = density != 0.0f ? net.minecraft.world.phys.HitResult.Type.MISS : net.minecraft.world.phys.HitResult.Type.BLOCK;
|
||||
@@ -498,7 +530,7 @@ index e6ca200bf17e097f65204d7cead78306573e4782..5ac921b85f4dd200dd9932c7a702c07c
|
||||
}
|
||||
if (hitResult == HitResult.Type.MISS) {
|
||||
// Sakura end - replace density cache
|
||||
@@ -528,6 +537,15 @@ public class ServerExplosion implements Explosion {
|
||||
@@ -528,6 +547,15 @@ public class ServerExplosion implements Explosion {
|
||||
}
|
||||
|
||||
if (cachedBlock.outOfWorld) {
|
||||
@@ -514,7 +546,7 @@ index e6ca200bf17e097f65204d7cead78306573e4782..5ac921b85f4dd200dd9932c7a702c07c
|
||||
break;
|
||||
}
|
||||
final BlockState iblockdata = cachedBlock.blockState;
|
||||
@@ -630,6 +648,12 @@ public class ServerExplosion implements Explosion {
|
||||
@@ -630,6 +658,12 @@ public class ServerExplosion implements Explosion {
|
||||
double d2 = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.center.y;
|
||||
double d3 = entity.getZ() - this.center.z;
|
||||
double squareRoot = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
@@ -527,32 +559,15 @@ index e6ca200bf17e097f65204d7cead78306573e4782..5ac921b85f4dd200dd9932c7a702c07c
|
||||
if (squareRoot != 0.0) {
|
||||
d1 /= squareRoot;
|
||||
d2 /= squareRoot;
|
||||
@@ -913,7 +937,7 @@ public class ServerExplosion implements Explosion {
|
||||
@@ -913,7 +947,7 @@ public class ServerExplosion implements Explosion {
|
||||
// Sakura start - replace density cache
|
||||
float blockDensity = this.level.densityCache.getBlockDensity(vec3d, entity);
|
||||
if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
|
||||
- blockDensity = this.getSeenFraction(vec3d, entity, this.directMappedBlockCache, this.mutablePos); // Paper - collision optimisations
|
||||
+ blockDensity = this.sakura_getSeenPercent(vec3d, entity); // Sakura - configure server mechanics
|
||||
+ blockDensity = this.sakura$getSeenPercent(vec3d, entity); // Sakura - configure server mechanics
|
||||
this.level.densityCache.putDensity(vec3d, entity, blockDensity);
|
||||
// Sakura end - replace density cache
|
||||
}
|
||||
@@ -921,6 +945,16 @@ public class ServerExplosion implements Explosion {
|
||||
return blockDensity;
|
||||
}
|
||||
|
||||
+ // Sakura start - configure server mechanics
|
||||
+ private float sakura_getSeenPercent(final Vec3 vec3d, final Entity entity) {
|
||||
+ if (this.mechanicsTarget.atLeast(me.samsuik.sakura.mechanics.MechanicVersion.v1_16)) {
|
||||
+ return this.getSeenFraction(vec3d, entity, this.directMappedBlockCache, this.mutablePos); // Paper - collision optimisations
|
||||
+ } else {
|
||||
+ return getSeenPercent(vec3d, entity);
|
||||
+ }
|
||||
+ }
|
||||
+ // Sakura end - configure server mechanics
|
||||
+
|
||||
static class CacheKey {
|
||||
private final Level world;
|
||||
private final double posX, posY, posZ;
|
||||
diff --git a/net/minecraft/world/level/block/FallingBlock.java b/net/minecraft/world/level/block/FallingBlock.java
|
||||
index 4fa238d1cd6b19f16c0d0a8a9a913e9e42debbed..96a02601636cdf7cf6e360fc933e5764fbb7eab8 100644
|
||||
--- a/net/minecraft/world/level/block/FallingBlock.java
|
||||
|
||||
@@ -5,10 +5,10 @@ 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 432bc933c4e31dff9737748e8b81521bfc45530a..2b3f37b2c4add7fe5c5e9500cd087517fa11600b 100644
|
||||
index 82689f3a737a80c1c3fd5c46aa271e70fc7b8866..0e16ec857c6f9005f6a56b2a79493ce4eeec59a6 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
@@ -1902,6 +1902,7 @@ public final class CollisionUtil {
|
||||
@@ -1905,6 +1905,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
|
||||
@@ -16,7 +16,7 @@ index 432bc933c4e31dff9737748e8b81521bfc45530a..2b3f37b2c4add7fe5c5e9500cd087517
|
||||
|
||||
public static boolean getCollisionsForBlocksOrWorldBorder(final Level world, final Entity entity, final AABB aabb,
|
||||
final List<VoxelShape> intoVoxel, final List<AABB> intoAABB,
|
||||
@@ -1954,6 +1955,7 @@ public final class CollisionUtil {
|
||||
@@ -1957,6 +1958,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
|
||||
@@ -24,7 +24,7 @@ index 432bc933c4e31dff9737748e8b81521bfc45530a..2b3f37b2c4add7fe5c5e9500cd087517
|
||||
final ChunkSource chunkSource = world.getChunkSource();
|
||||
|
||||
for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
|
||||
@@ -1996,7 +1998,7 @@ public final class CollisionUtil {
|
||||
@@ -1999,7 +2001,7 @@ public final class CollisionUtil {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ index 432bc933c4e31dff9737748e8b81521bfc45530a..2b3f37b2c4add7fe5c5e9500cd087517
|
||||
final int sectionAdjust = !hasSpecial ? 1 : 0;
|
||||
|
||||
final PalettedContainer<BlockState> blocks = section.states;
|
||||
@@ -2035,6 +2037,11 @@ public final class CollisionUtil {
|
||||
@@ -2038,6 +2040,11 @@ public final class CollisionUtil {
|
||||
mutablePos.set(blockX, blockY, blockZ);
|
||||
if (useEntityCollisionShape) {
|
||||
blockCollision = collisionShape.getCollisionShape(blockData, world, mutablePos);
|
||||
@@ -46,7 +46,7 @@ index 432bc933c4e31dff9737748e8b81521bfc45530a..2b3f37b2c4add7fe5c5e9500cd087517
|
||||
blockCollision = blockData.getCollisionShape(world, mutablePos, collisionShape);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 88348c5e20041bcb1f327e601625980f4ab1392a..528d45eb5ff968ef14c3ff74a0c3bdb58ab21b86 100644
|
||||
index 098b5a8cfe1ce37f5c1ed51c2bb913990a820838..2107fb073fc6bee12a80652c08cdc82e2fe495f8 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -546,6 +546,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configure breaking blocks outside the world border
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
|
||||
index 4b937ba2568a08d45541199964b3b46638f76785..3b2498ab4f3da5aea22931532901a540ffb03e73 100644
|
||||
index 963bcb84fc48ae81e07a7a19074af17d302ac890..73c8f19826ca39ba344c9590d4420e0a25103d4d 100644
|
||||
--- a/net/minecraft/world/level/ServerExplosion.java
|
||||
+++ b/net/minecraft/world/level/ServerExplosion.java
|
||||
@@ -507,6 +507,11 @@ public class ServerExplosion implements Explosion {
|
||||
@@ -517,6 +517,11 @@ public class ServerExplosion implements Explosion {
|
||||
return ret;
|
||||
}
|
||||
// Sakura end - optimise protected explosions
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise block counting for cannon entities
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
index 2b3f37b2c4add7fe5c5e9500cd087517fa11600b..035008bc65c3a3a85512edc30cb4e311aab96006 100644
|
||||
index 0e16ec857c6f9005f6a56b2a79493ce4eeec59a6..1269bf2f22d162b96ace840aadb49907ddb14bce 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
@@ -1937,6 +1937,8 @@ public final class CollisionUtil {
|
||||
@@ -1940,6 +1940,8 @@ public final class CollisionUtil {
|
||||
final BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos();
|
||||
final CollisionContext collisionShape = new LazyEntityCollisionContext(entity);
|
||||
final boolean useEntityCollisionShape = LazyEntityCollisionContext.useEntityCollisionShape(world, entity);
|
||||
@@ -17,7 +17,7 @@ index 2b3f37b2c4add7fe5c5e9500cd087517fa11600b..035008bc65c3a3a85512edc30cb4e311
|
||||
|
||||
// special cases:
|
||||
if (minBlockY > maxBlockY) {
|
||||
@@ -2000,15 +2002,19 @@ public final class CollisionUtil {
|
||||
@@ -2003,15 +2005,19 @@ public final class CollisionUtil {
|
||||
|
||||
final boolean hasSpecial = !fullBlocks && section.moonrise$hasSpecialCollidingBlocks(); // Sakura - collide with non-solid blocks
|
||||
final int sectionAdjust = !hasSpecial ? 1 : 0;
|
||||
@@ -43,7 +43,7 @@ index 2b3f37b2c4add7fe5c5e9500cd087517fa11600b..035008bc65c3a3a85512edc30cb4e311
|
||||
for (int currY = minYIterate; currY <= maxYIterate; ++currY) {
|
||||
final int blockY = currY | (currChunkY << 4);
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index c1f9d65aba951963ebb297393580df3d6969c021..02e29e2e10f399906dcc9bd7bdbabe62b1a97245 100644
|
||||
index 307542eff210e8824f651ca42e15b00c22df98fc..c3cc64d75338e5fd58db074284cb10b5f778f007 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -616,6 +616,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 25 Sep 2025 11:26:32 +0100
|
||||
Subject: [PATCH] fixup! Configure cannon physics
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
|
||||
index f8ad47d47ee060be66b735eacdcb19ee8e5c7628..f008ffa972eddf1d6bd0c3c2ef75332a56fb3448 100644
|
||||
--- a/net/minecraft/world/level/ServerExplosion.java
|
||||
+++ b/net/minecraft/world/level/ServerExplosion.java
|
||||
@@ -391,7 +391,17 @@ public class ServerExplosion implements Explosion {
|
||||
return this.damageCalculator.getBlockExplosionResistance(this, this.level, pos, blockState, fluidState);
|
||||
}
|
||||
// Sakura end - explosion durable blocks
|
||||
- protected final me.samsuik.sakura.mechanics.MinecraftMechanicsTarget mechanicsTarget; // Sakura - configure server mechanics
|
||||
+ // Sakura start - configure server mechanics
|
||||
+ protected final me.samsuik.sakura.mechanics.MinecraftMechanicsTarget mechanicsTarget;
|
||||
+
|
||||
+ private float sakura$getSeenPercent(final Vec3 explosionPos, final Entity entity) {
|
||||
+ if (this.mechanicsTarget.atLeast(me.samsuik.sakura.mechanics.MechanicVersion.v1_16)) {
|
||||
+ return this.getSeenFraction(explosionPos, entity, this.directMappedBlockCache, this.mutablePos); // Paper - collision optimisations
|
||||
+ } else {
|
||||
+ return getSeenPercent(explosionPos, entity);
|
||||
+ }
|
||||
+ }
|
||||
+ // Sakura end - configure server mechanics
|
||||
|
||||
public ServerExplosion(
|
||||
ServerLevel level,
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 25 Sep 2025 11:26:32 +0100
|
||||
Subject: [PATCH] fixup! Configure cannon physics
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
|
||||
index f008ffa972eddf1d6bd0c3c2ef75332a56fb3448..ba4979657e65bfc97bb597e7aaa6ce6d030c1346 100644
|
||||
--- a/net/minecraft/world/level/ServerExplosion.java
|
||||
+++ b/net/minecraft/world/level/ServerExplosion.java
|
||||
@@ -967,7 +967,7 @@ public class ServerExplosion implements Explosion {
|
||||
// Sakura start - replace density cache
|
||||
float blockDensity = this.level.densityCache.getBlockDensity(vec3d, entity);
|
||||
if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
|
||||
- blockDensity = this.sakura_getSeenPercent(vec3d, entity); // Sakura - configure server mechanics
|
||||
+ blockDensity = this.sakura$getSeenPercent(vec3d, entity); // Sakura - configure server mechanics
|
||||
this.level.densityCache.putDensity(vec3d, entity, blockDensity);
|
||||
// Sakura end - replace density cache
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 25 Sep 2025 11:26:32 +0100
|
||||
Subject: [PATCH] fixup! Configure cannon physics
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
|
||||
index ba4979657e65bfc97bb597e7aaa6ce6d030c1346..a88add750945a1a374d248ba6b2eb0688d9bec18 100644
|
||||
--- a/net/minecraft/world/level/ServerExplosion.java
|
||||
+++ b/net/minecraft/world/level/ServerExplosion.java
|
||||
@@ -975,16 +975,6 @@ public class ServerExplosion implements Explosion {
|
||||
return blockDensity;
|
||||
}
|
||||
|
||||
- // Sakura start - configure server mechanics
|
||||
- private float sakura_getSeenPercent(final Vec3 vec3d, final Entity entity) {
|
||||
- if (this.mechanicsTarget.atLeast(me.samsuik.sakura.mechanics.MechanicVersion.v1_16)) {
|
||||
- return this.getSeenFraction(vec3d, entity, this.directMappedBlockCache, this.mutablePos); // Paper - collision optimisations
|
||||
- } else {
|
||||
- return getSeenPercent(vec3d, entity);
|
||||
- }
|
||||
- }
|
||||
- // Sakura end - configure server mechanics
|
||||
-
|
||||
static class CacheKey {
|
||||
private final Level world;
|
||||
private final double posX, posY, posZ;
|
||||
@@ -98,7 +98,10 @@ public final class LocalConfiguration implements LocalConfigurationAccessor {
|
||||
CachedLocalConfiguration cache = this.cachedConfiguration.get(sectionKey);
|
||||
//noinspection ConstantValue
|
||||
if (cache == null) {
|
||||
final ConfigurationContainer container = this.getContainer(x, y, z);
|
||||
ConfigurationContainer container = this.getContainer(x, y, z);
|
||||
if (container == null) {
|
||||
container = new ConfigurationContainer();
|
||||
}
|
||||
cache = new CachedLocalConfiguration(level, container, sectionKey);
|
||||
this.cachedConfiguration.put(sectionKey, cache);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package me.samsuik.sakura.mechanics;
|
||||
|
||||
import ca.spottedleaf.moonrise.patches.collisions.CollisionUtil;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NullMarked
|
||||
public final class EntityBehaviour {
|
||||
public static void changeEntityPosition(
|
||||
@@ -49,4 +54,17 @@ public final class EntityBehaviour {
|
||||
? Math.abs(x) < Math.abs(z)
|
||||
: mechanicsTarget.isLegacy() && Math.abs(x) > Math.abs(z);
|
||||
}
|
||||
|
||||
public static void convertVoxelsIntoAABBs(final Vec3 movement, final AABB bb, final List<VoxelShape> voxels, final List<AABB> aabbs) {
|
||||
final AABB collisions = bb.expandTowards(movement);
|
||||
for (final VoxelShape shape : voxels) {
|
||||
for (final AABB boundingBox : shape.toAabbs()) {
|
||||
if (CollisionUtil.voxelShapeIntersect(boundingBox, collisions) && !CollisionUtil.isEmpty(boundingBox)) {
|
||||
aabbs.add(boundingBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
voxels.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user