mirror of
https://github.com/architectury/architectury-api.git
synced 2026-04-02 05:27:42 -05:00
Add tool interaction recipe hooks
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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 java.util.HashMap;
|
||||
|
||||
public final class AxeItemHooks {
|
||||
private AxeItemHooks() {
|
||||
}
|
||||
|
||||
public static void addStrippingRecipe(Block src, Block dst) {
|
||||
if (AxeItem.STRIPPABLES instanceof ImmutableMap) {
|
||||
AxeItem.STRIPPABLES = new HashMap<>(AxeItem.STRIPPABLES);
|
||||
}
|
||||
AxeItem.STRIPPABLES.put(src, dst);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package dev.architectury.hooks.item.tool;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.world.item.HoeItem;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class HoeItemHooks {
|
||||
private HoeItemHooks() {
|
||||
}
|
||||
|
||||
public static void addTillingRecipe(Block src, Predicate<UseOnContext> predicate, Consumer<UseOnContext> action) {
|
||||
if (HoeItem.TILLABLES instanceof ImmutableMap) {
|
||||
HoeItem.TILLABLES = new HashMap<>(HoeItem.TILLABLES);
|
||||
}
|
||||
HoeItem.TILLABLES.put(src, new Pair<>(predicate, action));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package dev.architectury.hooks.item.tool;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.world.item.ShovelItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class ShovelItemHooks {
|
||||
private ShovelItemHooks() {
|
||||
}
|
||||
|
||||
public static void addFlatteningRecipe(Block src, BlockState dst) {
|
||||
if (ShovelItem.FLATTENABLES instanceof ImmutableMap) {
|
||||
ShovelItem.FLATTENABLES = new HashMap<>(ShovelItem.FLATTENABLES);
|
||||
}
|
||||
ShovelItem.FLATTENABLES.put(src, dst);
|
||||
}
|
||||
}
|
||||
@@ -40,4 +40,10 @@ mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditio
|
||||
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional;
|
||||
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional;
|
||||
accessible method net/minecraft/world/level/storage/LevelResource <init> (Ljava/lang/String;)V
|
||||
accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier
|
||||
accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier
|
||||
accessible field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map;
|
||||
mutable field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map;
|
||||
accessible field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map;
|
||||
mutable field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map;
|
||||
accessible field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map;
|
||||
mutable field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map;
|
||||
Reference in New Issue
Block a user