Silk moth nest

This commit is contained in:
paulevsGitch 2020-12-17 12:03:12 +03:00
parent 1ff3d93404
commit 4910c0568e
20 changed files with 122 additions and 11 deletions

View file

@ -18,7 +18,7 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class BlockBrimstone extends BlockBase {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED;
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
public BlockBrimstone() {
super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(MaterialColor.BROWN).ticksRandomly());

View file

@ -44,7 +44,7 @@ import ru.betterend.util.BlocksHelper;
public class BlockHydrothermalVent extends BlockBaseNotFull implements BlockEntityProvider, FluidFillable, Waterloggable {
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED;
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
private static final VoxelShape SHAPE = Block.createCuboidShape(1, 1, 1, 15, 16, 15);
public BlockHydrothermalVent() {

View file

@ -12,7 +12,7 @@ public class BlockProperties {
public static final EnumProperty<PentaShape> PENTA_SHAPE = EnumProperty.of("shape", PentaShape.class);
public static final BooleanProperty HAS_ITEM = BooleanProperty.of("has_item");
public static final BooleanProperty HAS_LIGHT = BooleanProperty.of("has_light");
public static final BooleanProperty ACTIVATED = BooleanProperty.of("active");
public static final BooleanProperty ACTIVE = BooleanProperty.of("active");
public static final IntProperty ROTATION = IntProperty.of("rotation", 0, 3);
public static enum TripleShape implements StringIdentifiable {

View file

@ -0,0 +1,52 @@
package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.BlockBase;
import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable;
public class BlockSilkMothNest extends BlockBase implements IRenderTypeable {
public static final BooleanProperty ACTIVE = BlockProperties.ACTIVE;
public static final DirectionProperty FACING = Properties.HORIZONTAL_FACING;
private static final VoxelShape TOP = createCuboidShape(6, 0, 6, 10, 16, 10);
private static final VoxelShape BOTTOM = createCuboidShape(0, 0, 0, 16, 16, 16);
public BlockSilkMothNest() {
super(FabricBlockSettings.of(Material.WOOL).hardness(0.5F).resistance(0.1F).nonOpaque());
this.setDefaultState(getDefaultState().with(ACTIVE, true));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
stateManager.add(ACTIVE, FACING);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return state.get(ACTIVE) ? BOTTOM : TOP;
}
@Override
public ERenderLayer getRenderLayer() {
return ERenderLayer.CUTOUT;
}
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
Direction dir = ctx.getPlayerFacing().getOpposite();
return this.getDefaultState().with(FACING, dir);
}
}

View file

@ -30,7 +30,7 @@ import ru.betterend.registry.EndItems;
import ru.betterend.rituals.EternalRitual;
public class EternalPedestal extends BlockPedestal {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED;
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
public EternalPedestal() {
super(EndBlocks.FLAVOLITE_RUNED_ETERNAL);

View file

@ -10,7 +10,7 @@ import ru.betterend.blocks.basis.BlockBase;
import ru.betterend.registry.EndBlocks;
public class RunedFlavolite extends BlockBase {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED;
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
public RunedFlavolite() {
super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished).resistance(Blocks.OBSIDIAN.getBlastResistance()).luminance(state -> {

View file

@ -57,6 +57,7 @@ import ru.betterend.blocks.BlockPythadendronSapling;
import ru.betterend.blocks.BlockRespawnObelisk;
import ru.betterend.blocks.BlockShadowBerry;
import ru.betterend.blocks.BlockShadowGrass;
import ru.betterend.blocks.BlockSilkMothNest;
import ru.betterend.blocks.BlockSulphurCrystal;
import ru.betterend.blocks.BlockTenaneaFlowers;
import ru.betterend.blocks.BlockTenaneaSapling;
@ -235,6 +236,9 @@ public class EndBlocks {
public static final Block BULB_VINE_SEED = registerBlock("bulb_vine_seed", new BlockBulbVineSeed());
public static final Block BULB_VINE = registerBlock("bulb_vine", new BlockBulbVine());
// Mob-Related
public static final Block SILK_MOTH_NEST = registerBlock("silk_moth_nest", new BlockSilkMothNest());
// Ores //
public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(EndItems.ENDER_SHARD, 1, 3, 5));
public static final Block AMBER_ORE = registerBlock("amber_ore", new BlockOre(EndItems.RAW_AMBER, 1, 2, 4));

View file

@ -56,7 +56,7 @@ public class EternalRitual {
private final static Block PEDESTAL = EndBlocks.ETERNAL_PEDESTAL;
private final static Block FRAME = EndBlocks.FLAVOLITE_RUNED_ETERNAL;
private final static Block PORTAL = EndBlocks.END_PORTAL_BLOCK;
private final static BooleanProperty ACTIVE = BlockProperties.ACTIVATED;
private final static BooleanProperty ACTIVE = BlockProperties.ACTIVE;
private World world;
private Direction.Axis axis;

View file

@ -45,7 +45,7 @@ public class SulphurHillFeature extends DefaultFeature {
int max = radius + 4;
Mutable mut = new Mutable();
BlockState rock = EndBlocks.SULPHURIC_ROCK.stone.getDefaultState();
BlockState brimstone = EndBlocks.BRIMSTONE.getDefaultState().with(BlockProperties.ACTIVATED, true);
BlockState brimstone = EndBlocks.BRIMSTONE.getDefaultState().with(BlockProperties.ACTIVE, true);
for (int x = min; x < max; x++) {
int x2 = x * x;
int px = pos.getX() + x;

View file

@ -156,7 +156,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
private void placeBrimstone(StructureWorldAccess world, BlockPos pos, Random random) {
BlockState state = getBrimstone(world, pos);
BlocksHelper.setWithoutUpdate(world, pos, state);
if (state.get(BlockProperties.ACTIVATED)) {
if (state.get(BlockProperties.ACTIVE)) {
makeShards(world, pos, random);
}
}
@ -164,7 +164,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
private BlockState getBrimstone(StructureWorldAccess world, BlockPos pos) {
for (Direction dir: BlocksHelper.DIRECTIONS) {
if (world.getBlockState(pos.offset(dir)).isOf(Blocks.WATER)) {
return EndBlocks.BRIMSTONE.getDefaultState().with(BlockProperties.ACTIVATED, true);
return EndBlocks.BRIMSTONE.getDefaultState().with(BlockProperties.ACTIVE, true);
}
}
return EndBlocks.BRIMSTONE.getDefaultState();

View file

@ -176,7 +176,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
private void placeBrimstone(StructureWorldAccess world, BlockPos pos, Random random) {
BlockState state = getBrimstone(world, pos);
BlocksHelper.setWithoutUpdate(world, pos, state);
if (state.get(BlockProperties.ACTIVATED)) {
if (state.get(BlockProperties.ACTIVE)) {
makeShards(world, pos, random);
}
}
@ -184,7 +184,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
private BlockState getBrimstone(StructureWorldAccess world, BlockPos pos) {
for (Direction dir: BlocksHelper.DIRECTIONS) {
if (world.getBlockState(pos.offset(dir)).isOf(Blocks.WATER)) {
return EndBlocks.BRIMSTONE.getDefaultState().with(BlockProperties.ACTIVATED, true);
return EndBlocks.BRIMSTONE.getDefaultState().with(BlockProperties.ACTIVE, true);
}
}
return EndBlocks.BRIMSTONE.getDefaultState();

View file

@ -0,0 +1,9 @@
{
"variants": {
"active=false": { "model": "betterend:block/silk_moth_nest_top" },
"active=true,facing=north": { "model": "betterend:block/silk_moth_nest_bottom" },
"active=true,facing=south": { "model": "betterend:block/silk_moth_nest_bottom", "y": 180 },
"active=true,facing=east": { "model": "betterend:block/silk_moth_nest_bottom", "y": 90 },
"active=true,facing=west": { "model": "betterend:block/silk_moth_nest_bottom", "y": 270 }
}
}

View file

@ -0,0 +1,37 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"parent": "block/block",
"textures": {
"particle": "betterend:block/silk_moth_nest_side",
"texture": "betterend:block/silk_moth_nest_side",
"top": "betterend:block/silk_moth_nest_top",
"front": "betterend:block/silk_moth_nest_front"
},
"elements": [
{
"__comment": "Box1",
"from": [ 0, 0, 0 ],
"to": [ 16, 12, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top" },
"north": { "uv": [ 0, 4, 16, 16 ], "texture": "#texture", "cullface": "north" },
"south": { "uv": [ 0, 4, 16, 16 ], "texture": "#front", "cullface": "south" },
"west": { "uv": [ 0, 4, 16, 16 ], "texture": "#texture", "cullface": "west" },
"east": { "uv": [ 0, 4, 16, 16 ], "texture": "#texture", "cullface": "east" }
}
},
{
"__comment": "Box1",
"from": [ 3, 12, 3 ],
"to": [ 13, 16, 13 ],
"faces": {
"up": { "uv": [ 3, 3, 13, 13 ], "texture": "#top", "cullface": "up" },
"north": { "uv": [ 3, 0, 13, 4 ], "texture": "#texture" },
"south": { "uv": [ 3, 0, 13, 4 ], "texture": "#texture" },
"west": { "uv": [ 3, 0, 13, 4 ], "texture": "#texture" },
"east": { "uv": [ 3, 0, 13, 4 ], "texture": "#texture" }
}
}
]
}

View file

@ -0,0 +1,6 @@
{
"parent": "betterend:block/cross_no_distortion",
"textures": {
"texture": "betterend:block/silk_moth_nest_connect"
}
}

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B