mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Too slippery
- Sliding on contraptions now takes its slope into account - Gantry Carriages are now less prone to break when moved near other blocks
This commit is contained in:
parent
c21a8bcbde
commit
6c942be7f5
3 changed files with 18 additions and 7 deletions
|
@ -285,13 +285,16 @@ public class ContraptionCollider {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bounce == 0 && slide > 0 && hasNormal && anyCollision && rotation.hasVerticalRotation()) {
|
if (bounce == 0 && slide > 0 && hasNormal && anyCollision && rotation.hasVerticalRotation()) {
|
||||||
Vec3d motionIn = entityMotionNoTemporal.mul(0, 1, 0)
|
double slideFactor = collisionNormal.mul(1, 0, 1)
|
||||||
|
.length() * 1.25f;
|
||||||
|
Vec3d motionIn = entityMotionNoTemporal.mul(0, .9, 0)
|
||||||
.add(0, -.01f, 0);
|
.add(0, -.01f, 0);
|
||||||
Vec3d slideNormal = collisionNormal.crossProduct(motionIn.crossProduct(collisionNormal))
|
Vec3d slideNormal = collisionNormal.crossProduct(motionIn.crossProduct(collisionNormal))
|
||||||
.normalize();
|
.normalize();
|
||||||
entity.setMotion(entityMotion.mul(.8, 0, .8)
|
Vec3d newMotion = entityMotion.mul(.85, 0, .85)
|
||||||
.add(slideNormal.scale((.2f + slide) * motionIn.length())
|
.add(slideNormal.scale((.2f + slide) * motionIn.length() * slideFactor)
|
||||||
.add(0, -0.1, 0)));
|
.add(0, -.1f - collisionNormal.y * .125f, 0));
|
||||||
|
entity.setMotion(newMotion);
|
||||||
entityMotion = entity.getMotion();
|
entityMotion = entity.getMotion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,10 @@ public class GantryCarriageBlock extends DirectionalAxisKineticBlock implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(BlockState state, World world, BlockPos pos, Block p_220069_4_, BlockPos p_220069_5_,
|
public void neighborChanged(BlockState state, World world, BlockPos pos, Block p_220069_4_, BlockPos updatePos,
|
||||||
boolean p_220069_6_) {
|
boolean p_220069_6_) {
|
||||||
if (!isValidPosition(state, world, pos))
|
if (updatePos.equals(pos.offset(state.get(FACING)
|
||||||
|
.getOpposite())) && !isValidPosition(state, world, pos))
|
||||||
world.destroyBlock(pos, true);
|
world.destroyBlock(pos, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,13 @@ public class GantryCarriageTileEntity extends KineticTileEntity implements IDisp
|
||||||
queueAssembly();
|
queueAssembly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
super.initialize();
|
||||||
|
if (!getBlockState().isValidPosition(world, pos))
|
||||||
|
world.destroyBlock(pos, true);
|
||||||
|
}
|
||||||
|
|
||||||
public void queueAssembly() {
|
public void queueAssembly() {
|
||||||
assembleNextTick = true;
|
assembleNextTick = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue