Merge pull request #3298 from TBiscuit1/mc1.18/dev

Fixed kinetic blocks able to surpass the rpm limit
This commit is contained in:
simibubi 2022-08-01 15:24:59 +02:00 committed by GitHub
commit b1a5bf7744
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ public class RotationPropagator {
* Determines the change in rotation between two attached kinetic entities. For
* instance, an axis connection returns 1 while a 1-to-1 gear connection
* reverses the rotation and therefore returns -1.
*
*
* @param from
* @param to
* @return
@ -201,7 +201,7 @@ public class RotationPropagator {
/**
* Insert the added position to the kinetic network.
*
*
* @param worldIn
* @param pos
*/
@ -215,7 +215,7 @@ public class RotationPropagator {
/**
* Search for sourceless networks attached to the given entity and update them.
*
*
* @param currentTE
*/
private static void propagateNewSource(KineticTileEntity currentTE) {
@ -230,11 +230,14 @@ public class RotationPropagator {
if (newSpeed == 0 && oppositeSpeed == 0)
continue;
boolean incompatible =
Math.signum(newSpeed) != Math.signum(speedOfNeighbour) && (newSpeed != 0 && speedOfNeighbour != 0);
boolean tooFast = Math.abs(newSpeed) > AllConfigs.SERVER.kinetics.maxRotationSpeed.get();
boolean tooFast = Math.abs(newSpeed) > AllConfigs.SERVER.kinetics.maxRotationSpeed.get()
|| Math.abs(oppositeSpeed) > AllConfigs.SERVER.kinetics.maxRotationSpeed.get();
// Check for both the new speed and the opposite speed, just in case
boolean speedChangedTooOften = currentTE.getFlickerScore() > MAX_FLICKER_SCORE;
if (tooFast || speedChangedTooOften) {
world.destroyBlock(pos, true);
@ -300,7 +303,7 @@ public class RotationPropagator {
/**
* Remove the given entity from the network.
*
*
* @param worldIn
* @param pos
* @param removedTE
@ -333,7 +336,7 @@ public class RotationPropagator {
/**
* Clear the entire subnetwork depending on the given entity and find a new
* source
*
*
* @param updateTE
*/
private static void propagateMissingSource(KineticTileEntity updateTE) {