1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-24 10:27:38 +00:00

Allow placing items against some blocks

We define a tag which allows specifying which blocks can be used. Right
now this is is just cauldrons and hives, as they have "placing into"
semantics.

Closes #1305. Many thanks to Lindsay-Needs-Sleep for their initial work
on this!

Fixes #1008. I believe also fixes #854.
This commit is contained in:
Jonathan Coates
2023-03-04 18:17:23 +00:00
parent 566315947b
commit 118d04f018
12 changed files with 65 additions and 33 deletions

View File

@@ -14,6 +14,8 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
/**
* Tags provided by ComputerCraft.
@@ -65,6 +67,12 @@ public class ComputerCraftTags {
*/
public static final TagKey<Block> TURTLE_HOE_BREAKABLE = make("turtle_hoe_harvestable");
/**
* Block which can be {@linkplain BlockState#use(Level, Player, InteractionHand, BlockHitResult) used} when
* calling {@code turtle.place()}.
*/
public static final TagKey<Block> TURTLE_CAN_USE = make("turtle_can_use");
private static TagKey<Block> make(String name) {
return TagKey.create(Registries.BLOCK, new ResourceLocation(ComputerCraftAPI.MOD_ID, name));
}