mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-21 07:49:29 +00:00
Missed 1.21.5 physics changes
This commit is contained in:
@@ -18,6 +18,7 @@ public enum PhysicsVersion {
|
|||||||
v1_19_3("1.19.3", 1_19_3),
|
v1_19_3("1.19.3", 1_19_3),
|
||||||
v1_20("1.20", 1_20_0),
|
v1_20("1.20", 1_20_0),
|
||||||
v1_21_2("1.21.2", 1_21_2),
|
v1_21_2("1.21.2", 1_21_2),
|
||||||
|
v1_21_5("1.21.5", 1_21_5),
|
||||||
LATEST("latest", 9_99_9); // latest version
|
LATEST("latest", 9_99_9); // latest version
|
||||||
|
|
||||||
private final String friendlyName;
|
private final String friendlyName;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ index 44aaaa87d63a2a2287f89feaa431ca0e80da3dab..194db5ff2a473b10fded4491c1173d42
|
|||||||
if (xSmaller && z != 0.0) {
|
if (xSmaller && z != 0.0) {
|
||||||
z = performAABBCollisionsZ(axisalignedbb, z, aabbs);
|
z = performAABBCollisionsZ(axisalignedbb, z, aabbs);
|
||||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||||
index 98107921d7251e1b7fc621103a31afdfd3bb5af7..162062200a4ffa7bc669093779377f0d8d83172e 100644
|
index 98107921d7251e1b7fc621103a31afdfd3bb5af7..d6833a7ba9f5885444ab409bca72eb55ac87ffec 100644
|
||||||
--- a/net/minecraft/world/entity/Entity.java
|
--- a/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/net/minecraft/world/entity/Entity.java
|
+++ b/net/minecraft/world/entity/Entity.java
|
||||||
@@ -570,6 +570,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -570,6 +570,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
@@ -118,7 +118,23 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..162062200a4ffa7bc669093779377f0d
|
|||||||
BlockHitResult blockHitResult = this.level()
|
BlockHitResult blockHitResult = this.level()
|
||||||
.clip(
|
.clip(
|
||||||
new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)
|
new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)
|
||||||
@@ -1223,6 +1235,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1180,6 +1192,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec3 vec31 = this.position();
|
||||||
|
+ if (physics.afterOrEqual(1_21_5)) { // Sakura - configure cannon physics
|
||||||
|
List<Entity.Movement> list = new ObjectArrayList<>();
|
||||||
|
|
||||||
|
for (Direction.Axis axis : axisStepOrder(vec3)) {
|
||||||
|
@@ -1192,6 +1205,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
|
}
|
||||||
|
|
||||||
|
this.movementThisTick.add(list);
|
||||||
|
+ } // Sakura - configure cannon physics
|
||||||
|
this.setPos(vec31);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1223,6 +1237,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
} else {
|
} else {
|
||||||
if (this.horizontalCollision) {
|
if (this.horizontalCollision) {
|
||||||
Vec3 deltaMovement = this.getDeltaMovement();
|
Vec3 deltaMovement = this.getDeltaMovement();
|
||||||
@@ -131,7 +147,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..162062200a4ffa7bc669093779377f0d
|
|||||||
this.setDeltaMovement(flag ? 0.0 : deltaMovement.x, deltaMovement.y, flag1 ? 0.0 : deltaMovement.z);
|
this.setDeltaMovement(flag ? 0.0 : deltaMovement.x, deltaMovement.y, flag1 ? 0.0 : deltaMovement.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1539,7 +1557,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1539,7 +1559,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
bb = currBoundingBox.expandTowards(movement.x, movement.y, movement.z);
|
bb = currBoundingBox.expandTowards(movement.x, movement.y, movement.z);
|
||||||
}
|
}
|
||||||
this.collectCollisions(bb, voxelList, bbList, ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER);
|
this.collectCollisions(bb, voxelList, bbList, ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER);
|
||||||
@@ -140,7 +156,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..162062200a4ffa7bc669093779377f0d
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Vec3 collideAxisScan(Vec3 movement, AABB currBoundingBox, List<VoxelShape> voxelList, List<AABB> bbList) {
|
private Vec3 collideAxisScan(Vec3 movement, AABB currBoundingBox, List<VoxelShape> voxelList, List<AABB> bbList) {
|
||||||
@@ -1547,7 +1565,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1547,7 +1567,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
double y = movement.y;
|
double y = movement.y;
|
||||||
double z = movement.z;
|
double z = movement.z;
|
||||||
|
|
||||||
@@ -152,7 +168,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..162062200a4ffa7bc669093779377f0d
|
|||||||
|
|
||||||
if (y != 0.0) {
|
if (y != 0.0) {
|
||||||
y = this.scanY(currBoundingBox, y, voxelList, bbList);
|
y = this.scanY(currBoundingBox, y, voxelList, bbList);
|
||||||
@@ -1669,7 +1690,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1669,7 +1692,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), null // Sakura - load chunks on movement
|
ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), null // Sakura - load chunks on movement
|
||||||
);
|
);
|
||||||
potentialCollisionsBB.addAll(entityAABBs);
|
potentialCollisionsBB.addAll(entityAABBs);
|
||||||
@@ -161,7 +177,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..162062200a4ffa7bc669093779377f0d
|
|||||||
|
|
||||||
final boolean collidedX = collided.x != movement.x;
|
final boolean collidedX = collided.x != movement.x;
|
||||||
final boolean collidedY = collided.y != movement.y;
|
final boolean collidedY = collided.y != movement.y;
|
||||||
@@ -1795,11 +1816,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1795,11 +1818,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
for (Entity.Movement movement : movements) {
|
for (Entity.Movement movement : movements) {
|
||||||
Vec3 vec3 = movement.from();
|
Vec3 vec3 = movement.from();
|
||||||
Vec3 vec31 = movement.to();
|
Vec3 vec31 = movement.to();
|
||||||
@@ -789,7 +805,7 @@ index 6c789e56f21f01252c21786cfeb48d88485b5636..17ecdee7bd6a8369394115d6534c9d7e
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||||
index 7277004b03287fdf9f3345d445740af27f02d772..c1ea33dc297409a8da73ee5145d800a4715b93ea 100644
|
index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d5c5e12a1 100644
|
||||||
--- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
--- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||||
+++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
+++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||||
@@ -65,6 +65,150 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
@@ -65,6 +65,150 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||||
@@ -956,7 +972,19 @@ index 7277004b03287fdf9f3345d445740af27f02d772..c1ea33dc297409a8da73ee5145d800a4
|
|||||||
for (AABB aabb1 : list) {
|
for (AABB aabb1 : list) {
|
||||||
AABB movementArea = PistonMath.getMovementArea(moveByPositionAndProgress(pos, aabb1, piston), movementDirection, d);
|
AABB movementArea = PistonMath.getMovementArea(moveByPositionAndProgress(pos, aabb1, piston), movementDirection, d);
|
||||||
AABB boundingBox = entity.getBoundingBox();
|
AABB boundingBox = entity.getBoundingBox();
|
||||||
@@ -308,12 +458,21 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
@@ -196,6 +346,11 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||||
|
NOCLIP.set(noClipDirection);
|
||||||
|
Vec3 vec3 = entity.position();
|
||||||
|
entity.move(MoverType.PISTON, new Vec3(progress * direction.getStepX(), progress * direction.getStepY(), progress * direction.getStepZ()));
|
||||||
|
+ // Sakura start - configure cannon physics
|
||||||
|
+ if (entity.physics().before(1_21_5)) {
|
||||||
|
+ vec3 = entity.oldPosition();
|
||||||
|
+ }
|
||||||
|
+ // Sakura end - configure cannon physics
|
||||||
|
entity.applyEffectsFromBlocks(vec3, entity.position());
|
||||||
|
entity.removeLatestMovementRecordingBatch();
|
||||||
|
NOCLIP.set(null);
|
||||||
|
@@ -308,12 +463,21 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) {
|
public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) {
|
||||||
@@ -978,7 +1006,7 @@ index 7277004b03287fdf9f3345d445740af27f02d772..c1ea33dc297409a8da73ee5145d800a4
|
|||||||
level.removeBlockEntity(pos);
|
level.removeBlockEntity(pos);
|
||||||
blockEntity.setRemoved();
|
blockEntity.setRemoved();
|
||||||
if (level.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
|
if (level.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
|
||||||
@@ -335,12 +494,22 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
@@ -335,12 +499,22 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float f = blockEntity.progress + 0.5F;
|
float f = blockEntity.progress + 0.5F;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Configurable left shooting and adjusting limits
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||||
index ffe5ad8f3936386fd1fa2b961837fbea5c230407..6eaef984b71881bc04f835d4773f18b754e2fcd4 100644
|
index b1319d32dccc86b1f9dbe6158c4cec6468987ec9..ce666bcaba205c0ab08def735e016f8dd3a24ca5 100644
|
||||||
--- a/net/minecraft/world/entity/Entity.java
|
--- a/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/net/minecraft/world/entity/Entity.java
|
+++ b/net/minecraft/world/entity/Entity.java
|
||||||
@@ -598,6 +598,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -598,6 +598,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
@@ -55,7 +55,7 @@ index ffe5ad8f3936386fd1fa2b961837fbea5c230407..6eaef984b71881bc04f835d4773f18b7
|
|||||||
|
|
||||||
public Entity(EntityType<?> entityType, Level level) {
|
public Entity(EntityType<?> entityType, Level level) {
|
||||||
this.type = entityType;
|
this.type = entityType;
|
||||||
@@ -1600,6 +1640,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1602,6 +1642,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xSmaller && z != 0.0) {
|
if (xSmaller && z != 0.0) {
|
||||||
@@ -63,7 +63,7 @@ index ffe5ad8f3936386fd1fa2b961837fbea5c230407..6eaef984b71881bc04f835d4773f18b7
|
|||||||
z = this.scanZ(currBoundingBox, z, voxelList, bbList);
|
z = this.scanZ(currBoundingBox, z, voxelList, bbList);
|
||||||
if (z != 0.0) {
|
if (z != 0.0) {
|
||||||
currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetZ(currBoundingBox, z);
|
currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetZ(currBoundingBox, z);
|
||||||
@@ -1607,6 +1648,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1609,6 +1650,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x != 0.0) {
|
if (x != 0.0) {
|
||||||
@@ -76,7 +76,7 @@ index ffe5ad8f3936386fd1fa2b961837fbea5c230407..6eaef984b71881bc04f835d4773f18b7
|
|||||||
if (x != 0.0) {
|
if (x != 0.0) {
|
||||||
currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetX(currBoundingBox, x);
|
currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetX(currBoundingBox, x);
|
||||||
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
|
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||||
index 16c22f243fcb6b5ae1b43ea112251a9b731f91c8..cc57c4ea0ea4a39933ec6fe44c5d44bde3bc6dfb 100644
|
index 3b83c101fd5583f45fdd6fa20e92bc17318fad6b..60e1c2acb267eb277ba06903002a8d687fb309d0 100644
|
||||||
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java
|
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||||
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
|
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||||
@@ -285,6 +285,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
|
@@ -285,6 +285,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise check inside blocks and traverse blocks
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||||
index 6eaef984b71881bc04f835d4773f18b754e2fcd4..f5e3f2e066e257bc791254e3bf7ff6659c077d09 100644
|
index ce666bcaba205c0ab08def735e016f8dd3a24ca5..45aae522d5644e8409dc41bf42f8fe236a4e32d4 100644
|
||||||
--- a/net/minecraft/world/entity/Entity.java
|
--- a/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/net/minecraft/world/entity/Entity.java
|
+++ b/net/minecraft/world/entity/Entity.java
|
||||||
@@ -1880,6 +1880,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1882,6 +1882,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
private void checkInsideBlocks(List<Entity.Movement> movements, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector) {
|
private void checkInsideBlocks(List<Entity.Movement> movements, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector) {
|
||||||
if (this.isAffectedByBlocks()) {
|
if (this.isAffectedByBlocks()) {
|
||||||
LongSet set = this.visitedBlocks;
|
LongSet set = this.visitedBlocks;
|
||||||
@@ -16,7 +16,7 @@ index 6eaef984b71881bc04f835d4773f18b754e2fcd4..f5e3f2e066e257bc791254e3bf7ff665
|
|||||||
|
|
||||||
for (Entity.Movement movement : movements) {
|
for (Entity.Movement movement : movements) {
|
||||||
Vec3 vec3 = movement.from();
|
Vec3 vec3 = movement.from();
|
||||||
@@ -1895,7 +1896,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1897,7 +1898,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
this.physics, // Sakura - configure cannon physics
|
this.physics, // Sakura - configure cannon physics
|
||||||
(pos, step) -> {
|
(pos, step) -> {
|
||||||
if (this.isAlive()) {
|
if (this.isAlive()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user