Skip to content

Commit

Permalink
tweak some paxel code
Browse files Browse the repository at this point in the history
  • Loading branch information
thiakil committed Nov 14, 2023
1 parent e145b90 commit 22123d9
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/tools/java/mekanism/tools/common/item/ItemMekanismPaxel.java
Expand Up @@ -2,7 +2,11 @@

import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Set;
import javax.annotation.ParametersAreNonnullByDefault;
import mekanism.common.lib.attribute.AttributeCache;
import mekanism.common.lib.attribute.IAttributeRefresher;
import mekanism.tools.common.IHasRepairType;
Expand Down Expand Up @@ -42,9 +46,18 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@ParametersAreNonnullByDefault
public class ItemMekanismPaxel extends AxeItem implements IHasRepairType, IAttributeRefresher {

private static final ToolAction PAXEL_DIG = ToolAction.get("paxel_dig");
private static final Set<ToolAction> PAXEL_ACTIONS = Collections.newSetFromMap(new IdentityHashMap<>());

static {
PAXEL_ACTIONS.add(PAXEL_DIG);
PAXEL_ACTIONS.addAll(ToolActions.DEFAULT_PICKAXE_ACTIONS);
PAXEL_ACTIONS.addAll(ToolActions.DEFAULT_SHOVEL_ACTIONS);
PAXEL_ACTIONS.addAll(ToolActions.DEFAULT_AXE_ACTIONS);
}

private final IPaxelMaterial material;
private final AttributeCache attributeCache;
Expand Down Expand Up @@ -75,8 +88,7 @@ public float getAttackDamage() {

@Override
public boolean canPerformAction(ItemStack stack, ToolAction action) {
return action == PAXEL_DIG || ToolActions.DEFAULT_PICKAXE_ACTIONS.contains(action) ||
ToolActions.DEFAULT_SHOVEL_ACTIONS.contains(action) || super.canPerformAction(stack, action);
return PAXEL_ACTIONS.contains(action);
}

@Override
Expand Down Expand Up @@ -177,6 +189,6 @@ public boolean isCorrectToolForDrops(BlockState state) {

@Override
public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) {
return state.is(ToolsTags.Blocks.MINEABLE_WITH_PAXEL) && TierSortingRegistry.isCorrectTierForDrops(getTier(), state);
return this.isCorrectToolForDrops(state);
}
}

0 comments on commit 22123d9

Please sign in to comment.