From e96d06337e4cb3ff2369e5983740bee918402540 Mon Sep 17 00:00:00 2001 From: Aleksey Date: Sat, 7 Nov 2020 14:32:39 +0300 Subject: [PATCH] Infusion Pedestal --- .../ru/betterend/blocks/InfusionPedestal.java | 44 ++++++++++++++++++- .../ru/betterend/recipe/CraftingRecipes.java | 7 +++ .../assets/betterend/lang/en_us.json | 1 + .../assets/betterend/lang/ru_ru.json | 1 + .../models/block/infusion_pedestal_top.json | 18 ++++---- 5 files changed, 60 insertions(+), 11 deletions(-) diff --git a/src/main/java/ru/betterend/blocks/InfusionPedestal.java b/src/main/java/ru/betterend/blocks/InfusionPedestal.java index cc65f2fd..6c2e5710 100644 --- a/src/main/java/ru/betterend/blocks/InfusionPedestal.java +++ b/src/main/java/ru/betterend/blocks/InfusionPedestal.java @@ -1,21 +1,61 @@ package ru.betterend.blocks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; + import ru.betterend.blocks.basis.BlockPedestal; import ru.betterend.blocks.entities.InfusionPedestalEntity; public class InfusionPedestal extends BlockPedestal { + private static final VoxelShape SHAPE_DEFAULT; + private static final VoxelShape SHAPE_PEDESTAL_TOP; public InfusionPedestal() { super(Blocks.OBSIDIAN); - this.height = 1.1F; + this.height = 1.08F; } @Override public BlockEntity createBlockEntity(BlockView world) { return new InfusionPedestalEntity(); } - + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + if (state.isOf(this)) { + switch(state.get(STATE)) { + case PEDESTAL_TOP: { + return SHAPE_PEDESTAL_TOP; + } + case DEFAULT: { + return SHAPE_DEFAULT; + } + default: { + return super.getOutlineShape(state, world, pos, context); + } + } + } + return super.getOutlineShape(state, world, pos, context); + } + + static { + VoxelShape basinUp = Block.createCuboidShape(2, 3, 2, 14, 4, 14); + VoxelShape basinDown = Block.createCuboidShape(0, 0, 0, 16, 3, 16); + VoxelShape pedestalTop = Block.createCuboidShape(1, 9, 1, 15, 11, 15); + VoxelShape pedestalDefault = Block.createCuboidShape(1, 13, 1, 15, 15, 15); + VoxelShape pillar = Block.createCuboidShape(3, 0, 3, 13, 9, 13); + VoxelShape pillarDefault = Block.createCuboidShape(3, 4, 3, 13, 13, 13); + VoxelShape eyeDefault = Block.createCuboidShape(4, 15, 4, 12, 16, 12); + VoxelShape eyeTop = Block.createCuboidShape(4, 11, 4, 12, 12, 12); + VoxelShape basin = VoxelShapes.union(basinDown, basinUp); + SHAPE_DEFAULT = VoxelShapes.union(basin, pillarDefault, pedestalDefault, eyeDefault); + SHAPE_PEDESTAL_TOP = VoxelShapes.union(pillar, pedestalTop, eyeTop); + } } diff --git a/src/main/java/ru/betterend/recipe/CraftingRecipes.java b/src/main/java/ru/betterend/recipe/CraftingRecipes.java index c9507b9d..85307d89 100644 --- a/src/main/java/ru/betterend/recipe/CraftingRecipes.java +++ b/src/main/java/ru/betterend/recipe/CraftingRecipes.java @@ -33,6 +33,13 @@ public class CraftingRecipes { registerPedestal("quartz_pedestal", EndBlocks.QUARTZ_PEDESTAL, Blocks.QUARTZ_SLAB, Blocks.QUARTZ_PILLAR); registerPedestal("purpur_pedestal", EndBlocks.PURPUR_PEDESTAL, Blocks.PURPUR_SLAB, Blocks.PURPUR_PILLAR); + GridRecipe.make("infusion_pedestal", EndBlocks.INFUSION_PEDESTAL) + .setShape(new String[] { " Y ", "O#O", " # " }) + .addMaterial('O', Items.ENDER_PEARL) + .addMaterial('Y', Items.ENDER_EYE) + .addMaterial('#', Blocks.OBSIDIAN) + .build(); + String material = "terminite"; GridRecipe.make(material + "_block", EndBlocks.TERMINITE_BLOCK) .setShape(new String[] { "III", "III", "III" }) diff --git a/src/main/resources/assets/betterend/lang/en_us.json b/src/main/resources/assets/betterend/lang/en_us.json index 8d22b644..9d7f5c3b 100644 --- a/src/main/resources/assets/betterend/lang/en_us.json +++ b/src/main/resources/assets/betterend/lang/en_us.json @@ -168,6 +168,7 @@ "block.betterend.granite_pedestal": "Granite Pedestal", "block.betterend.purpur_pedestal": "Purpur Pedestal", "block.betterend.quartz_pedestal": "Quartz Pedestal", + "block.betterend.infusion_pedestal": "Infusion Pedestal", "block.betterend.end_lotus_seed": "End Lotus Seed", "block.betterend.end_lotus_stem": "End Lotus Stem", diff --git a/src/main/resources/assets/betterend/lang/ru_ru.json b/src/main/resources/assets/betterend/lang/ru_ru.json index e9b70e27..15201e60 100644 --- a/src/main/resources/assets/betterend/lang/ru_ru.json +++ b/src/main/resources/assets/betterend/lang/ru_ru.json @@ -168,6 +168,7 @@ "block.betterend.granite_pedestal": "Пьедестал из гранита", "block.betterend.purpur_pedestal": "Пьедестал из пурпура", "block.betterend.quartz_pedestal": "Пьедестал из кварца", + "block.betterend.infusion_pedestal": "Пьедестал Наполнения", "block.betterend.end_lotus_seed": "Семя лотоса края", "block.betterend.end_lotus_stem": "Стебель лотоса края", diff --git a/src/main/resources/assets/betterend/models/block/infusion_pedestal_top.json b/src/main/resources/assets/betterend/models/block/infusion_pedestal_top.json index e4f66fc4..2cf01bb9 100644 --- a/src/main/resources/assets/betterend/models/block/infusion_pedestal_top.json +++ b/src/main/resources/assets/betterend/models/block/infusion_pedestal_top.json @@ -9,8 +9,8 @@ "elements": [ { "__comment": "eye", - "from": [ 4, 10, 4 ], - "to": [ 12, 11, 12 ], + "from": [ 4, 11, 4 ], + "to": [ 12, 12, 12 ], "faces": { "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#top" }, "north": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" }, @@ -22,18 +22,18 @@ { "__comment": "pillar", "from": [ 3, 0, 3 ], - "to": [ 13, 8, 13 ], + "to": [ 13, 9, 13 ], "faces": { - "north": { "uv": [ 3, 0, 13, 8 ], "texture": "#pillar" }, - "south": { "uv": [ 3, 0, 13, 8 ], "texture": "#pillar" }, - "west": { "uv": [ 3, 0, 13, 8 ], "texture": "#pillar" }, - "east": { "uv": [ 3, 0, 13, 8 ], "texture": "#pillar" } + "north": { "uv": [ 3, 0, 13, 9 ], "texture": "#pillar" }, + "south": { "uv": [ 3, 0, 13, 9 ], "texture": "#pillar" }, + "west": { "uv": [ 3, 0, 13, 9 ], "texture": "#pillar" }, + "east": { "uv": [ 3, 0, 13, 9 ], "texture": "#pillar" } } }, { "__comment": "top", - "from": [ 1, 8, 1 ], - "to": [ 15, 10, 15 ], + "from": [ 1, 9, 1 ], + "to": [ 15, 11, 15 ], "faces": { "down": { "uv": [ 1, 1, 15, 15 ], "texture": "#base" }, "up": { "uv": [ 1, 1, 15, 15 ], "texture": "#top" },