diff --git a/common/src/main/kotlin/quaedam/projection/music/MusicProjection.kt b/common/src/main/kotlin/quaedam/projection/music/MusicProjection.kt index dc63d63..4c5207f 100644 --- a/common/src/main/kotlin/quaedam/projection/music/MusicProjection.kt +++ b/common/src/main/kotlin/quaedam/projection/music/MusicProjection.kt @@ -35,7 +35,7 @@ object MusicProjection { }!! init { - CyberInstrument + SmartInstrument } } diff --git a/common/src/main/kotlin/quaedam/projection/music/CyberInstrument.kt b/common/src/main/kotlin/quaedam/projection/music/SmartInstrument.kt similarity index 89% rename from common/src/main/kotlin/quaedam/projection/music/CyberInstrument.kt rename to common/src/main/kotlin/quaedam/projection/music/SmartInstrument.kt index 03189ac..9109280 100644 --- a/common/src/main/kotlin/quaedam/projection/music/CyberInstrument.kt +++ b/common/src/main/kotlin/quaedam/projection/music/SmartInstrument.kt @@ -12,7 +12,6 @@ import net.minecraft.world.InteractionResult import net.minecraft.world.entity.player.Player import net.minecraft.world.item.BlockItem import net.minecraft.world.item.Item -import net.minecraft.world.item.context.BlockPlaceContext import net.minecraft.world.level.Level import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.EntityBlock @@ -31,26 +30,26 @@ import quaedam.projector.Projector import quaedam.utils.getChunksNearby import quaedam.utils.sendBlockUpdated -object CyberInstrument { +object SmartInstrument { - const val ID = "cyber_instrument" + const val ID = "smart_instrument" - val block = Quaedam.blocks.register(ID) { CyberInstrumentBlock }!! + val block = Quaedam.blocks.register(ID) { SmartInstrumentBlock }!! val item = Quaedam.items.register(ID) { BlockItem( - CyberInstrumentBlock, Item.Properties() + SmartInstrumentBlock, Item.Properties() .`arch$tab`(Quaedam.creativeModeTab) ) }!! val blockEntity = Quaedam.blockEntities.register(ID) { - BlockEntityType.Builder.of(::CyberInstrumentBlockEntity, block.get()).build(null) + BlockEntityType.Builder.of(::SmartInstrumentBlockEntity, block.get()).build(null) }!! } -object CyberInstrumentBlock : Block( +object SmartInstrumentBlock : Block( Properties.of() .strength(2.7f) .requiresCorrectToolForDrops() @@ -65,7 +64,7 @@ object CyberInstrumentBlock : Block( ) } - override fun newBlockEntity(pos: BlockPos, state: BlockState) = CyberInstrumentBlockEntity(pos, state) + override fun newBlockEntity(pos: BlockPos, state: BlockState) = SmartInstrumentBlockEntity(pos, state) override fun createBlockStateDefinition(builder: StateDefinition.Builder) { super.createBlockStateDefinition(builder) @@ -107,7 +106,7 @@ object CyberInstrumentBlock : Block( random: RandomSource ) { if (Projector.findNearbyProjections(level, pos, MusicProjection.effect.get()).isNotEmpty()) { - val entity = level.getBlockEntity(pos) as CyberInstrumentBlockEntity + val entity = level.getBlockEntity(pos) as SmartInstrumentBlockEntity if (entity.player == null) { entity.startMusic() } @@ -126,7 +125,7 @@ object CyberInstrumentBlock : Block( if (Projector.findNearbyProjections(level, pos, MusicProjection.effect.get()).isNotEmpty() || CausalityAnchor.checkEffect(level, pos) ) { - val entity = level.getBlockEntity(pos) as CyberInstrumentBlockEntity + val entity = level.getBlockEntity(pos) as SmartInstrumentBlockEntity if (entity.player == null) { entity.startMusic() } @@ -141,14 +140,14 @@ object CyberInstrumentBlock : Block( blockEntityType: BlockEntityType ): BlockEntityTicker { return BlockEntityTicker { _, _, _, entity -> - (entity as? CyberInstrumentBlockEntity)?.tick() + (entity as? SmartInstrumentBlockEntity)?.tick() } } } -class CyberInstrumentBlockEntity(pos: BlockPos, state: BlockState) : - BlockEntity(CyberInstrument.blockEntity.get(), pos, state) { +class SmartInstrumentBlockEntity(pos: BlockPos, state: BlockState) : + BlockEntity(SmartInstrument.blockEntity.get(), pos, state) { companion object { const val TAG_MUSIC = "Music" @@ -188,12 +187,12 @@ class CyberInstrumentBlockEntity(pos: BlockPos, state: BlockState) : level!!.getChunksNearby(blockPos, 1) .flatMap { it.blockEntities - .filterValues { entity -> entity is CyberInstrumentBlockEntity } + .filterValues { entity -> entity is SmartInstrumentBlockEntity } .filterKeys { pos -> pos.distSqr(blockPos) < 100 } .values } .filterNot { it == this } - .filterIsInstance() + .filterIsInstance() .forEach { it.startMusic(force = true, synced = true) } } } diff --git a/common/src/main/resources/assets/quaedam/blockstates/cyber_instrument.json b/common/src/main/resources/assets/quaedam/blockstates/cyber_instrument.json deleted file mode 100644 index 3f0c676..0000000 --- a/common/src/main/resources/assets/quaedam/blockstates/cyber_instrument.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "quaedam:block/cyber_instrument" - } - } -} diff --git a/common/src/main/resources/assets/quaedam/blockstates/smart_instrument.json b/common/src/main/resources/assets/quaedam/blockstates/smart_instrument.json new file mode 100644 index 0000000..a623a56 --- /dev/null +++ b/common/src/main/resources/assets/quaedam/blockstates/smart_instrument.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "quaedam:block/smart_instrument" + } + } +} diff --git a/common/src/main/resources/assets/quaedam/models/block/cyber_instrument.json b/common/src/main/resources/assets/quaedam/models/block/smart_instrument.json similarity index 100% rename from common/src/main/resources/assets/quaedam/models/block/cyber_instrument.json rename to common/src/main/resources/assets/quaedam/models/block/smart_instrument.json diff --git a/common/src/main/resources/assets/quaedam/models/item/cyber_instrument.json b/common/src/main/resources/assets/quaedam/models/item/cyber_instrument.json deleted file mode 100644 index b02fb32..0000000 --- a/common/src/main/resources/assets/quaedam/models/item/cyber_instrument.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "quaedam:block/cyber_instrument" -} \ No newline at end of file diff --git a/common/src/main/resources/assets/quaedam/models/item/smart_instrument.json b/common/src/main/resources/assets/quaedam/models/item/smart_instrument.json new file mode 100644 index 0000000..146c66d --- /dev/null +++ b/common/src/main/resources/assets/quaedam/models/item/smart_instrument.json @@ -0,0 +1,3 @@ +{ + "parent": "quaedam:block/smart_instrument" +} \ No newline at end of file