Skip to content

Commit e62a382

Browse files
authored
Add a config option for the magnet's attraction delay (#2616)
1 parent a91b37e commit e62a382

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/main/java/gregtech/common/ConfigHolder.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public class ConfigHolder {
3535
// TODO move to ToolsModule config
3636
@Config.Comment("Config options for Tools and Armor")
3737
@Config.Name("Tool and Armor Options")
38-
@Config.RequiresMcRestart
3938
public static ToolOptions tools = new ToolOptions();
4039

4140
@Config.Comment("Config options for World Generation features")
@@ -641,34 +640,42 @@ public static class HeatEffectBloom {
641640

642641
public static class ToolOptions {
643642

643+
@Config.RequiresMcRestart
644644
@Config.Name("NanoSaber Options")
645645
public NanoSaber nanoSaber = new NanoSaber();
646646

647+
@Config.RequiresMcRestart
647648
@Config.Comment("NightVision Goggles Voltage Tier. Default: 1 (LV)")
648649
@Config.RangeInt(min = 0, max = 14)
649650
public int voltageTierNightVision = 1;
650651

652+
@Config.RequiresMcRestart
651653
@Config.Comment("NanoSuit Voltage Tier. Default: 3 (HV)")
652654
@Config.RangeInt(min = 0, max = 14)
653655
public int voltageTierNanoSuit = 3;
654656

657+
@Config.RequiresMcRestart
655658
@Config.Comment({ "Advanced NanoSuit Chestplate Voltage Tier.", "Default: 3 (HV)" })
656659
@Config.RangeInt(min = 0, max = 14)
657660
public int voltageTierAdvNanoSuit = 3;
658661

662+
@Config.RequiresMcRestart
659663
@Config.Comment({ "QuarkTech Suit Voltage Tier.", "Default: 5 (IV)" })
660664
@Config.RangeInt(min = 0, max = 14)
661665
@Config.SlidingOption
662666
public int voltageTierQuarkTech = 5;
663667

668+
@Config.RequiresMcRestart
664669
@Config.Comment({ "Advanced QuarkTech Suit Chestplate Voltage Tier.", "Default: 5 (LuV)" })
665670
@Config.RangeInt(min = 0, max = 14)
666671
public int voltageTierAdvQuarkTech = 6;
667672

673+
@Config.RequiresMcRestart
668674
@Config.Comment({ "Electric Impeller Jetpack Voltage Tier.", "Default: 2 (MV)" })
669675
@Config.RangeInt(min = 0, max = 14)
670676
public int voltageTierImpeller = 2;
671677

678+
@Config.RequiresMcRestart
672679
@Config.Comment({ "Advanced Electric Jetpack Voltage Tier.", "Default: 3 (HV)" })
673680
@Config.RangeInt(min = 0, max = 14)
674681
public int voltageTierAdvImpeller = 3;
@@ -680,6 +687,11 @@ public static class ToolOptions {
680687

681688
@Config.Comment("Armor HUD Location")
682689
public ArmorHud armorHud = new ArmorHud();
690+
691+
@Config.Comment({ "How often items should be moved by a magnet", "Default: 10 ticks" })
692+
@Config.RangeInt(min = 1, max = 100)
693+
@Config.SlidingOption
694+
public int magnetDelay = 10;
683695
}
684696

685697
public static class ArmorHud {

src/main/java/gregtech/common/items/behaviors/ItemMagnetBehavior.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import gregtech.api.items.metaitem.MetaItem;
77
import gregtech.api.items.metaitem.stats.IItemBehaviour;
88
import gregtech.api.util.Mods;
9+
import gregtech.common.ConfigHolder;
910
import gregtech.integration.baubles.BaublesModule;
1011

1112
import net.minecraft.client.resources.I18n;
@@ -81,7 +82,7 @@ private static boolean toggleActive(ItemStack stack) {
8182
public void onUpdate(ItemStack stack, Entity entity) {
8283
// Adapted logic from Draconic Evolution
8384
// https://github.com/Draconic-Inc/Draconic-Evolution/blob/1.12.2/src/main/java/com/brandon3055/draconicevolution/items/tools/Magnet.java
84-
if (!entity.isSneaking() && entity.ticksExisted % 10 == 0 && isActive(stack) &&
85+
if (!entity.isSneaking() && entity.ticksExisted % ConfigHolder.tools.magnetDelay == 0 && isActive(stack) &&
8586
entity instanceof EntityPlayer player) {
8687
World world = entity.getEntityWorld();
8788
if (!drainEnergy(true, stack, energyDraw)) {

0 commit comments

Comments
 (0)