mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 17:37:58 -04:00
debug: force chest opening/closing
This commit is contained in:
parent
9bbb65174d
commit
2519a2cc10
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -24,4 +24,6 @@ object DebugOptions {
|
|||||||
const val LIGHT_DEBUG_MODE = false
|
const val LIGHT_DEBUG_MODE = false
|
||||||
|
|
||||||
const val LOG_RAW_CHAT = false
|
const val LOG_RAW_CHAT = false
|
||||||
|
|
||||||
|
const val FORCE_CHEST_ANIMATION = false
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,30 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.storage
|
package de.bixilon.minosoft.data.registries.blocks.types.pixlyzer.entity.container.storage
|
||||||
|
|
||||||
|
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||||
|
import de.bixilon.minosoft.camera.target.targets.BlockTarget
|
||||||
|
import de.bixilon.minosoft.config.DebugOptions
|
||||||
|
import de.bixilon.minosoft.data.container.stack.ItemStack
|
||||||
import de.bixilon.minosoft.data.entities.block.container.storage.ChestBlockEntity
|
import de.bixilon.minosoft.data.entities.block.container.storage.ChestBlockEntity
|
||||||
|
import de.bixilon.minosoft.data.entities.entities.player.Hands
|
||||||
import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory
|
import de.bixilon.minosoft.data.registries.blocks.factory.PixLyzerBlockFactory
|
||||||
|
import de.bixilon.minosoft.data.registries.blocks.types.properties.InteractBlockHandler
|
||||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||||
import de.bixilon.minosoft.data.registries.registries.Registries
|
import de.bixilon.minosoft.data.registries.registries.Registries
|
||||||
|
import de.bixilon.minosoft.input.interaction.InteractionResults
|
||||||
|
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||||
|
|
||||||
|
open class ChestBlock<T : ChestBlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : StorageBlock<T>(resourceLocation, registries, data), InteractBlockHandler {
|
||||||
|
|
||||||
|
|
||||||
|
override fun interact(connection: PlayConnection, target: BlockTarget, hand: Hands, stack: ItemStack?): InteractionResults {
|
||||||
|
if (!DebugOptions.FORCE_CHEST_ANIMATION) return super.interact(connection, target, hand, stack)
|
||||||
|
|
||||||
|
val entity = target.entity.unsafeCast<ChestBlockEntity>()
|
||||||
|
entity.setBlockActionData(0, if (entity.viewing > 0) 0 else 1)
|
||||||
|
return InteractionResults.SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
open class ChestBlock<T : ChestBlockEntity>(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>) : StorageBlock<T>(resourceLocation, registries, data) {
|
|
||||||
|
|
||||||
companion object : PixLyzerBlockFactory<ChestBlock<ChestBlockEntity>> {
|
companion object : PixLyzerBlockFactory<ChestBlock<ChestBlockEntity>> {
|
||||||
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): ChestBlock<ChestBlockEntity> {
|
override fun build(resourceLocation: ResourceLocation, registries: Registries, data: Map<String, Any>): ChestBlock<ChestBlockEntity> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user