Add tool action to firestarter
@@ -22,6 +22,7 @@ import net.minecraft.world.level.block.CampfireBlock;
import net.minecraft.world.level.block.TntBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
+import net.minecraftforge.common.ToolAction;
import slimeknights.tconstruct.library.modifiers.impl.InteractionModifier;
import slimeknights.tconstruct.library.tools.definition.aoe.CircleAOEIterator;
import slimeknights.tconstruct.library.tools.definition.aoe.IAreaOfEffectIterator;
@@ -37,6 +38,9 @@ import java.util.Collections;
*/
@RequiredArgsConstructor
public class FirestarterModifier extends InteractionModifier.SingleUse {
+ /** Compat with mods adding custom campfires */
+ private static final ToolAction LIGHT_CAMPFIRE = ToolAction.get("light_campfire");
+
@Getter
private final int priority;
@@ -45,6 +49,11 @@ public class FirestarterModifier extends InteractionModifier.SingleUse {
return priority > Short.MIN_VALUE;
}
+ @Override
+ public boolean canPerformAction(IToolStackView tool, int level, ToolAction toolAction) {
+ return toolAction == LIGHT_CAMPFIRE;
+ }
+
@Override
public InteractionResult afterEntityUse(IToolStackView tool, int level, Player player, LivingEntity target, InteractionHand hand, EquipmentSlot slotType) {
if (target instanceof Creeper creeper) {
