88import java .util .function .IntFunction ;
99import mekanism .api .IConfigurable ;
1010import mekanism .api .IIncrementalEnum ;
11+ import mekanism .api .MekanismItemAbilities ;
1112import mekanism .api .RelativeSide ;
1213import mekanism .api .annotations .NothingNullByDefault ;
1314import mekanism .api .inventory .IInventorySlot ;
6162import net .minecraft .world .level .LevelReader ;
6263import net .minecraft .world .level .block .Block ;
6364import net .minecraft .world .level .block .entity .BlockEntity ;
65+ import net .neoforged .neoforge .common .ItemAbility ;
6466import net .neoforged .neoforge .common .util .Lazy ;
6567import org .jetbrains .annotations .NotNull ;
6668import org .jetbrains .annotations .Nullable ;
6769
6870public class ItemConfigurator extends Item implements IRadialModeItem <ConfiguratorMode >, IItemHUDProvider {
6971
70- public static final Lazy <RadialData <ConfiguratorMode >> LAZY_RADIAL_DATA = Lazy .of (() ->
72+ private static final Lazy <RadialData <ConfiguratorMode >> LAZY_RADIAL_DATA = Lazy .of (() ->
7173 IRadialDataHelper .INSTANCE .dataForEnum (Mekanism .rl ("configurator_mode" ), ConfiguratorMode .class ));
7274
7375 public ItemConfigurator (Properties properties ) {
@@ -88,6 +90,30 @@ public Component getName(@NotNull ItemStack stack) {
8890 return TextComponentUtil .build (EnumColor .AQUA , super .getName (stack ));
8991 }
9092
93+ @ Override
94+ public boolean canPerformAction (@ NotNull ItemStack stack , @ NotNull ItemAbility action ) {
95+ if (action == MekanismItemAbilities .WRENCH_CONFIGURE ) {
96+ return getMode (stack ).isConfigurating ();
97+ } else if (action == MekanismItemAbilities .WRENCH_CONFIGURE_CHEMICALS ) {
98+ return getMode (stack ) == ConfiguratorMode .CONFIGURATE_CHEMICALS ;
99+ } else if (action == MekanismItemAbilities .WRENCH_CONFIGURE_ENERGY ) {
100+ return getMode (stack ) == ConfiguratorMode .CONFIGURATE_ENERGY ;
101+ } else if (action == MekanismItemAbilities .WRENCH_CONFIGURE_FLUIDS ) {
102+ return getMode (stack ) == ConfiguratorMode .CONFIGURATE_FLUIDS ;
103+ } else if (action == MekanismItemAbilities .WRENCH_CONFIGURE_HEAT ) {
104+ return getMode (stack ) == ConfiguratorMode .CONFIGURATE_HEAT ;
105+ } else if (action == MekanismItemAbilities .WRENCH_CONFIGURE_ITEMS ) {
106+ return getMode (stack ) == ConfiguratorMode .CONFIGURATE_ITEMS ;
107+ } else if (action == MekanismItemAbilities .WRENCH_DISMANTLE ) {
108+ return getMode (stack ) == ConfiguratorMode .WRENCH ;
109+ } else if (action == MekanismItemAbilities .WRENCH_EMPTY ) {
110+ return getMode (stack ) == ConfiguratorMode .EMPTY ;
111+ } else if (action == MekanismItemAbilities .WRENCH_ROTATE ) {
112+ return getMode (stack ) == ConfiguratorMode .ROTATE ;
113+ }
114+ return super .canPerformAction (stack , action );
115+ }
116+
91117 @ NotNull
92118 @ Override
93119 public InteractionResult useOn (UseOnContext context ) {
0 commit comments