-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mineshafter61 <yuhang.061@gmail.com>
- Loading branch information
1 parent
17efce8
commit 1765ff5
Showing
26 changed files
with
264 additions
and
141 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#Thu Jun 27 17:21:31 SGT 2024 | ||
#Sun Aug 04 10:18:49 SGT 2024 | ||
gradle.version=8.8 |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/mikeshafter/mikestcaddons/throttle/ManGear.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package mikeshafter.mikestcaddons.throttle; | ||
|
||
import com.bergerkiller.bukkit.tc.controller.MinecartGroup; | ||
import net.kyori.adventure.bossbar.BossBar; | ||
import net.kyori.adventure.text.Component; | ||
import org.bukkit.entity.Player; | ||
|
||
public class ManGear implements Throttle { | ||
|
||
private final MinecartGroup controlledGroup; | ||
private double speed; | ||
private float gear = 0.0004f; | ||
private float current; | ||
|
||
public ManGear (MinecartGroup controlledGroup) { | ||
this.controlledGroup = controlledGroup; | ||
} | ||
|
||
@Override | ||
public void onReceive (int bitArray) { | ||
// SimpleLever only uses A/D buttons to control the lever. | ||
// We get the 2's bit for W | ||
if ((bitArray & 2) != 0) { | ||
this.speed = this.controlledGroup.getAverageForce() + 0.002; | ||
// P = 0.5 mva | ||
// I = P/V | ||
current = (float) (speed * 0.002 / gear); | ||
this.controlledGroup.setForwardForce(speed); | ||
} | ||
// We get the 16's bit for S | ||
if ((bitArray & 4) != 0) { | ||
this.speed = this.controlledGroup.getAverageForce() - 0.002; | ||
// P = 0.5 mva | ||
// I = P/V | ||
current = (float) (speed * 0.002 / gear); | ||
this.controlledGroup.setForwardForce(speed); | ||
} | ||
if ((bitArray & 8) != 0) { | ||
gear += 0.0002f; | ||
} | ||
if ((bitArray & 16) != 0) { | ||
if (gear > 0.0004f) gear -= 0.0002f; | ||
} | ||
} | ||
|
||
@Override | ||
public void updateHUD (Player player) { | ||
player.sendActionBar(Component.text(speed)); | ||
BossBar.bossBar(Component.text("Main Reservoir").asComponent(), 0.75F, BossBar.Color.PINK, BossBar.Overlay.NOTCHED_10); | ||
BossBar.bossBar(Component.text("Traction Current").asComponent(), current, BossBar.Color.RED, BossBar.Overlay.NOTCHED_10); | ||
} | ||
|
||
} |
Oops, something went wrong.