Skip to content

Commit

Permalink
Metro panel
Browse files Browse the repository at this point in the history
  • Loading branch information
a0a7 committed Sep 25, 2023
1 parent e32f44c commit d3ca0c3
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package systems.alexander.bellsandwhistles.block;

import com.simibubi.create.content.decoration.TrainTrapdoorBlock;
import com.simibubi.create.content.decoration.copycat.CopycatPanelBlock;
import com.simibubi.create.content.decoration.encasing.CasingBlock;
import com.simibubi.create.content.decoration.slidingDoor.SlidingDoorBlock;
import com.tterrag.registrate.builders.BlockBuilder;
Expand Down Expand Up @@ -55,7 +56,6 @@ public static <T extends Block, P> NonNullFunction<BlockBuilder<T, P>, BlockBuil
() -> new SlidingDoorBlock(BlockBehaviour.Properties.copy(Blocks.MOSSY_COBBLESTONE).sound(SoundType.METAL).noOcclusion(), false));
public static final RegistryObject<Block> FOLDING_METRO_DOOR = registerBlock("folding_metro_door",
() -> new SlidingDoorBlock(BlockBehaviour.Properties.copy(Blocks.MOSSY_COBBLESTONE).sound(SoundType.METAL).noOcclusion(), true));

public static final RegistryObject<Block> METRO_TRAPDOOR = registerBlock("metro_trapdoor",
() -> new TrainTrapdoorBlock(BlockBehaviour.Properties.copy(Blocks.MOSSY_COBBLESTONE).sound(SoundType.METAL).noOcclusion()));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package systems.alexander.bellsandwhistles.block.custom;

import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.decoration.copycat.CopycatBlockEntity;
import com.simibubi.create.content.decoration.copycat.CopycatPanelBlock;
import com.simibubi.create.content.decoration.copycat.CopycatSpecialCases;
Expand All @@ -23,22 +24,28 @@
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Half;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

import java.util.List;
import java.util.function.Predicate;

public class PanelBlock extends Block {
public static final DirectionProperty FACING = BlockStateProperties.FACING;

protected static final int AABB_THICKNESS = 3;


private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper());

public PanelBlock(Properties pProperties) {
super(pProperties);
registerDefaultState(defaultBlockState().setValue(FACING, Direction.UP));
}
public static BlockState getMaterial(BlockGetter reader, BlockPos targetPos) {
return Blocks.STONE.defaultBlockState();
return Blocks.MOSSY_COBBLESTONE.defaultBlockState();
}
public boolean canFaceBeOccluded(BlockState state, Direction face) {
return state.getValue(FACING)
Expand Down Expand Up @@ -81,6 +88,10 @@ public boolean hidesNeighborFace(BlockGetter level, BlockPos pos, BlockState sta
}






public static boolean isOccluded(BlockState state, BlockState other, Direction pDirection) {
Direction facing = state.getValue(FACING);
if (facing.getOpposite() == other.getValue(FACING) && pDirection == facing)
Expand All @@ -95,6 +106,12 @@ public BlockState rotate(BlockState state, Rotation rot) {
return state.setValue(FACING, rot.rotate(state.getValue(FACING)));
}

@Override
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
return AllShapes.CASING_3PX.get(pState.getValue(FACING));
}


@Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, Mirror mirrorIn) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"variants": {
"facing=down": {
"model": "bellsandwhistles:block/metro/corrugated_panel/block_bottom",
"x": 180
},
"facing=east": {
"model": "bellsandwhistles:block/metro/corrugated_panel/block_side",
"y": 270
},
"facing=north": {
"model": "bellsandwhistles:block/metro/corrugated_panel/block_side",
"y": 180
},
"facing=south": {
"model": "bellsandwhistles:block/metro/corrugated_panel/block_side"
},
"facing=up": {
"model": "bellsandwhistles:block/metro/corrugated_panel/block_bottom"
},
"facing=west": {
"model": "bellsandwhistles:block/metro/corrugated_panel/block_side",
"y": 90
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"variants": {
"facing=down": {
"model": "bellsandwhistles:block/metro/panel/block_bottom",
"x": 180
},
"facing=east": {
"model": "bellsandwhistles:block/metro/panel/block_side",
"y": 270
},
"facing=north": {
"model": "bellsandwhistles:block/metro/panel/block_side",
"y": 180
},
"facing=south": {
"model": "bellsandwhistles:block/metro/panel/block_side"
},
"facing=up": {
"model": "bellsandwhistles:block/metro/panel/block_bottom"
},
"facing=west": {
"model": "bellsandwhistles:block/metro/panel/block_side",
"y": 90
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "bellsandwhistles:metro/corrugated_metro"
}
"credit": "Made with Blockbench",
"textures": {
"0": "bellsandwhistles:block/metro/corrugated_metro",
"1": "bellsandwhistles:block/metro/metro",
"particle": "bellsandwhistles:block/metro/corrugated_metro"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#0"},
"east": {"uv": [0, 0, 16, 16], "texture": "#0"},
"south": {"uv": [0, 0, 16, 16], "texture": "#0"},
"west": {"uv": [16, 0, 0, 16], "texture": "#0"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"parent": "block/block",
"credit": "Made with Blockbench",
"textures": {
"0": "bellsandwhistles:block/metro/corrugated_panel_side",
"1": "bellsandwhistles:block/metro/corrugated_metro",
"particle": "bellsandwhistles:block/metro/corrugated_metro"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 3, 16],
"faces": {
"north": {"uv": [0, 0, 16, 3], "texture": "#0"},
"east": {"uv": [0, 0, 16, 3], "texture": "#0"},
"south": {"uv": [0, 0, 16, 3], "texture": "#0"},
"west": {"uv": [0, 0, 16, 3], "texture": "#0"},
"up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "bellsandwhistles:block/metro/corrugated_panel_side",
"1": "bellsandwhistles:block/metro/corrugated_metro",
"particle": "bellsandwhistles:block/metro/corrugated_metro"
},
"elements": [
{
"from": [0, 0, 13],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"},
"east": {"uv": [0, 0, 16, 3], "rotation": 90, "texture": "#0"},
"south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"},
"west": {"uv": [0, 0, 16, 3], "rotation": 270, "texture": "#0"},
"up": {"uv": [0, 0, 16, 3], "texture": "#0"},
"down": {"uv": [0, 0, 16, 3], "rotation": 180, "texture": "#0"}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"parent": "block/block",
"credit": "Made with Blockbench",
"textures": {
"0": "bellsandwhistles:block/metro/panel_side",
"1": "bellsandwhistles:block/metro/metro",
"particle": "bellsandwhistles:block/metro/metro"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 3, 16],
"faces": {
"north": {"uv": [0, 0, 16, 3], "texture": "#0"},
"east": {"uv": [0, 0, 16, 3], "texture": "#0"},
"south": {"uv": [0, 0, 16, 3], "texture": "#0"},
"west": {"uv": [0, 0, 16, 3], "texture": "#0"},
"up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "bellsandwhistles:block/metro/panel_side",
"1": "bellsandwhistles:block/metro/metro",
"particle": "bellsandwhistles:block/metro/metro"
},
"elements": [
{
"from": [0, 0, 13],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"},
"east": {"uv": [0, 0, 16, 3], "rotation": 90, "texture": "#0"},
"south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"},
"west": {"uv": [0, 0, 16, 3], "rotation": 270, "texture": "#0"},
"up": {"uv": [0, 0, 16, 3], "texture": "#0"},
"down": {"uv": [0, 0, 16, 3], "rotation": 180, "texture": "#0"}
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d3ca0c3

Please sign in to comment.