Infusion pedestal (WIP), fix for #11

This commit is contained in:
Aleksey 2020-11-05 22:51:36 +03:00
parent 70f5e3e024
commit 36fa1ade9d
20 changed files with 220 additions and 21 deletions

BIN
psd/infusion_pedestal.psd Normal file

Binary file not shown.

View file

@ -33,21 +33,27 @@ public class BlockProperties {
}
public static enum PedestalState implements StringIdentifiable {
PEDESTAL_TOP,
COLUMN_TOP,
BOTTOM,
PILLAR,
COLUMN,
DEFAULT;
PEDESTAL_TOP("pedestal_top"),
COLUMN_TOP("column_top"),
BOTTOM("bottom"),
PILLAR("pillar"),
COLUMN("column"),
DEFAULT("default");
private final String name;
PedestalState(String name) {
this.name = name;
}
@Override
public String asString() {
return this.name().toLowerCase();
return this.name;
}
@Override
public String toString() {
return this.asString();
return this.name;
}
}
}

View file

@ -1,12 +1,22 @@
package ru.betterend.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.BlockPedestal;
import ru.betterend.blocks.entities.InfusionPedestalEntity;
public class InfusionPedestal extends BlockPedestal {
public InfusionPedestal(Block parent) {
super(parent);
public InfusionPedestal() {
super(Blocks.OBSIDIAN);
this.height = 1.1F;
}
@Override
public BlockEntity createBlockEntity(BlockView world) {
return new InfusionPedestalEntity();
}
}

View file

@ -78,6 +78,7 @@ public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvid
}
protected final Block parent;
protected float height = 1.0F;
public BlockPedestal(Block parent) {
super(FabricBlockSettings.copyOf(parent));
@ -85,6 +86,13 @@ public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvid
this.parent = parent;
}
public float getHeight(BlockState state) {
if (state.getBlock() instanceof BlockPedestal && state.get(STATE) == PedestalState.PEDESTAL_TOP) {
return this.height - 0.2F;
}
return this.height;
}
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (world.isClient || !state.isOf(this)) return ActionResult.CONSUME;

View file

