Skip to content

Commit cadf7ba

Browse files
committed
Add comparator and piston breaking to focus holder (close #57)
1 parent 0305394 commit cadf7ba

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
2525
- List iotas now render their first iota (if any) in the Splicing Table.
2626
- MoreIotas' item type iotas now render brackets around the item to distinguish them from item stack iotas.
2727
- A single Focal Frame item can now be used like a bundle to insert/remove items in your inventory.
28+
- The Focal Frame now gives comparator output and can be broken by pushing it with a piston.
2829

2930
### Fixed
3031

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ class FocusHolderBlock(properties: Properties) : BaseEntityBlock(properties) {
119119
return mutableListOf(stack)
120120
}
121121

122+
override fun hasAnalogOutputSignal(state: BlockState) = true
123+
124+
override fun getAnalogOutputSignal(state: BlockState, level: Level, pos: BlockPos) =
125+
getBlockEntity(level, pos)?.analogOutputSignal ?: 0
126+
122127
companion object {
123128
val HAS_ITEM: BooleanProperty = BooleanProperty.create("has_item")
124129

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class FocusHolderBlockEntity(pos: BlockPos, state: BlockState) :
2727

2828
private val iotaHolder get() = IXplatAbstractions.INSTANCE.findDataHolder(iotaStack)
2929

30+
val analogOutputSignal get() = if (isEmpty) 0 else 15
31+
3032
override fun loadModData(tag: CompoundTag) {
3133
stacks.clear() // without this, removing the item on the server doesn't remove it on the client
3234
ContainerHelper.loadAllItems(tag, stacks)

Common/src/main/kotlin/gay/object/hexdebug/registry/HexDebugBlocks.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object HexDebugBlocks : HexDebugRegistrar<Block>(Registries.BLOCK, { BuiltInRegi
2828
@JvmField
2929
val FOCUS_HOLDER = blockItem(
3030
"focus_holder",
31-
blockBuilder = { FocusHolderBlock(slateish.noPush()) },
31+
blockBuilder = { FocusHolderBlock(slateish.pushReaction(PushReaction.DESTROY)) },
3232
itemBuilder = { FocusHolderBlockItem(it, HexDebugItems.props) },
3333
)
3434

0 commit comments

Comments
 (0)