mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Validate stripping recipe before adding
This commit is contained in:
@@ -3,6 +3,7 @@ package dev.architectury.hooks.item.tool;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.world.item.AxeItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.RotatedPillarBlock;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -11,6 +12,10 @@ public final class AxeItemHooks {
|
||||
}
|
||||
|
||||
public static void addStrippingRecipe(Block src, Block dst) {
|
||||
if (!src.defaultBlockState().hasProperty(RotatedPillarBlock.AXIS))
|
||||
throw new IllegalArgumentException("Source block is missing required 'AXIS' property!");
|
||||
if (!dst.defaultBlockState().hasProperty(RotatedPillarBlock.AXIS))
|
||||
throw new IllegalArgumentException("Destination block is missing required 'AXIS' property!");
|
||||
if (AxeItem.STRIPPABLES instanceof ImmutableMap) {
|
||||
AxeItem.STRIPPABLES = new HashMap<>(AxeItem.STRIPPABLES);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user