Skip to content

Commit 21776a5

Browse files
committed
Add new splicing table textures, fix issues with media detection, add casting button cooldown overlay
1 parent f9e3b24 commit 21776a5

File tree

26 files changed

+248
-109
lines changed

26 files changed

+248
-109
lines changed

Common/src/generated/resources/assets/hexdebug/blockstates/enlightened_splicing_table.json

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
{
22
"variants": {
3-
"facing=east": {
4-
"model": "hexdebug:block/enlightened_splicing_table",
3+
"facing=east,imbued=false": {
4+
"model": "hexdebug:block/enlightened_splicing_table/dim",
55
"y": 90
66
},
7-
"facing=north": {
8-
"model": "hexdebug:block/enlightened_splicing_table"
7+
"facing=east,imbued=true": {
8+
"model": "hexdebug:block/enlightened_splicing_table/lit",
9+
"y": 90
10+
},
11+
"facing=north,imbued=false": {
12+
"model": "hexdebug:block/enlightened_splicing_table/dim"
913
},
10-
"facing=south": {
11-
"model": "hexdebug:block/enlightened_splicing_table",
14+
"facing=north,imbued=true": {
15+
"model": "hexdebug:block/enlightened_splicing_table/lit"
16+
},
17+
"facing=south,imbued=false": {
18+
"model": "hexdebug:block/enlightened_splicing_table/dim",
1219
"y": 180
1320
},
14-
"facing=west": {
15-
"model": "hexdebug:block/enlightened_splicing_table",
21+
"facing=south,imbued=true": {
22+
"model": "hexdebug:block/enlightened_splicing_table/lit",
23+
"y": 180
24+
},
25+
"facing=west,imbued=false": {
26+
"model": "hexdebug:block/enlightened_splicing_table/dim",
27+
"y": 270
28+
},
29+
"facing=west,imbued=true": {
30+
"model": "hexdebug:block/enlightened_splicing_table/lit",
1631
"y": 270
1732
}
1833
}

Common/src/generated/resources/assets/hexdebug/blockstates/splicing_table.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
{
22
"variants": {
3-
"facing=east": {
3+
"facing=east,imbued=false": {
44
"model": "hexdebug:block/splicing_table",
55
"y": 90
66
},
7-
"facing=north": {
7+
"facing=east,imbued=true": {
8+
"model": "hexdebug:block/splicing_table",
9+
"y": 90
10+
},
11+
"facing=north,imbued=false": {
812
"model": "hexdebug:block/splicing_table"
913
},
10-
"facing=south": {
14+
"facing=north,imbued=true": {
15+
"model": "hexdebug:block/splicing_table"
16+
},
17+
"facing=south,imbued=false": {
1118
"model": "hexdebug:block/splicing_table",
1219
"y": 180
1320
},
14-
"facing=west": {
21+
"facing=south,imbued=true": {
22+
"model": "hexdebug:block/splicing_table",
23+
"y": 180
24+
},
25+
"facing=west,imbued=false": {
26+
"model": "hexdebug:block/splicing_table",
27+
"y": 270
28+
},
29+
"facing=west,imbued=true": {
1530
"model": "hexdebug:block/splicing_table",
1631
"y": 270
1732
}

Common/src/generated/resources/assets/hexdebug/models/block/enlightened_splicing_table.json

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"parent": "minecraft:block/cube",
3+
"textures": {
4+
"down": "hexcasting:block/slate",
5+
"east": "hexdebug:block/enlightened_splicing_table/right",
6+
"north": "hexdebug:block/enlightened_splicing_table/front/dim",
7+
"particle": "hexcasting:block/slate",
8+
"south": "hexdebug:block/enlightened_splicing_table/back",
9+
"up": "hexdebug:block/enlightened_splicing_table/top",
10+
"west": "hexdebug:block/enlightened_splicing_table/left"
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"parent": "minecraft:block/cube",
3+
"textures": {
4+
"down": "hexcasting:block/slate",
5+
"east": "hexdebug:block/enlightened_splicing_table/right",
6+
"north": "hexdebug:block/enlightened_splicing_table/front/lit",
7+
"particle": "hexcasting:block/slate",
8+
"south": "hexdebug:block/enlightened_splicing_table/back",
9+
"up": "hexdebug:block/enlightened_splicing_table/top",
10+
"west": "hexdebug:block/enlightened_splicing_table/left"
11+
}
12+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"parent": "hexdebug:block/enlightened_splicing_table"
2+
"parent": "hexdebug:block/enlightened_splicing_table/lit"
33
}

Common/src/generated/resources/data/hexdebug/recipes/brainsweep/enlightened_splicing_table.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"result": {
1414
"name": "hexdebug:enlightened_splicing_table",
1515
"properties": {
16-
"facing": "north"
16+
"facing": "north",
17+
"imbued": "false"
1718
}
1819
}
1920
}

Common/src/main/kotlin/gay/object/hexdebug/blocks/focusholder/FocusHolderBlockEntity.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import at.petrak.hexcasting.api.casting.iota.Iota
66
import at.petrak.hexcasting.xplat.IXplatAbstractions
77
import gay.`object`.hexdebug.blocks.base.BaseContainer
88
import gay.`object`.hexdebug.blocks.base.ContainerSlotDelegate
9-
import gay.`object`.hexdebug.blocks.focusholder.FocusHolderBlock.Companion.HAS_ITEM
109
import gay.`object`.hexdebug.registry.HexDebugBlockEntities
1110
import gay.`object`.hexdebug.utils.isNotEmpty
11+
import gay.`object`.hexdebug.utils.setPropertyIfChanged
1212
import net.minecraft.core.BlockPos
1313
import net.minecraft.nbt.CompoundTag
1414
import net.minecraft.world.ContainerHelper
@@ -47,8 +47,6 @@ class FocusHolderBlockEntity(pos: BlockPos, state: BlockState) :
4747

4848
override fun setChanged() {
4949
super.setChanged()
50-
if (blockState.getValue(HAS_ITEM) != isNotEmpty) {
51-
level?.setBlockAndUpdate(blockPos, blockState.setValue(HAS_ITEM, isNotEmpty))
52-
}
50+
setPropertyIfChanged(FocusHolderBlock.HAS_ITEM, isNotEmpty)
5351
}
5452
}

Common/src/main/kotlin/gay/object/hexdebug/blocks/splicing/SplicingTableBlock.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType
1717
import net.minecraft.world.level.block.state.BlockState
1818
import net.minecraft.world.level.block.state.StateDefinition
1919
import net.minecraft.world.level.block.state.properties.BlockStateProperties
20+
import net.minecraft.world.level.block.state.properties.BooleanProperty
21+
import net.minecraft.world.level.block.state.properties.DirectionProperty
2022
import net.minecraft.world.phys.BlockHitResult
2123

2224
@Suppress("OVERRIDE_DEPRECATION")
@@ -25,11 +27,12 @@ class SplicingTableBlock(properties: Properties, val enlightened: Boolean) : Bas
2527
registerDefaultState(
2628
getStateDefinition().any()
2729
.setValue(FACING, Direction.NORTH)
30+
.setValue(IMBUED, false)
2831
)
2932
}
3033

3134
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
32-
builder.add(FACING)
35+
builder.add(FACING, IMBUED)
3336
}
3437

3538
override fun getStateForPlacement(ctx: BlockPlaceContext) =
@@ -96,6 +99,7 @@ class SplicingTableBlock(properties: Properties, val enlightened: Boolean) : Bas
9699
private fun getBlockEntity(level: Level, pos: BlockPos) = level.getBlockEntity(pos) as? SplicingTableBlockEntity
97100

98101
companion object {
99-
val FACING = BlockStateProperties.HORIZONTAL_FACING
102+
val FACING: DirectionProperty = BlockStateProperties.HORIZONTAL_FACING
103+
val IMBUED: BooleanProperty = BooleanProperty.create("imbued")
100104
}
101105
}

Common/src/main/kotlin/gay/object/hexdebug/blocks/splicing/SplicingTableBlockEntity.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import gay.`object`.hexdebug.registry.HexDebugBlockEntities
2929
import gay.`object`.hexdebug.splicing.*
3030
import gay.`object`.hexdebug.utils.Option.None
3131
import gay.`object`.hexdebug.utils.Option.Some
32+
import gay.`object`.hexdebug.utils.setPropertyIfChanged
3233
import net.minecraft.core.BlockPos
3334
import net.minecraft.nbt.CompoundTag
3435
import net.minecraft.nbt.ListTag
@@ -86,10 +87,7 @@ class SplicingTableBlockEntity(pos: BlockPos, state: BlockState) :
8687
)
8788
private set
8889

89-
private var castingCooldown by ContainerDataDelegate(
90-
containerData,
91-
index = SplicingTableDataSlot.CASTING_COOLDOWN.index,
92-
)
90+
private var castingCooldown = 0
9391

9492
val analogOutputSignal get() = if (!listStack.isEmpty) 15 else 0
9593

@@ -147,6 +145,7 @@ class SplicingTableBlockEntity(pos: BlockPos, state: BlockState) :
147145
override fun setChanged() {
148146
super.setChanged()
149147
refillMedia()
148+
setPropertyIfChanged(SplicingTableBlock.IMBUED, hexTag != null)
150149
}
151150

152151
/** Only returns null if it fails to convert `this.level` to [ServerLevel]. */
@@ -210,7 +209,7 @@ class SplicingTableBlockEntity(pos: BlockPos, state: BlockState) :
210209
}
211210

212211
override fun runAction(action: SplicingTableAction, player: ServerPlayer?) {
213-
if (media < mediaCost) return
212+
if (action.value.consumesMedia && media < mediaCost) return
214213
val data = getData(player) ?: return
215214
clampView(data.level, data)
216215
setupUndoStack(data)
@@ -439,7 +438,7 @@ class SplicingTableBlockEntity(pos: BlockPos, state: BlockState) :
439438
private val config get() = HexDebugConfig.server
440439

441440
private val mediaCost get() = config.splicingTableMediaCost
442-
val maxMedia get() = config.splicingTableMaxMedia.coerceIn(1, null)
441+
private val maxMedia get() = config.splicingTableMaxMedia.coerceIn(1, null)
443442

444443
@Suppress("UNUSED_PARAMETER")
445444
fun tickServer(level: Level, pos: BlockPos, state: BlockState, blockEntity: SplicingTableBlockEntity) {

0 commit comments

Comments
 (0)