mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 13:42:59 +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:
		| @@ -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)); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jonathan Coates
					Jonathan Coates