@ -2,6 +2,7 @@ package ru.betterend.blocks.entities.render;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer;
@ -19,7 +20,7 @@ import net.minecraft.item.Items;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import ru.betterend.blocks.BlockProperties.PedestalState;
import ru.betterend.blocks.EternalPedestal;
import ru.betterend.blocks.basis.BlockPedestal;
import ru.betterend.blocks.entities.PedestalBlockEntity;
@ -46,12 +47,9 @@ public class PedestalItemRenderer extends BlockEntityRenderer<PedestalBlockEntit
MinecraftClient minecraft = MinecraftClient.getInstance();
BakedModel model = minecraft.getItemRenderer().getHeldItemModel(activeItem, blockEntity.getWorld(), null);
Vector3f translate = model.getTransformation().ground.translation;
BlockPedestal pedestal = (BlockPedestal) state.getBlock();
matrices.translate(translate.getX(), translate.getY(), translate.getZ());
if (state.get(BlockPedestal.STATE) == PedestalState.DEFAULT) {
matrices.translate(0.5, 1.0, 0.5);
} else {
matrices.translate(0.5, 0.8, 0.5);
}
matrices.translate(0.5, pedestal.getHeight(state), 0.5);
if (activeItem.getItem() instanceof BlockItem) {
matrices.scale(1.5F, 1.5F, 1.5F);
} else {

View file

@ -20,6 +20,7 @@ import ru.betterend.blocks.entities.EChestBlockEntity;
import ru.betterend.blocks.entities.ESignBlockEntity;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
import ru.betterend.blocks.entities.EternalPedestalEntity;
import ru.betterend.blocks.entities.InfusionPedestalEntity;
import ru.betterend.blocks.entities.PedestalBlockEntity;
public class EndBlockEntities {
@ -29,6 +30,8 @@ public class EndBlockEntities {
BlockEntityType.Builder.create(PedestalBlockEntity::new, getPedestals()));
public final static BlockEntityType<PedestalBlockEntity> ETERNAL_PEDESTAL = registerBlockEntity("eternal_pedestal",
BlockEntityType.Builder.create(EternalPedestalEntity::new, EndBlocks.ETERNAL_PEDESTAL));
public final static BlockEntityType<PedestalBlockEntity> INFUSION_PEDESTAL = registerBlockEntity("infusion_pedestal",
BlockEntityType.Builder.create(InfusionPedestalEntity::new, EndBlocks.INFUSION_PEDESTAL));
public static final BlockEntityType<EChestBlockEntity> CHEST = registerBlockEntity("chest",
BlockEntityType.Builder.create(EChestBlockEntity::new, getChests()));
public static final BlockEntityType<EBarrelBlockEntity> BARREL = registerBlockEntity("barrel",

View file

@ -43,6 +43,7 @@ import ru.betterend.blocks.EndStoneSmelter;
import ru.betterend.blocks.EnderBlock;
import ru.betterend.blocks.EternalPedestal;
import ru.betterend.blocks.EternalRunedFlavolite;
import ru.betterend.blocks.InfusionPedestal;
import ru.betterend.blocks.PedestalVanilla;
import ru.betterend.blocks.RunedFlavolite;
import ru.betterend.blocks.TerminiteBlock;
@ -158,6 +159,7 @@ public class EndBlocks {
// Blocks With Entity //
public static final Block END_STONE_SMELTER = registerBlock("end_stone_smelter", new EndStoneSmelter());
public static final Block ETERNAL_PEDESTAL = registerBlock("eternal_pedestal", new EternalPedestal());
public static final Block INFUSION_PEDESTAL = registerBlock("infusion_pedestal", new InfusionPedestal());
//Technical
public static final Block END_PORTAL_BLOCK = registerBlock("end_portal_block", new EndPortalBlock());

View file

@ -3,11 +3,9 @@ package ru.betterend.rituals;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Tickable;
public class InfusionRitual implements Tickable, Inventory {
public class InfusionRitual implements Inventory {
@Override
public void tick() {
// TODO
}

View file

@ -0,0 +1,22 @@
{
"variants": {
"state=default": {
"model": "betterend:block/infusion_pedestal_default"
},
"state=pedestal_top": {
"model": "betterend:block/infusion_pedestal_top"
},
"state=column": {
"model": "betterend:block/infusion_pedestal_column"
},
"state=column_top": {
"model": "betterend:block/infusion_pedestal_column_top"
},
"state=bottom": {
"model": "betterend:block/infusion_pedestal_bottom"
},
"state=pillar": {
"model": "betterend:block/infusion_pedestal_pillar"
}
}
}

View file

@ -0,0 +1,8 @@
{
"parent": "betterend:block/pedestal_bottom",
"textures": {
"base": "betterend:block/infusion_pedestal_base",
"pillar": "betterend:block/infusion_pedestal_pillar",
"bottom": "betterend:block/infusion_pedestal_base"
}
}

View file

@ -0,0 +1,8 @@
{
"parent": "betterend:block/pedestal_column",
"textures": {
"base": "betterend:block/infusion_pedestal_base",
"pillar": "betterend:block/infusion_pedestal_pillar",
"bottom": "betterend:block/infusion_pedestal_base"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "betterend:block/pedestal_column_top",
"textures": {
"base": "betterend:block/infusion_pedestal_base",
"pillar": "betterend:block/infusion_pedestal_pillar"
}
}

View file

@ -0,0 +1,73 @@
{
"parent": "minecraft:block/block",
"textures": {
"top": "betterend:block/infusion_pedestal_top",
"base": "betterend:block/infusion_pedestal_base",
"pillar": "betterend:block/infusion_pedestal_pillar",
"bottom": "betterend:block/infusion_pedestal_base",
"particle": "#base"
},
"elements": [
{
"__comment": "eye",
"from": [ 4, 15, 4 ],
"to": [ 12, 16, 12 ],
"faces": {
"up": { "uv": [ 4, 4, 12, 12 ], "texture": "#top" },
"north": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" },
"south": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" },
"west": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" },
"east": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" }
}
},
{
"__comment": "basin_1",
"from": [ 0, 0, 0 ],
"to": [ 16, 3, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom" },
"north": { "uv": [ 0, 0, 16, 3 ], "texture": "#bottom" },
"south": { "uv": [ 0, 0, 16, 3 ], "texture": "#bottom" },
"west": { "uv": [ 0, 0, 16, 3 ], "texture": "#bottom" },
"east": { "uv": [ 0, 0, 16, 3 ], "texture": "#bottom" }
}
},
{
"__comment": "basin_2",
"from": [ 2, 3, 2 ],
"to": [ 14, 4, 14 ],
"faces": {
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#bottom" },
"north": { "uv": [ 3, 3, 14, 4 ], "texture": "#bottom" },
"south": { "uv": [ 3, 3, 14, 4 ], "texture": "#bottom" },
"west": { "uv": [ 3, 3, 14, 4 ], "texture": "#bottom" },
"east": { "uv": [ 3, 3, 14, 4 ], "texture": "#bottom" }
}
},
{
"__comment": "pillar",
"from": [ 3, 4, 3 ],
"to": [ 13, 13, 13 ],
"faces": {
"north": { "uv": [ 3, 4, 13, 13 ], "texture": "#pillar" },
"south": { "uv": [ 3, 4, 13, 13 ], "texture": "#pillar" },
"west": { "uv": [ 3, 4, 13, 13 ], "texture": "#pillar" },
"east": { "uv": [ 3, 4, 13, 13 ], "texture": "#pillar" }
}
},
{
"__comment": "top",
"from": [ 1, 13, 1 ],
"to": [ 15, 15, 15 ],
"faces": {
"down": { "uv": [ 1, 1, 15, 15 ], "texture": "#base" },
"up": { "uv": [ 1, 1, 15, 15 ], "texture": "#top" },
"north": { "uv": [ 1, 14, 15, 16 ], "texture": "#top" },
"south": { "uv": [ 1, 14, 15, 16 ], "texture": "#top" },
"west": { "uv": [ 1, 14, 15, 16 ], "texture": "#top" },
"east": { "uv": [ 15, 16, 1, 14 ], "texture": "#top" }
}
}
]
}

View file

@ -0,0 +1,6 @@
{
"parent": "betterend:block/pedestal_pillar",
"textures": {
"pillar": "betterend:block/infusion_pedestal_pillar"
}
}

View file

@ -0,0 +1,47 @@
{
"parent": "minecraft:block/block",
"textures": {
"top": "betterend:block/infusion_pedestal_top",
"base": "betterend:block/infusion_pedestal_base",
"pillar": "betterend:block/infusion_pedestal_pillar",
"particle": "#base"
},
"elements": [
{
"__comment": "eye",
"from": [ 4, 10, 4 ],
"to": [ 12, 11, 12 ],
"faces": {
"up": { "uv": [ 4, 4, 12, 12 ], "texture": "#top" },
"north": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" },
"south": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" },
"west": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" },
"east": { "uv": [ 4, 4, 12, 5 ], "texture": "#top" }
}
},
{
"__comment": "pillar",
"from": [ 3, 0, 3 ],
"to": [ 13, 8, 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" }
}
},
{
"__comment": "top",
"from": [ 1, 8, 1 ],
"to": [ 15, 10, 15 ],
"faces": {
"down": { "uv": [ 1, 1, 15, 15 ], "texture": "#base" },
"up": { "uv": [ 1, 1, 15, 15 ], "texture": "#top" },
"north": { "uv": [ 1, 14, 15, 16 ], "texture": "#top" },
"south": { "uv": [ 1, 14, 15, 16 ], "texture": "#top" },
"west": { "uv": [ 1, 14, 15, 16 ], "texture": "#top" },
"east": { "uv": [ 15, 16, 1, 14 ], "texture": "#top" }
}
}
]
}

View file

@ -3,7 +3,7 @@
"textures": {
"particle": "#base"
},
"elements": [
"elements": [
{
"__comment": "basin_1",
"from": [ 0, 0, 0 ],

View file

@ -0,0 +1,3 @@
{
"parent": "betterend:block/infusion_pedestal_default"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B