Compare commits
2 Commits
9621356682
...
05907276e1
Author | SHA1 | Date | |
---|---|---|---|
05907276e1 | |||
7403edf157 |
@ -97,13 +97,14 @@ class HoloSignBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryB
|
|||||||
override fun loadAdditional(nbt: CompoundTag, registry: HolderLookup.Provider) {
|
override fun loadAdditional(nbt: CompoundTag, registry: HolderLookup.Provider) {
|
||||||
super.loadAdditional(nbt, registry)
|
super.loadAdditional(nbt, registry)
|
||||||
|
|
||||||
if (!isLocked)
|
if (!isLocked) {
|
||||||
signText = truncate(signText)
|
signText = truncate(signText)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val DEFAULT_MAX_NEWLINES = 8
|
const val DEFAULT_MAX_NEWLINES = 10
|
||||||
const val DEFAULT_MAX_LINE_LENGTH = 15
|
const val DEFAULT_MAX_LINE_LENGTH = 60
|
||||||
private val NEWLINES = Regex("\r?\n")
|
private val NEWLINES = Regex("\r?\n")
|
||||||
|
|
||||||
fun truncate(input: String): String {
|
fun truncate(input: String): String {
|
||||||
|
@ -4,6 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack
|
|||||||
import net.minecraft.client.renderer.MultiBufferSource
|
import net.minecraft.client.renderer.MultiBufferSource
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
|
||||||
|
import net.minecraft.world.phys.AABB
|
||||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleGeneratorBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleGeneratorBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
|
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
|
||||||
import ru.dbotthepony.mc.otm.client.render.render
|
import ru.dbotthepony.mc.otm.client.render.render
|
||||||
@ -21,4 +22,12 @@ class BlackHoleGeneratorRenderer(private val context: BlockEntityRendererProvide
|
|||||||
tile.multiblock?.render(poseStack, DynamicBufferSource.WORLD, tile.blockPos)
|
tile.multiblock?.render(poseStack, DynamicBufferSource.WORLD, tile.blockPos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getRenderBoundingBox(blockEntity: BlackHoleGeneratorBlockEntity): AABB {
|
||||||
|
if (blockEntity.drawBuildingGuide) {
|
||||||
|
return blockEntity.multiblock?.boundingBox ?: super.getRenderBoundingBox(blockEntity)
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getRenderBoundingBox(blockEntity)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.minecraft.world.level.Level
|
|||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.phys.AABB
|
||||||
import ru.dbotthepony.mc.otm.core.collect.WeakHashSet
|
import ru.dbotthepony.mc.otm.core.collect.WeakHashSet
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@ -18,6 +19,8 @@ interface IMultiblockAccess {
|
|||||||
val currentDirection: Direction?
|
val currentDirection: Direction?
|
||||||
val currentNodes: Map<BlockPos, IMultiblockNode>
|
val currentNodes: Map<BlockPos, IMultiblockNode>
|
||||||
|
|
||||||
|
val boundingBox: AABB?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns block counts present on nodes tagged by [tag]
|
* Returns block counts present on nodes tagged by [tag]
|
||||||
*/
|
*/
|
||||||
|
@ -14,11 +14,14 @@ import net.minecraft.world.level.LevelAccessor
|
|||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.phys.AABB
|
||||||
|
import ru.dbotthepony.mc.otm.core.AABB
|
||||||
import ru.dbotthepony.mc.otm.core.addAll
|
import ru.dbotthepony.mc.otm.core.addAll
|
||||||
import ru.dbotthepony.mc.otm.core.collect.collect
|
import ru.dbotthepony.mc.otm.core.collect.collect
|
||||||
import ru.dbotthepony.mc.otm.core.collect.map
|
import ru.dbotthepony.mc.otm.core.collect.map
|
||||||
import ru.dbotthepony.mc.otm.core.getBlockEntityNow
|
import ru.dbotthepony.mc.otm.core.getBlockEntityNow
|
||||||
import ru.dbotthepony.mc.otm.core.getBlockStateNow
|
import ru.dbotthepony.mc.otm.core.getBlockStateNow
|
||||||
|
import ru.dbotthepony.mc.otm.core.math.Vector
|
||||||
import ru.dbotthepony.mc.otm.core.math.plus
|
import ru.dbotthepony.mc.otm.core.math.plus
|
||||||
import ru.dbotthepony.mc.otm.core.registryName
|
import ru.dbotthepony.mc.otm.core.registryName
|
||||||
import ru.dbotthepony.mc.otm.network.syncher.IRemoteState
|
import ru.dbotthepony.mc.otm.network.syncher.IRemoteState
|
||||||
@ -257,6 +260,13 @@ class ShapedMultiblock(pos: BlockPos, factory: ShapedMultiblockFactory) : IMulti
|
|||||||
override val currentNodes: Map<BlockPos, IMultiblockNode>
|
override val currentNodes: Map<BlockPos, IMultiblockNode>
|
||||||
get() = parts
|
get() = parts
|
||||||
|
|
||||||
|
override val boundingBox: AABB by lazy {
|
||||||
|
AABB(
|
||||||
|
Vector(parts.minOf { it.pos.x }.toDouble(), parts.minOf { it.pos.y }.toDouble(), parts.minOf { it.pos.z }.toDouble()),
|
||||||
|
Vector(parts.maxOf { it.pos.x + 1.0 }, parts.maxOf { it.pos.y + 1.0 }, parts.maxOf { it.pos.z + 1.0 }),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private val tag2BlockEntity = HashMap<BlockEntityTag<*>, BlockEntitySet<*>>()
|
private val tag2BlockEntity = HashMap<BlockEntityTag<*>, BlockEntitySet<*>>()
|
||||||
private val tag2BlockState = HashMap<Any, Reference2IntMap<BlockState>>()
|
private val tag2BlockState = HashMap<Any, Reference2IntMap<BlockState>>()
|
||||||
private val tag2Block = HashMap<Any, Reference2IntMap<Block>>()
|
private val tag2Block = HashMap<Any, Reference2IntMap<Block>>()
|
||||||
@ -525,6 +535,9 @@ class ShapedMultiblock(pos: BlockPos, factory: ShapedMultiblockFactory) : IMulti
|
|||||||
override val currentDirection: Direction?
|
override val currentDirection: Direction?
|
||||||
get() = if (isValid) activeConfig.currentDirection else null
|
get() = if (isValid) activeConfig.currentDirection else null
|
||||||
|
|
||||||
|
override val boundingBox: AABB?
|
||||||
|
get() = if (isValid) activeConfig.boundingBox else null
|
||||||
|
|
||||||
override val currentNodes: Map<BlockPos, IMultiblockNode>
|
override val currentNodes: Map<BlockPos, IMultiblockNode>
|
||||||
get() = activeConfig.parts
|
get() = activeConfig.parts
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user