Skip to content

Commit 6e916d7

Browse files
committed
Decouple PrecisionBreakBehavior's tier electricity logic from the omnitool
1 parent 3402336 commit 6e916d7

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/main/java/net/neganote/monilabs/common/item/MoniItems.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class MoniItems {
1919
.lang("Omnitool")
2020

2121
.properties(p -> p.stacksTo(1).durability(0))
22-
.onRegister(attach(ElectricStats.createElectricItem(25_600_000L, GTValues.IV), new PrecisionBreakBehavior()))
22+
.onRegister(attach(ElectricStats.createElectricItem(25_600_000L, GTValues.IV), new PrecisionBreakBehavior(GTValues.IV)))
2323
.register();
2424

2525
public static void init() {}

src/main/java/net/neganote/monilabs/common/item/PrecisionBreakBehavior.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import net.minecraft.world.level.block.state.BlockState;
1111

1212
public class PrecisionBreakBehavior implements IInteractionItem {
13-
public PrecisionBreakBehavior() {
13+
public int tier;
14+
public PrecisionBreakBehavior(int tier) {
15+
this.tier = tier;
1416
}
1517

1618
@Override
@@ -26,8 +28,9 @@ public InteractionResult useOn(UseOnContext context) {
2628
var electricItem = GTCapabilityHelper.getElectricItem(context.getItemInHand());
2729

2830
if (electricItem != null) {
29-
if (electricItem.discharge(8192L, GTValues.IV, true, false, true) == 8192L) {
30-
electricItem.discharge(8192L, GTValues.IV, true, false, false);
31+
if (electricItem.discharge(GTValues.VEX[tier], tier, true, false, true) == GTValues.VEX[tier]) {
32+
// Only discharge if possible to discharge the full amount
33+
electricItem.discharge(GTValues.VEX[tier], tier, true, false, false);
3134
} else {
3235
return InteractionResult.PASS;
3336
}

0 commit comments

Comments
 (0)