generated from neoforged/MDK
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
275 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/main/java/systems/alexander/bellsandwhistles/block/custom/HeadlightBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package systems.alexander.bellsandwhistles.block.custom; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.level.block.state.properties.AttachFace; | ||
import net.minecraft.world.phys.shapes.BooleanOp; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.Shapes; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
|
||
public class HeadlightBlock extends FaceAttachedHorizontalDirectionalBlock { | ||
public HeadlightBlock(Properties pProperties) { | ||
super(pProperties); | ||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(FACE, AttachFace.WALL)); | ||
} | ||
|
||
|
||
|
||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) { | ||
pBuilder.add(FACING, FACE); | ||
} | ||
|
||
public float getShadeBrightness(BlockState pState, BlockGetter pLevel, BlockPos pPos) { | ||
return 1.0F; | ||
} | ||
|
||
public boolean propagatesSkylightDown(BlockState pState, BlockGetter pReader, BlockPos pPos) { | ||
return true; | ||
} | ||
private static final VoxelShape SHAPE = Shapes.join(Block.box(4.5, 4.5, 13, 11.5, 11.5, 16), Block.box(4, 4, 14, 12, 12, 16), BooleanOp.OR); | ||
|
||
public static VoxelShape rotateShape(Direction from, Direction to, VoxelShape shape) { | ||
VoxelShape[] buffer = new VoxelShape[]{shape, Shapes.empty()}; | ||
|
||
int times = (to.ordinal() - from.get2DDataValue() + 4) % 4; | ||
for (int i = 0; i < times; i++) { | ||
buffer[0].forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = Shapes.or(buffer[1], Shapes.create(1 - maxZ, minY, minX, 1 - minZ, maxY, maxX))); | ||
buffer[0] = buffer[1]; | ||
buffer[1] = Shapes.empty(); | ||
} | ||
|
||
return buffer[0]; | ||
} | ||
@Override | ||
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { | ||
if (pState.getValue(FACE) == AttachFace.FLOOR) { | ||
return Shapes.join(Block.box(4.5, 0, 5, 11.5, 3, 12), Block.box(4, 0, 4.5, 12, 2, 12.5), BooleanOp.OR); | ||
} else if (pState.getValue(FACE) == AttachFace.CEILING) { | ||
return Shapes.join(Block.box(4.5, 13, 5, 11.5, 16, 12), Block.box(4, 14, 4.5, 12, 16, 12.5), BooleanOp.OR); | ||
} else { | ||
switch ((Direction) pState.getValue(FACING)) { | ||
case NORTH: | ||
return SHAPE; | ||
case SOUTH: | ||
return rotateShape(Direction.NORTH, Direction.WEST, SHAPE); | ||
case WEST: | ||
return rotateShape(Direction.NORTH, Direction.EAST, SHAPE); | ||
case EAST: | ||
default: | ||
return rotateShape(Direction.NORTH, Direction.SOUTH, SHAPE); | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/resources/assets/bellsandwhistles/blockstates/headlight.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"variants": { | ||
"face=ceiling": { | ||
"model": "bellsandwhistles:block/headlight/headlight_floor", | ||
"x": 180 | ||
}, | ||
"facing=east": { | ||
"model": "bellsandwhistles:block/headlight/headlight_wall", | ||
"y": 270 | ||
}, | ||
"facing=north": { | ||
"model": "bellsandwhistles:block/headlight/headlight_wall", | ||
"y": 180 | ||
}, | ||
"facing=south": { | ||
"model": "bellsandwhistles:block/headlight/headlight_wall" | ||
}, | ||
"face=floor": { | ||
"model": "bellsandwhistles:block/headlight/headlight_floor" | ||
}, | ||
"facing=west": { | ||
"model": "bellsandwhistles:block/headlight/headlight_wall", | ||
"y": 90 | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/resources/assets/bellsandwhistles/models/block/headlight/headlight_floor.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"credit": "Made with Blockbench", | ||
"textures": { | ||
"1": "bellsandwhistles:block/headlight", | ||
"particle": "bellsandwhistles:block/headlight" | ||
}, | ||
"elements": [ | ||
{ | ||
"name": "lampy-part", | ||
"from": [4.5, 0, 5], | ||
"to": [11.5, 3, 12], | ||
"rotation": {"angle": 0, "axis": "z", "origin": [8, 1.5, 8.5]}, | ||
"faces": { | ||
"north": {"uv": [0, 0, 7, 1], "rotation": 270, "texture": "#1"}, | ||
"east": {"uv": [0, 0, 1, 7], "rotation": 270, "texture": "#1"}, | ||
"south": {"uv": [0, 0, 7, 1], "rotation": 270, "texture": "#1"}, | ||
"west": {"uv": [0, 0, 1, 7], "rotation": 90, "texture": "#1"}, | ||
"up": {"uv": [0, 0, 7, 7], "rotation": 180, "texture": "#1"}, | ||
"down": {"uv": [7, 0, 14, 7], "rotation": 90, "texture": "#1"} | ||
} | ||
}, | ||
{ | ||
"name": "overlay", | ||
"from": [4.25, -0.25, 4.75], | ||
"to": [11.75, 3.25, 12.25], | ||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 1.5, 8.5]}, | ||
"faces": { | ||
"north": {"uv": [7, 9, 14, 12], "texture": "#1"}, | ||
"east": {"uv": [7, 9, 14, 12], "texture": "#1"}, | ||
"south": {"uv": [7, 9, 14, 12], "rotation": 180, "texture": "#1"}, | ||
"west": {"uv": [7, 9, 14, 12], "texture": "#1"}, | ||
"up": {"uv": [0, 7, 7, 14], "rotation": 180, "texture": "#1"}, | ||
"down": {"uv": [0, 7, 7, 14], "rotation": 90, "texture": "#1"} | ||
} | ||
}, | ||
{ | ||
"name": "base", | ||
"from": [4, 0, 4.5], | ||
"to": [12, 2, 12.5], | ||
"rotation": {"angle": -45, "axis": "y", "origin": [8, 1.5, 8.5]}, | ||
"faces": { | ||
"north": {"uv": [7, 0, 15, 2], "rotation": 90, "texture": "#1"}, | ||
"east": {"uv": [7, 0, 9, 8], "rotation": 270, "texture": "#1"}, | ||
"south": {"uv": [7, 0, 15, 2], "rotation": 90, "texture": "#1"}, | ||
"west": {"uv": [13, 0, 15, 8], "rotation": 90, "texture": "#1"}, | ||
"up": {"uv": [7, 0, 15, 8], "rotation": 180, "texture": "#1"}, | ||
"down": {"uv": [7, 0, 15, 8], "rotation": 90, "texture": "#1"} | ||
} | ||
} | ||
], | ||
"groups": [ | ||
{ | ||
"name": "lamp", | ||
"origin": [8, 8, 8], | ||
"color": 0, | ||
"children": [0, 1, 2] | ||
} | ||
] | ||
} |
97 changes: 97 additions & 0 deletions
97
src/main/resources/assets/bellsandwhistles/models/block/headlight/headlight_wall.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{ | ||
"credit": "Made with Blockbench", | ||
"textures": { | ||
"1": "bellsandwhistles:block/headlight", | ||
"particle": "bellsandwhistles:block/headlight" | ||
}, | ||
"elements": [ | ||
{ | ||
"name": "lampy-part", | ||
"from": [4.5, 4.5, 13], | ||
"to": [11.5, 11.5, 16], | ||
"rotation": {"angle": 0, "axis": "z", "origin": [8, 8, 14.5]}, | ||
"faces": { | ||
"north": {"uv": [0, 0, 7, 7], "texture": "#1"}, | ||
"east": {"uv": [0, 0, 1, 7], "texture": "#1"}, | ||
"south": {"uv": [7, 0, 14, 7], "rotation": 90, "texture": "#1"}, | ||
"west": {"uv": [0, 0, 1, 7], "texture": "#1"}, | ||
"up": {"uv": [0, 0, 7, 1], "rotation": 270, "texture": "#1"}, | ||
"down": {"uv": [0, 0, 7, 1], "rotation": 90, "texture": "#1"} | ||
} | ||
}, | ||
{ | ||
"name": "overlay", | ||
"from": [4.25, 4.25, 12.75], | ||
"to": [11.75, 11.75, 16.25], | ||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 14.5]}, | ||
"faces": { | ||
"north": {"uv": [0, 7, 7, 14], "texture": "#1"}, | ||
"east": {"uv": [7, 9, 14, 12], "rotation": 90, "texture": "#1"}, | ||
"south": {"uv": [0, 7, 7, 14], "rotation": 90, "texture": "#1"}, | ||
"west": {"uv": [7, 9, 14, 12], "rotation": 270, "texture": "#1"}, | ||
"up": {"uv": [7, 9, 14, 12], "rotation": 180, "texture": "#1"}, | ||
"down": {"uv": [7, 9, 14, 12], "rotation": 180, "texture": "#1"} | ||
} | ||
}, | ||
{ | ||
"name": "base", | ||
"from": [4, 4, 14], | ||
"to": [12, 12, 16], | ||
"rotation": {"angle": 45, "axis": "z", "origin": [8, 8, 14.5]}, | ||
"faces": { | ||
"north": {"uv": [7, 0, 15, 8], "texture": "#1"}, | ||
"east": {"uv": [7, 0, 9, 8], "texture": "#1"}, | ||
"south": {"uv": [7, 0, 15, 8], "rotation": 90, "texture": "#1"}, | ||
"west": {"uv": [13, 0, 15, 8], "texture": "#1"}, | ||
"up": {"uv": [7, 0, 15, 2], "rotation": 90, "texture": "#1"}, | ||
"down": {"uv": [7, 0, 15, 2], "rotation": 270, "texture": "#1"} | ||
} | ||
} | ||
], | ||
"display": { | ||
"thirdperson_righthand": { | ||
"rotation": [75, 45, 0], | ||
"translation": [0, 2.5, 0], | ||
"scale": [0.375, 0.375, 0.375] | ||
}, | ||
"thirdperson_lefthand": { | ||
"rotation": [75, 45, 0], | ||
"translation": [0, 2.5, 0], | ||
"scale": [0.375, 0.375, 0.375] | ||
}, | ||
"firstperson_righthand": { | ||
"rotation": [0, 56, 0], | ||
"translation": [0, 1.5, 0], | ||
"scale": [0.4, 0.4, 0.4] | ||
}, | ||
"firstperson_lefthand": { | ||
"rotation": [0, 56, 0], | ||
"translation": [-0.75, 1.5, -0.5], | ||
"scale": [0.4, 0.4, 0.4] | ||
}, | ||
"ground": { | ||
"translation": [0, 3, -4.5], | ||
"scale": [0.5, 0.5, 0.5] | ||
}, | ||
"gui": { | ||
"rotation": [30, 225, 0], | ||
"translation": [6, -2.75, 0], | ||
"scale": [1.25, 1.25, 1.25] | ||
}, | ||
"head": { | ||
"translation": [0, 5, -14] | ||
}, | ||
"fixed": { | ||
"translation": [0, 0, -14.75], | ||
"scale": [2, 2, 2] | ||
} | ||
}, | ||
"groups": [ | ||
{ | ||
"name": "lamp", | ||
"origin": [8, 8, 8], | ||
"color": 0, | ||
"children": [0, 1, 2] | ||
} | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/resources/assets/bellsandwhistles/models/item/corrugated_metro_panel.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"parent": "bellsandwhistles:block/metro/corrugated_panel/block_side" | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/resources/assets/bellsandwhistles/models/item/headlight.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"parent": "bellsandwhistles:block/headlight/headlight_wall" | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/resources/assets/bellsandwhistles/models/item/metro_panel.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"parent": "bellsandwhistles:block/metro/panel/block_side" | ||
} |
Binary file added
BIN
+486 Bytes
...ain/resources/assets/bellsandwhistles/textures/block/folding_metro_door_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+469 Bytes
src/main/resources/assets/bellsandwhistles/textures/block/headlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.