Crafring recipe

This commit is contained in:
paulevsGitch 2020-12-14 21:39:57 +03:00
parent 2670149cab
commit bc403d9a7d
2 changed files with 9 additions and 2 deletions

View file

@ -157,7 +157,7 @@ public class BlockRespawnObelisk extends BlockBase implements IColorProvider, IR
@Override @Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
ItemStack itemStack = player.getStackInHand(hand); ItemStack itemStack = player.getStackInHand(hand);
boolean canActivate = itemStack.getItem() == EndItems.AMBER_GEM && itemStack.getCount() > 3; boolean canActivate = itemStack.getItem() == EndItems.AMBER_GEM && itemStack.getCount() > 5;
if (hand != Hand.MAIN_HAND || !canActivate) { if (hand != Hand.MAIN_HAND || !canActivate) {
if (!world.isClient && !(itemStack.getItem() instanceof BlockItem)) { if (!world.isClient && !(itemStack.getItem() instanceof BlockItem)) {
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) player; ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) player;
@ -171,7 +171,7 @@ public class BlockRespawnObelisk extends BlockBase implements IColorProvider, IR
serverPlayerEntity.sendMessage(new TranslatableText("message.betterend.set_spawn"), true); serverPlayerEntity.sendMessage(new TranslatableText("message.betterend.set_spawn"), true);
world.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.BLOCK_RESPAWN_ANCHOR_SET_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F); world.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.BLOCK_RESPAWN_ANCHOR_SET_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F);
if (!player.isCreative()) { if (!player.isCreative()) {
itemStack.decrement(4); itemStack.decrement(6);
} }
} }
return player.isCreative() ? ActionResult.PASS : ActionResult.success(world.isClient); return player.isCreative() ? ActionResult.PASS : ActionResult.success(world.isClient);

View file

@ -159,6 +159,13 @@ public class CraftingRecipes {
GridRecipe.make("charnia_orange_dye", Items.ORANGE_DYE).setList("#").addMaterial('#', EndBlocks.CHARNIA_ORANGE).build(); GridRecipe.make("charnia_orange_dye", Items.ORANGE_DYE).setList("#").addMaterial('#', EndBlocks.CHARNIA_ORANGE).build();
GridRecipe.make("charnia_purple_dye", Items.PURPLE_DYE).setList("#").addMaterial('#', EndBlocks.CHARNIA_PURPLE).build(); GridRecipe.make("charnia_purple_dye", Items.PURPLE_DYE).setList("#").addMaterial('#', EndBlocks.CHARNIA_PURPLE).build();
GridRecipe.make("charnia_red_dye", Items.RED_DYE).setList("#").addMaterial('#', EndBlocks.CHARNIA_RED).build(); GridRecipe.make("charnia_red_dye", Items.RED_DYE).setList("#").addMaterial('#', EndBlocks.CHARNIA_RED).build();
GridRecipe.make("respawn_obelisk", EndBlocks.RESPAWN_OBELISK)
.setShape("CSC", "CSC", "AAA")
.addMaterial('C', EndBlocks.AURORA_CRYSTAL)
.addMaterial('S', EndItems.ETERNAL_CRYSTAL)
.addMaterial('A', EndBlocks.AMBER_BLOCK)
.build();
} }
private static void registerLantern(String name, Block lantern, Block slab) { private static void registerLantern(String name, Block lantern, Block slab) {