mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-18 07:53:07 +01:00
Fixed a big bug
Fixed the bug that causes Large Cogwheel -> Small Cogwheel to be able to go overcharged (over the maximum speed)
This commit is contained in:
parent
8b28c03699
commit
1ee7b2844d
1 changed files with 10 additions and 7 deletions
|
@ -36,7 +36,7 @@ public class RotationPropagator {
|
||||||
* Determines the change in rotation between two attached kinetic entities. For
|
* Determines the change in rotation between two attached kinetic entities. For
|
||||||
* instance, an axis connection returns 1 while a 1-to-1 gear connection
|
* instance, an axis connection returns 1 while a 1-to-1 gear connection
|
||||||
* reverses the rotation and therefore returns -1.
|
* reverses the rotation and therefore returns -1.
|
||||||
*
|
*
|
||||||
* @param from
|
* @param from
|
||||||
* @param to
|
* @param to
|
||||||
* @return
|
* @return
|
||||||
|
@ -201,7 +201,7 @@ public class RotationPropagator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert the added position to the kinetic network.
|
* Insert the added position to the kinetic network.
|
||||||
*
|
*
|
||||||
* @param worldIn
|
* @param worldIn
|
||||||
* @param pos
|
* @param pos
|
||||||
*/
|
*/
|
||||||
|
@ -215,7 +215,7 @@ public class RotationPropagator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for sourceless networks attached to the given entity and update them.
|
* Search for sourceless networks attached to the given entity and update them.
|
||||||
*
|
*
|
||||||
* @param currentTE
|
* @param currentTE
|
||||||
*/
|
*/
|
||||||
private static void propagateNewSource(KineticTileEntity currentTE) {
|
private static void propagateNewSource(KineticTileEntity currentTE) {
|
||||||
|
@ -230,11 +230,14 @@ public class RotationPropagator {
|
||||||
|
|
||||||
if (newSpeed == 0 && oppositeSpeed == 0)
|
if (newSpeed == 0 && oppositeSpeed == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
boolean incompatible =
|
boolean incompatible =
|
||||||
Math.signum(newSpeed) != Math.signum(speedOfNeighbour) && (newSpeed != 0 && speedOfNeighbour != 0);
|
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;
|
boolean speedChangedTooOften = currentTE.getFlickerScore() > MAX_FLICKER_SCORE;
|
||||||
if (tooFast || speedChangedTooOften) {
|
if (tooFast || speedChangedTooOften) {
|
||||||
world.destroyBlock(pos, true);
|
world.destroyBlock(pos, true);
|
||||||
|
@ -300,7 +303,7 @@ public class RotationPropagator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the given entity from the network.
|
* Remove the given entity from the network.
|
||||||
*
|
*
|
||||||
* @param worldIn
|
* @param worldIn
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param removedTE
|
* @param removedTE
|
||||||
|
@ -333,7 +336,7 @@ public class RotationPropagator {
|
||||||
/**
|
/**
|
||||||
* Clear the entire subnetwork depending on the given entity and find a new
|
* Clear the entire subnetwork depending on the given entity and find a new
|
||||||
* source
|
* source
|
||||||
*
|
*
|
||||||
* @param updateTE
|
* @param updateTE
|
||||||
*/
|
*/
|
||||||
private static void propagateMissingSource(KineticTileEntity updateTE) {
|
private static void propagateMissingSource(KineticTileEntity updateTE) {
|
||||||
|
|
Loading…
Reference in a new issue