Skip to content

Commit

Permalink
Make redstone chargers repairable using redstone
Browse files Browse the repository at this point in the history
Wonder if this should use a tag...
  • Loading branch information
KnightMiner committed Dec 27, 2019
1 parent 401839b commit 1ae8378
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.Items;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory;
Expand All @@ -30,9 +31,6 @@ public RedstoneChargerItem() {
);
}

/**
* Called when a Block is right-clicked with this Item
*/
@Nonnull
@Override
public ActionResultType onItemUse(ItemUseContext context) {
Expand Down Expand Up @@ -76,4 +74,9 @@ public ActionResultType onItemUse(ItemUseContext context) {
stack.damageItem(1, context.getPlayer(), player -> player.sendBreakAnimation(context.getHand()));
return ActionResultType.SUCCESS;
}

@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
return repair.getItem() == Items.REDSTONE;
}
}

2 comments on commit 1ae8378

@TeamSpen210
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forge has a forge:dusts/redstone tag, though I assume you mean a specific one for charger repairs.

@KnightMiner
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a specific tag would be better, but have it default to the forge one. I saw one modpack that changed the charger recipe and they may wish to change the charger repair material

Please sign in to comment.