Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var tinBlock = VanillaFactory.createItem("tin_block");
- tinBlock.creativeTab = metalCrafts;
- tinBlock.onItemUse = function(player, world, pos, hand, facing, blockHit) {
- var blockPos = pos;
- var blockPosUp = pos.getOffset(facing, 1);
- if (world.getBlockState(blockPos) == <block:minecraft:cauldron:3>) {
- world.setBlockState(<block:minecraft:cauldron:2>, blockPos);
- Commands.call("playsound minecraft:block.fire.extinguish block @p", player, world, false, true);
- Commands.call("give @p contenttweaker:tin_block 1", player, world, false, true);
- player.getHeldItem(hand).shrink(1);
- return ActionResult.success();
- }
- else {
- world.setBlockState(<block:minecraft:stone>, blockPosUp);
- Commands.call("playsound minecraft:block.metal.place block @p", player, world, false, true);
- player.getHeldItem(hand).shrink(1);
- }
- if (world.getBlockState(blockPos) == <block:minecraft:cauldron:2>) {
- world.setBlockState(<block:minecraft:cauldron:1>, blockPos);
- Commands.call("playsound minecraft:block.fire.extinguish block @p", player, world, false, true);
- Commands.call("give @p contenttweaker:tin_block 1", player, world, false, true);
- player.getHeldItem(hand).shrink(1);
- return ActionResult.success();
- }
- if (world.getBlockState(blockPos) == <block:minecraft:cauldron:1>) {
- world.setBlockState(<block:minecraft:cauldron>, blockPos);
- Commands.call("playsound minecraft:block.fire.extinguish block @p", player, world, false, true);
- Commands.call("give @p contenttweaker:tin_block 1", player, world, false, true);
- player.getHeldItem(hand).shrink(1);
- return ActionResult.success();
- }
- return ActionResult.pass();
- };
- tinBlock.register();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement