Move Multiblock subpackage to root

This commit is contained in:
DBotThePony 2025-03-30 15:32:32 +07:00
parent 4c41128b37
commit 078b3dba9a
Signed by: DBot
GPG Key ID: DCC23B5715498507
24 changed files with 43 additions and 50 deletions

View File

@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import ru.dbotthepony.mc.otm.core.multiblock.GlobalBlockEntityRemovalListener;
import ru.dbotthepony.mc.otm.multiblock.GlobalBlockEntityRemovalListener;
// because i know
// someone

View File

@ -6,9 +6,9 @@ import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.entity.FurnaceBlockEntity
import net.minecraft.world.level.block.entity.HopperBlockEntity
import net.minecraft.world.level.block.state.BlockState
import ru.dbotthepony.mc.otm.core.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.core.multiblock.multiblockEntity
import ru.dbotthepony.mc.otm.core.multiblock.shapedMultiblock
import ru.dbotthepony.mc.otm.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.multiblock.multiblockEntity
import ru.dbotthepony.mc.otm.multiblock.shapedMultiblock
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
import ru.dbotthepony.mc.otm.registry.game.MBlocks

View File

@ -25,15 +25,15 @@ import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.config.ServerConfig
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.core.collect.map
import ru.dbotthepony.mc.otm.core.multiblock.ShapedMultiblock
import ru.dbotthepony.mc.otm.multiblock.ShapedMultiblock
import ru.dbotthepony.mc.otm.core.getBlockStateNow
import ru.dbotthepony.mc.otm.core.immutableList
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.math.plus
import ru.dbotthepony.mc.otm.core.math.times
import ru.dbotthepony.mc.otm.core.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.core.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.core.multiblock.shapedMultiblock
import ru.dbotthepony.mc.otm.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.multiblock.shapedMultiblock
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.util.InvalidableLazy
import ru.dbotthepony.mc.otm.menu.tech.BlackHoleGeneratorMenu

View File

@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState
import net.neoforged.neoforge.capabilities.Capabilities
@ -19,7 +18,7 @@ import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.container.slotted.AutomationFilters
import ru.dbotthepony.mc.otm.container.slotted.SlottedContainer
import ru.dbotthepony.mc.otm.core.math.RelativeSide
import ru.dbotthepony.mc.otm.core.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.menu.tech.EnergyHatchMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities

View File

@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState
import net.neoforged.neoforge.capabilities.Capabilities
@ -21,9 +20,9 @@ import ru.dbotthepony.mc.otm.capability.moveEnergy
import ru.dbotthepony.mc.otm.container.slotted.AutomationFilters
import ru.dbotthepony.mc.otm.container.slotted.SlottedContainer
import ru.dbotthepony.mc.otm.core.math.RelativeSide
import ru.dbotthepony.mc.otm.core.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.core.multiblock.IMultiblockAccess
import ru.dbotthepony.mc.otm.core.multiblock.IMultiblockListener
import ru.dbotthepony.mc.otm.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.multiblock.IMultiblockAccess
import ru.dbotthepony.mc.otm.multiblock.IMultiblockListener
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.util.InvalidableLazy
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities

View File

@ -4,30 +4,26 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectFunction
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
import it.unimi.dsi.fastutil.objects.Reference2IntMap
import net.minecraft.core.BlockPos
import net.minecraft.core.SectionPos
import net.minecraft.core.Vec3i
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.state.BlockState
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
import ru.dbotthepony.mc.otm.capability.FlowDirection
import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage
import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage
import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.core.getBlockStateNow
import ru.dbotthepony.mc.otm.core.getChunkNow
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.math.plus
import ru.dbotthepony.mc.otm.core.math.times
import ru.dbotthepony.mc.otm.core.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.core.multiblock.ShapedMultiblock
import ru.dbotthepony.mc.otm.core.multiblock.ShapedMultiblockFactory
import ru.dbotthepony.mc.otm.core.multiblock.Strategy
import ru.dbotthepony.mc.otm.core.multiblock.shapedMultiblock
import ru.dbotthepony.mc.otm.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.multiblock.ShapedMultiblock
import ru.dbotthepony.mc.otm.multiblock.ShapedMultiblockFactory
import ru.dbotthepony.mc.otm.multiblock.Strategy
import ru.dbotthepony.mc.otm.multiblock.shapedMultiblock
import ru.dbotthepony.mc.otm.data.FlywheelMaterials
import ru.dbotthepony.mc.otm.menu.tech.FlywheelBatteryMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities

View File

@ -11,7 +11,7 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
import ru.dbotthepony.mc.otm.block.entity.decorative.CargoCrateBlockEntity
import ru.dbotthepony.mc.otm.container.slotted.AutomationFilters
import ru.dbotthepony.mc.otm.container.slotted.SlottedContainer
import ru.dbotthepony.mc.otm.core.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.menu.tech.ItemHatchMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities

View File

@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState
import net.neoforged.neoforge.capabilities.Capabilities
@ -18,7 +17,7 @@ import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.container.slotted.AutomationFilters
import ru.dbotthepony.mc.otm.container.slotted.SlottedContainer
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.menu.tech.MatterHatchMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities

View File

@ -15,8 +15,8 @@ import ru.dbotthepony.mc.otm.core.math.component1
import ru.dbotthepony.mc.otm.core.math.component2
import ru.dbotthepony.mc.otm.core.math.component3
import ru.dbotthepony.mc.otm.core.math.minus
import ru.dbotthepony.mc.otm.core.multiblock.IMultiblockAccess
import ru.dbotthepony.mc.otm.core.multiblock.NodeStatus
import ru.dbotthepony.mc.otm.multiblock.IMultiblockAccess
import ru.dbotthepony.mc.otm.multiblock.NodeStatus
private val UNKNOWN = RGBAColor.YELLOW.copy(alpha = 0.5f)
private val VALID = RGBAColor.DARK_GREEN.copy(alpha = 0.5f)

View File

@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.menu.tech
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleGeneratorBlockEntity
import ru.dbotthepony.mc.otm.core.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.menu.MatteryMenu
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
import ru.dbotthepony.mc.otm.menu.input.DecimalInputWithFeedback

View File

@ -1,8 +1,8 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap
import net.minecraft.world.level.block.entity.BlockEntity
import java.util.Collections
import java.util.*
class BlockEntitySet<T : Any>(private val listener: GlobalBlockEntityRemovalListener, val tag: BlockEntityTag<T>) {
private val items = Reference2IntOpenHashMap<T>()

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import net.minecraft.world.level.block.entity.BlockEntity
import java.util.function.Predicate

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import com.google.common.collect.ImmutableSet
import net.minecraft.core.BlockPos

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.entity.BlockEntity

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import it.unimi.dsi.fastutil.objects.Reference2IntMap
import net.minecraft.core.BlockPos

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
interface IMultiblockListener {
fun onAddedToMultiblock(multiblock: IMultiblockAccess)

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import net.minecraft.core.BlockPos
import net.minecraft.world.level.block.state.BlockState

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
enum class MultiblockStatus {
/**

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
enum class NodeStatus {
UNKNOWN,

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import com.google.common.collect.ImmutableList
import com.google.common.collect.ImmutableMap
@ -36,7 +36,8 @@ import kotlin.collections.HashMap
/**
* [close] MUST be called when multiblock goes out of scope
*/
class ShapedMultiblock(pos: BlockPos, factory: ShapedMultiblockFactory) : IMultiblockAccess, ISynchable, Closeable, GlobalBlockEntityRemovalListener {
class ShapedMultiblock(pos: BlockPos, factory: ShapedMultiblockFactory) : IMultiblockAccess, ISynchable, Closeable,
GlobalBlockEntityRemovalListener {
override var isValid: MultiblockStatus = MultiblockStatus.INVALID
private set
@ -69,8 +70,10 @@ class ShapedMultiblock(pos: BlockPos, factory: ShapedMultiblockFactory) : IMulti
override val hasRemotes: Boolean
get() = remotes.isNotEmpty()
private inner class Config(override val currentDirection: Direction, val pos: BlockPos, parts: Collection<ShapedMultiblockFactory.Part>) : IMultiblockAccess, ISynchable, GlobalBlockEntityRemovalListener, Comparable<Config> {
private inner class Part private constructor(override val pos: BlockPos, val prototype: ShapedMultiblockFactory.Part, val chunkPos: ChunkPos) : Comparable<Part>, IMultiblockNode {
private inner class Config(override val currentDirection: Direction, val pos: BlockPos, parts: Collection<ShapedMultiblockFactory.Part>) : IMultiblockAccess, ISynchable,
GlobalBlockEntityRemovalListener, Comparable<Config> {
private inner class Part private constructor(override val pos: BlockPos, val prototype: ShapedMultiblockFactory.Part, val chunkPos: ChunkPos) : Comparable<Part>,
IMultiblockNode {
constructor(pos: BlockPos, prototype: ShapedMultiblockFactory.Part) : this(pos, prototype, ChunkPos(pos))
var index = -1

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import com.google.common.collect.ImmutableList
import com.google.common.collect.ImmutableSet
@ -6,15 +6,12 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap
import it.unimi.dsi.fastutil.objects.ObjectArraySet
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.core.SectionPos
import net.minecraft.core.Vec3i
import net.minecraft.tags.TagKey
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.chunk.status.ChunkStatus
import ru.dbotthepony.mc.otm.core.collect.collect
import ru.dbotthepony.mc.otm.core.collect.map
import ru.dbotthepony.mc.otm.core.getBlockStateNow
import ru.dbotthepony.mc.otm.core.math.RelativeSide
import ru.dbotthepony.mc.otm.core.math.plus
import java.util.function.Predicate

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
import com.google.common.collect.ImmutableList
import com.google.common.collect.ImmutableSet

View File

@ -1,4 +1,4 @@
package ru.dbotthepony.mc.otm.core.multiblock
package ru.dbotthepony.mc.otm.multiblock
enum class Strategy {
/**