mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-29 03:39:07 +00:00
All patches applied
This commit is contained in:
@@ -161,9 +161,15 @@ public abstract class SpecialisedExplosion<T extends Entity> extends ServerExplo
|
||||
|
||||
if (distanceFromBottom <= 1.0) {
|
||||
double x = entity.getX() - pos.x;
|
||||
double y = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - pos.y;
|
||||
double y = entity.getEyeY() - pos.y; // Sakura - physics version api
|
||||
double z = entity.getZ() - pos.z;
|
||||
double distance = Math.sqrt(x * x + y * y + z * z);
|
||||
// Sakura start - physics version api
|
||||
if (this.physics.before(1_17_0)) {
|
||||
distanceFromBottom = (float) distanceFromBottom;
|
||||
distance = (float) distance;
|
||||
}
|
||||
// Sakura end - physics version api
|
||||
|
||||
if (distance != 0.0D) {
|
||||
x /= distance;
|
||||
|
||||
@@ -37,6 +37,13 @@ public final class TntExplosion extends SpecialisedExplosion<PrimedTnt> {
|
||||
this.bounds = new AABB(center, center);
|
||||
}
|
||||
|
||||
// Sakura start - physics version api
|
||||
@Override
|
||||
protected double getExplosionOffset() {
|
||||
return this.physics.before(1_10_0) ? (double) 0.49f : super.getExplosionOffset();
|
||||
}
|
||||
// Sakura end - physics version api
|
||||
|
||||
@Override
|
||||
protected int getExplosionCount() {
|
||||
if (this.cause.getMergeEntityData().getMergeLevel() == MergeLevel.NONE) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@@ -22,6 +23,14 @@ public final class BlockPosIterator extends AbstractIterator<BlockPos> {
|
||||
return () -> new BlockPosIterator(bb);
|
||||
}
|
||||
|
||||
public static Iterable<BlockPos> traverseArea(Vec3 vec, AABB boundingBox) {
|
||||
double toTravel = Math.min(16.0 / vec.length(), 1.0);
|
||||
Vec3 movement = vec.scale(toTravel);
|
||||
AABB fromBB = boundingBox.move(-vec.x, -vec.y, -vec.z);
|
||||
AABB searchArea = fromBB.expandTowards(movement);
|
||||
return me.samsuik.sakura.utils.BlockPosIterator.iterable(searchArea);
|
||||
}
|
||||
|
||||
public BlockPosIterator(AABB bb) {
|
||||
this.startX = Mth.floor(bb.minX);
|
||||
this.startY = Mth.floor(bb.minY);
|
||||
|
||||
Reference in New Issue
Block a user