Merge branch 'mc1.15/dev' into mc1.16/dev

This commit is contained in:
simibubi 2021-04-01 17:46:07 +02:00
commit 6cfbf26f49
3 changed files with 18 additions and 8 deletions

View file

@ -13,7 +13,6 @@ import org.apache.commons.lang3.mutable.MutableInt;
import org.apache.commons.lang3.mutable.MutableObject; import org.apache.commons.lang3.mutable.MutableObject;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllMovementBehaviours; import com.simibubi.create.AllMovementBehaviours;
import com.simibubi.create.content.contraptions.components.actors.BlockBreakingMovementBehaviour; import com.simibubi.create.content.contraptions.components.actors.BlockBreakingMovementBehaviour;
@ -285,13 +284,16 @@ public class ContraptionCollider {
} }
if (bounce == 0 && slide > 0 && hasNormal && anyCollision && rotation.hasVerticalRotation()) { if (bounce == 0 && slide > 0 && hasNormal && anyCollision && rotation.hasVerticalRotation()) {
Vector3d motionIn = entityMotionNoTemporal.mul(0, 1, 0) double slideFactor = collisionNormal.mul(1, 0, 1)
.length() * 1.25f;
Vector3d motionIn = entityMotionNoTemporal.mul(0, .9, 0)
.add(0, -.01f, 0); .add(0, -.01f, 0);
Vector3d slideNormal = collisionNormal.crossProduct(motionIn.crossProduct(collisionNormal)) Vector3d slideNormal = collisionNormal.crossProduct(motionIn.crossProduct(collisionNormal))
.normalize(); .normalize();
entity.setMotion(entityMotion.mul(.8, 0, .8) Vector3d 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();
} }

View file

@ -42,7 +42,7 @@ public class GantryCarriageBlock extends DirectionalAxisKineticBlock implements
super.updateDiagonalNeighbors(stateIn, worldIn, pos, flags, count); super.updateDiagonalNeighbors(stateIn, worldIn, pos, flags, count);
withTileEntityDo(worldIn, pos, GantryCarriageTileEntity::checkValidGantryShaft); withTileEntityDo(worldIn, pos, GantryCarriageTileEntity::checkValidGantryShaft);
} }
@Override @Override
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
super.onBlockAdded(state, worldIn, pos, oldState, isMoving); super.onBlockAdded(state, worldIn, pos, oldState, isMoving);
@ -81,9 +81,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);
} }

View file

@ -35,6 +35,13 @@ public class GantryCarriageTileEntity extends KineticTileEntity implements IDisp
if (shouldAssemble()) if (shouldAssemble())
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;