feat: model and textures for constant temporal sink block
This commit is contained in:
parent
dc4a9764cd
commit
d077704c05
@ -1,15 +1,90 @@
|
|||||||
package quaedam.misc.cts
|
package quaedam.misc.cts
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.core.Direction
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.item.context.BlockPlaceContext
|
||||||
|
import net.minecraft.world.level.BlockGetter
|
||||||
|
import net.minecraft.world.level.LevelAccessor
|
||||||
|
import net.minecraft.world.level.block.*
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||||
|
import net.minecraft.world.level.material.FluidState
|
||||||
|
import net.minecraft.world.level.material.Fluids
|
||||||
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
|
import net.minecraft.world.phys.shapes.Shapes
|
||||||
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
|
|
||||||
object CTSBlock : Block(
|
object CTSBlock : HorizontalDirectionalBlock(
|
||||||
Properties.of()
|
Properties.of()
|
||||||
.lightLevel { 2 }
|
.lightLevel { 2 }
|
||||||
), EntityBlock {
|
.noOcclusion()
|
||||||
|
), EntityBlock, SimpleWaterloggedBlock {
|
||||||
|
|
||||||
|
val shapes = getShapeForEachState(::createVoxelShape)
|
||||||
|
|
||||||
|
init {
|
||||||
|
registerDefaultState(
|
||||||
|
defaultBlockState()
|
||||||
|
.setValue(FACING, Direction.EAST)
|
||||||
|
.setValue(BlockStateProperties.WATERLOGGED, false)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
override fun newBlockEntity(pos: BlockPos, state: BlockState) = CTSBlockEntity(pos, state)
|
override fun newBlockEntity(pos: BlockPos, state: BlockState) = CTSBlockEntity(pos, state)
|
||||||
|
|
||||||
|
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||||
|
super.createBlockStateDefinition(builder)
|
||||||
|
builder.add(FACING, BlockStateProperties.WATERLOGGED)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||||
|
if (context.level.getBlockState(context.clickedPos.below()).isAir) return null
|
||||||
|
return super.defaultBlockState().setValue(FACING, context.horizontalDirection)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION")
|
||||||
|
override fun getRenderShape(state: BlockState) = RenderShape.MODEL
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION")
|
||||||
|
override fun getShape(state: BlockState, level: BlockGetter, pos: BlockPos, context: CollisionContext) =
|
||||||
|
shapes[state]!!
|
||||||
|
|
||||||
|
private fun createVoxelShape(state: BlockState): VoxelShape =
|
||||||
|
when (state.getValue(FACING)) {
|
||||||
|
Direction.WEST, Direction.EAST -> Shapes.or(
|
||||||
|
box(0.0, 0.0, 0.0, 16.0, 12.0, 16.0),
|
||||||
|
box(6.0, 13.0, 7.0, 10.0, 15.0, 9.0),
|
||||||
|
)
|
||||||
|
|
||||||
|
Direction.SOUTH, Direction.NORTH -> Shapes.or(
|
||||||
|
box(0.0, 0.0, 0.0, 16.0, 12.0, 16.0),
|
||||||
|
box(7.0, 13.0, 6.0, 9.0, 15.0, 10.0),
|
||||||
|
)
|
||||||
|
|
||||||
|
else -> throw IllegalStateException(state.getValue(FACING).name)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION", "DEPRECATION")
|
||||||
|
override fun updateShape(
|
||||||
|
state: BlockState,
|
||||||
|
direction: Direction,
|
||||||
|
neighborState: BlockState,
|
||||||
|
level: LevelAccessor,
|
||||||
|
pos: BlockPos,
|
||||||
|
neighborPos: BlockPos
|
||||||
|
): BlockState {
|
||||||
|
if (state.getValue(BlockStateProperties.WATERLOGGED)) {
|
||||||
|
level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level))
|
||||||
|
}
|
||||||
|
return super.updateShape(state, direction, neighborState, level, pos, neighborPos)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION", "DEPRECATION")
|
||||||
|
override fun getFluidState(state: BlockState): FluidState = if (state.getValue(BlockStateProperties.WATERLOGGED)) {
|
||||||
|
Fluids.WATER.getSource(false)
|
||||||
|
} else {
|
||||||
|
super.getFluidState(state)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=east": {
|
||||||
|
"model": "quaedam:block/cts"
|
||||||
|
},
|
||||||
|
"facing=south": {
|
||||||
|
"model": "quaedam:block/cts",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"facing=west": {
|
||||||
|
"model": "quaedam:block/cts",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=north": {
|
||||||
|
"model": "quaedam:block/cts",
|
||||||
|
"y": 270
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
541
common/src/main/resources/assets/quaedam/models/block/cts.json
Normal file
541
common/src/main/resources/assets/quaedam/models/block/cts.json
Normal file
@ -0,0 +1,541 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/block",
|
||||||
|
"texture_size": [
|
||||||
|
64,
|
||||||
|
64
|
||||||
|
],
|
||||||
|
"textures": {
|
||||||
|
"0": "quaedam:block/cts",
|
||||||
|
"particle": "quaedam:block/cts"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"name": "s2",
|
||||||
|
"from": [
|
||||||
|
13,
|
||||||
|
-6,
|
||||||
|
14
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
15,
|
||||||
|
6,
|
||||||
|
16
|
||||||
|
],
|
||||||
|
"rotation": {
|
||||||
|
"angle": -22.5,
|
||||||
|
"axis": "x",
|
||||||
|
"origin": [
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4.5,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
4.5,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
5,
|
||||||
|
0.5,
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
0.5,
|
||||||
|
5,
|
||||||
|
1,
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
5.75,
|
||||||
|
7.5,
|
||||||
|
5.25,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
7.5,
|
||||||
|
5.5,
|
||||||
|
7,
|
||||||
|
6
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "s3",
|
||||||
|
"from": [
|
||||||
|
1,
|
||||||
|
-6,
|
||||||
|
14
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
3,
|
||||||
|
6,
|
||||||
|
16
|
||||||
|
],
|
||||||
|
"rotation": {
|
||||||
|
"angle": -22.5,
|
||||||
|
"axis": "x",
|
||||||
|
"origin": [
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
1,
|
||||||
|
5,
|
||||||
|
1.5,
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
1.5,
|
||||||
|
5,
|
||||||
|
2,
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
2,
|
||||||
|
5,
|
||||||
|
2.5,
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
2.5,
|
||||||
|
5,
|
||||||
|
3,
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
6.25,
|
||||||
|
7.5,
|
||||||
|
5.75,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
7.5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
6.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "s4",
|
||||||
|
"from": [
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
-1
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
3,
|
||||||
|
12,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"rotation": {
|
||||||
|
"angle": 22.5,
|
||||||
|
"axis": "x",
|
||||||
|
"origin": [
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
3,
|
||||||
|
5,
|
||||||
|
3.5,
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
3.5,
|
||||||
|
5,
|
||||||
|
4,
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
5,
|
||||||
|
4,
|
||||||
|
5.5,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
5.5,
|
||||||
|
4,
|
||||||
|
6,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
6.75,
|
||||||
|
7.5,
|
||||||
|
6.25,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
7.5,
|
||||||
|
6.5,
|
||||||
|
7,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "s1",
|
||||||
|
"from": [
|
||||||
|
13,
|
||||||
|
0,
|
||||||
|
-1
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
15,
|
||||||
|
12,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"rotation": {
|
||||||
|
"angle": 22.5,
|
||||||
|
"axis": "x",
|
||||||
|
"origin": [
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
0,
|
||||||
|
6.5,
|
||||||
|
3
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
6,
|
||||||
|
4,
|
||||||
|
6.5,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
6.5,
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
3
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
6.5,
|
||||||
|
4,
|
||||||
|
7,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
7.25,
|
||||||
|
7.5,
|
||||||
|
6.75,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
7.75,
|
||||||
|
4,
|
||||||
|
7.25,
|
||||||
|
4.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "platform",
|
||||||
|
"from": [
|
||||||
|
0,
|
||||||
|
10,
|
||||||
|
3
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
16,
|
||||||
|
12,
|
||||||
|
13
|
||||||
|
],
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
4,
|
||||||
|
3,
|
||||||
|
8,
|
||||||
|
3.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
7,
|
||||||
|
0,
|
||||||
|
9.5,
|
||||||
|
0.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
4,
|
||||||
|
3.5,
|
||||||
|
8,
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
7,
|
||||||
|
0.5,
|
||||||
|
9.5,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
4,
|
||||||
|
2.5,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
4,
|
||||||
|
2.5,
|
||||||
|
0,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "core",
|
||||||
|
"from": [
|
||||||
|
6,
|
||||||
|
13,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
10,
|
||||||
|
15,
|
||||||
|
9
|
||||||
|
],
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
7,
|
||||||
|
1.5,
|
||||||
|
8,
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
7.25,
|
||||||
|
4.5,
|
||||||
|
7.75,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
7,
|
||||||
|
2,
|
||||||
|
8,
|
||||||
|
2.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
7.25,
|
||||||
|
5,
|
||||||
|
7.75,
|
||||||
|
5.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
8,
|
||||||
|
3,
|
||||||
|
7,
|
||||||
|
2.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
5,
|
||||||
|
7,
|
||||||
|
4,
|
||||||
|
7.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "screen",
|
||||||
|
"from": [
|
||||||
|
4,
|
||||||
|
6,
|
||||||
|
-2
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
12,
|
||||||
|
12,
|
||||||
|
-1
|
||||||
|
],
|
||||||
|
"rotation": {
|
||||||
|
"angle": 22.5,
|
||||||
|
"axis": "x",
|
||||||
|
"origin": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
4,
|
||||||
|
0,
|
||||||
|
6,
|
||||||
|
1.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"uv": [
|
||||||
|
7,
|
||||||
|
4,
|
||||||
|
7.25,
|
||||||
|
5.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
4,
|
||||||
|
1.5,
|
||||||
|
6,
|
||||||
|
3
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"uv": [
|
||||||
|
5,
|
||||||
|
7,
|
||||||
|
5.25,
|
||||||
|
8.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
"uv": [
|
||||||
|
9,
|
||||||
|
1.25,
|
||||||
|
7,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
"uv": [
|
||||||
|
9,
|
||||||
|
1.25,
|
||||||
|
7,
|
||||||
|
1.5
|
||||||
|
],
|
||||||
|
"texture": "#0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parent": "quaedam:block/cts"
|
||||||
|
}
|
BIN
common/src/main/resources/assets/quaedam/textures/block/cts.png
Normal file
BIN
common/src/main/resources/assets/quaedam/textures/block/cts.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 543 B |
Loading…
x
Reference in New Issue
Block a user