mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-28 19:29:07 +00:00
Start work on reintroducing old spigot/paper bugs
This commit is contained in:
@@ -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