Rename mattery block
This commit is contained in:
parent
e5e08fcf07
commit
7cce062ae5
@ -18,7 +18,7 @@ import ru.dbotthepony.mc.otm.registry.MBlocks
|
|||||||
import ru.dbotthepony.mc.otm.registry.MItems
|
import ru.dbotthepony.mc.otm.registry.MItems
|
||||||
import ru.dbotthepony.mc.otm.block.DriveViewerBlock
|
import ru.dbotthepony.mc.otm.block.DriveViewerBlock
|
||||||
import ru.dbotthepony.mc.otm.block.EnergyCounterBlock
|
import ru.dbotthepony.mc.otm.block.EnergyCounterBlock
|
||||||
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.PatternStorageBlock
|
import ru.dbotthepony.mc.otm.block.PatternStorageBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.data.LootTableBasicAppender
|
import ru.dbotthepony.mc.otm.data.LootTableBasicAppender
|
||||||
@ -254,12 +254,12 @@ object DataGen {
|
|||||||
|
|
||||||
blockStateProvider.lambda { provider ->
|
blockStateProvider.lambda { provider ->
|
||||||
with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) {
|
with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) {
|
||||||
for (facing in BlockMatteryRotatable.FACING.possibleValues) {
|
for (facing in RotatableMatteryBlock.FACING.possibleValues) {
|
||||||
part()
|
part()
|
||||||
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/drive_viewer_drive_part")))
|
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/drive_viewer_drive_part")))
|
||||||
.rotationY(facing.toYRotBlockstate())
|
.rotationY(facing.toYRotBlockstate())
|
||||||
.addModel()
|
.addModel()
|
||||||
.condition(BlockMatteryRotatable.FACING, facing)
|
.condition(RotatableMatteryBlock.FACING, facing)
|
||||||
.condition(DriveViewerBlock.DRIVE_PRESENT, true)
|
.condition(DriveViewerBlock.DRIVE_PRESENT, true)
|
||||||
|
|
||||||
for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) {
|
for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) {
|
||||||
@ -268,19 +268,19 @@ object DataGen {
|
|||||||
.rotationY(facing.toYRotBlockstate())
|
.rotationY(facing.toYRotBlockstate())
|
||||||
.addModel()
|
.addModel()
|
||||||
.condition(WorkerState.SEMI_WORKER_STATE, workState)
|
.condition(WorkerState.SEMI_WORKER_STATE, workState)
|
||||||
.condition(BlockMatteryRotatable.FACING, facing)
|
.condition(RotatableMatteryBlock.FACING, facing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) {
|
with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) {
|
||||||
for (facing in BlockMatteryRotatable.FACING.possibleValues) {
|
for (facing in RotatableMatteryBlock.FACING.possibleValues) {
|
||||||
for (i in 0 .. 7) {
|
for (i in 0 .. 7) {
|
||||||
part()
|
part()
|
||||||
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern/model$i")))
|
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern/model$i")))
|
||||||
.rotationY(facing.toYRotBlockstate())
|
.rotationY(facing.toYRotBlockstate())
|
||||||
.addModel()
|
.addModel()
|
||||||
.condition(BlockMatteryRotatable.FACING, facing)
|
.condition(RotatableMatteryBlock.FACING, facing)
|
||||||
.condition(PatternStorageBlock.PATTERN_STORAGE_DISKS_PROPS[i], true)
|
.condition(PatternStorageBlock.PATTERN_STORAGE_DISKS_PROPS[i], true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ object DataGen {
|
|||||||
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern_storage")))
|
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern_storage")))
|
||||||
.rotationY(facing.toYRotBlockstate())
|
.rotationY(facing.toYRotBlockstate())
|
||||||
.addModel()
|
.addModel()
|
||||||
.condition(BlockMatteryRotatable.FACING, facing)
|
.condition(RotatableMatteryBlock.FACING, facing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import net.minecraft.world.level.block.Block
|
|||||||
import net.minecraftforge.client.model.generators.BlockStateProvider
|
import net.minecraftforge.client.model.generators.BlockStateProvider
|
||||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
||||||
import ru.dbotthepony.mc.otm.block.BatteryBankBlock
|
import ru.dbotthepony.mc.otm.block.BatteryBankBlock
|
||||||
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.datagen.DataGen
|
import ru.dbotthepony.mc.otm.datagen.DataGen
|
||||||
import ru.dbotthepony.mc.otm.datagen.toYRotBlockstate
|
import ru.dbotthepony.mc.otm.datagen.toYRotBlockstate
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||||
@ -26,15 +26,15 @@ open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(even
|
|||||||
with(getMultipartBuilder(registry)) {
|
with(getMultipartBuilder(registry)) {
|
||||||
val battery_bank = models().getExistingFile(ResourceLocation("overdrive_that_matters:block/$block"))
|
val battery_bank = models().getExistingFile(ResourceLocation("overdrive_that_matters:block/$block"))
|
||||||
|
|
||||||
BlockMatteryRotatable.FACING.possibleValues.forEach {
|
RotatableMatteryBlock.FACING.possibleValues.forEach {
|
||||||
part().modelFile(battery_bank).rotationY(it.toYRotBlockstate()).addModel().condition(
|
part().modelFile(battery_bank).rotationY(it.toYRotBlockstate()).addModel().condition(
|
||||||
BlockMatteryRotatable.FACING, it)
|
RotatableMatteryBlock.FACING, it)
|
||||||
|
|
||||||
for (i in 0 .. 11) {
|
for (i in 0 .. 11) {
|
||||||
part().modelFile(
|
part().modelFile(
|
||||||
models().getExistingFile(ResourceLocation("overdrive_that_matters:$batteryPath$i"))
|
models().getExistingFile(ResourceLocation("overdrive_that_matters:$batteryPath$i"))
|
||||||
).rotationY(it.toYRotBlockstate()).addModel()
|
).rotationY(it.toYRotBlockstate()).addModel()
|
||||||
.condition(BlockMatteryRotatable.FACING, it)
|
.condition(RotatableMatteryBlock.FACING, it)
|
||||||
.condition(BatteryBankBlock.BATTERY_SLOTS_PROPS[i], true)
|
.condition(BatteryBankBlock.BATTERY_SLOTS_PROPS[i], true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,7 @@ import net.minecraft.world.level.block.state.BlockState
|
|||||||
import net.minecraftforge.client.model.generators.BlockStateProvider
|
import net.minecraftforge.client.model.generators.BlockStateProvider
|
||||||
import net.minecraftforge.client.model.generators.ConfiguredModel
|
import net.minecraftforge.client.model.generators.ConfiguredModel
|
||||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
||||||
import ru.dbotthepony.mc.otm.block.BlockMattery
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
|
||||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.datagen.DataGen
|
import ru.dbotthepony.mc.otm.datagen.DataGen
|
||||||
import ru.dbotthepony.mc.otm.datagen.getValueNullable
|
import ru.dbotthepony.mc.otm.datagen.getValueNullable
|
||||||
@ -20,11 +19,11 @@ private data class AdvancedBlockStateEntry(val block: Block, val func: AdvancedB
|
|||||||
private fun initialTransform(it: BlockState, modelPath: String, builder: ConfiguredModel.Builder<*>): String {
|
private fun initialTransform(it: BlockState, modelPath: String, builder: ConfiguredModel.Builder<*>): String {
|
||||||
@Suppress("NAME_SHADOWING") var modelPath = modelPath
|
@Suppress("NAME_SHADOWING") var modelPath = modelPath
|
||||||
|
|
||||||
it.getValueNullable(BlockMatteryRotatable.FACING)?.let {
|
it.getValueNullable(RotatableMatteryBlock.FACING)?.let {
|
||||||
builder.rotationY(it.toYRotBlockstate())
|
builder.rotationY(it.toYRotBlockstate())
|
||||||
}
|
}
|
||||||
|
|
||||||
it.getValueNullable(BlockMatteryRotatable.FACING_FULL)?.let {
|
it.getValueNullable(RotatableMatteryBlock.FACING_FULL)?.let {
|
||||||
builder.rotationY(it.toYRotBlockstate())
|
builder.rotationY(it.toYRotBlockstate())
|
||||||
builder.rotationX(it.toXRotBlockstate())
|
builder.rotationX(it.toXRotBlockstate())
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import ru.dbotthepony.mc.otm.orNull
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class AndroidStationBlock : BlockMattery(), EntityBlock {
|
class AndroidStationBlock : MatteryBlock(), EntityBlock {
|
||||||
override fun use(
|
override fun use(
|
||||||
blockState: BlockState,
|
blockState: BlockState,
|
||||||
level: Level,
|
level: Level,
|
||||||
|
@ -23,7 +23,7 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
|||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
class BatteryBankBlock : BlockMatteryRotatable(), EntityBlock {
|
class BatteryBankBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState {
|
override fun getStateForPlacement(context: BlockPlaceContext): BlockState {
|
||||||
var state = super.getStateForPlacement(context)!!
|
var state = super.getStateForPlacement(context)!!
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import net.minecraft.world.level.block.state.StateDefinition
|
|||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||||
import ru.dbotthepony.mc.otm.block.entity.CargoCrateBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.CargoCrateBlockEntity
|
||||||
|
|
||||||
class CargoCrateBlock : BlockMatteryRotatable(), EntityBlock {
|
class CargoCrateBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return CargoCrateBlockEntity(blockPos, blockState)
|
return CargoCrateBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
import ru.dbotthepony.mc.otm.tickOnceServer
|
import ru.dbotthepony.mc.otm.tickOnceServer
|
||||||
|
|
||||||
class ChemicalGeneratorBlock : BlockMatteryRotatable(), EntityBlock {
|
class ChemicalGeneratorBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return ChemicalGeneratorBlockEntity(p_153215_, p_153216_)
|
return ChemicalGeneratorBlockEntity(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.block.entity.DriveRackBlockEntity
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class DriveRackBlock : BlockMatteryRotatable(), EntityBlock {
|
class DriveRackBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return DriveRackBlockEntity(blockPos, blockState)
|
return DriveRackBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.block.entity.DriveViewerBlockEntity
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
|
|
||||||
class DriveViewerBlock : BlockMatteryRotatable(), EntityBlock {
|
class DriveViewerBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return DriveViewerBlockEntity(blockPos, blockState)
|
return DriveViewerBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import ru.dbotthepony.mc.otm.block.entity.EnergyCounterBlockEntity
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class EnergyCounterBlock : BlockMattery(), EntityBlock {
|
class EnergyCounterBlock : MatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return EnergyCounterBlockEntity(blockPos, blockState)
|
return EnergyCounterBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ import kotlin.math.PI
|
|||||||
|
|
||||||
private val props = BlockBehaviour.Properties.of(Material.STONE, MaterialColor.COLOR_BLUE).requiresCorrectToolForDrops().strength(3f, 600.0f)
|
private val props = BlockBehaviour.Properties.of(Material.STONE, MaterialColor.COLOR_BLUE).requiresCorrectToolForDrops().strength(3f, 600.0f)
|
||||||
|
|
||||||
class BlockGravitationStabilizer : BlockMatteryRotatable(props), EntityBlock {
|
class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return GravitationStabilizerBlockEntity(p_153215_, p_153216_)
|
return GravitationStabilizerBlockEntity(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ class BlockGravitationStabilizer : BlockMatteryRotatable(props), EntityBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlockGravitationStabilizerLens : BlockMatteryRotatable(props) {
|
class BlockGravitationStabilizerLens : RotatableMatteryBlock(props) {
|
||||||
override val hasFreeRotation: Boolean get() = true
|
override val hasFreeRotation: Boolean get() = true
|
||||||
|
|
||||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||||
|
@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.block.entity.ItemMonitorBlockEntity
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class ItemMonitorBlock : BlockMatteryRotatable(), EntityBlock {
|
class ItemMonitorBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return ItemMonitorBlockEntity(blockPos, blockState)
|
return ItemMonitorBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
|||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
class MatterBottlerBlock : BlockMatteryRotatable(), EntityBlock {
|
class MatterBottlerBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity? {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity? {
|
||||||
return MatterBottlerBlockEntity(blockPos, blockState)
|
return MatterBottlerBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import net.minecraft.world.phys.shapes.VoxelShape
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.MatterCapacitorBankBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatterCapacitorBankBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterCapacitorBankBlock : BlockMatteryRotatable(), EntityBlock {
|
class MatterCapacitorBankBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterCapacitorBankBlockEntity(blockPos, blockState)
|
return MatterCapacitorBankBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
|||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
class MatterDecomposerBlock : BlockMatteryRotatable(), EntityBlock {
|
class MatterDecomposerBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterDecomposerBlockEntity(blockPos, blockState)
|
return MatterDecomposerBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import net.minecraft.world.item.context.BlockPlaceContext
|
|||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.state.properties.EnumProperty
|
import net.minecraft.world.level.block.state.properties.EnumProperty
|
||||||
|
|
||||||
class MatterPanelBlock : BlockMattery(), EntityBlock {
|
class MatterPanelBlock : MatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterPanelBlockEntity(blockPos, blockState)
|
return MatterPanelBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import ru.dbotthepony.mc.otm.block.entity.MatterRecyclerBlockEntity
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
|
|
||||||
class MatterRecyclerBlock : BlockMatteryRotatable(), EntityBlock {
|
class MatterRecyclerBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return MatterRecyclerBlockEntity(p_153215_, p_153216_)
|
return MatterRecyclerBlockEntity(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterReplicatorBlock : BlockMatteryRotatable(), EntityBlock {
|
class MatterReplicatorBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterReplicatorBlockEntity(blockPos, blockState)
|
return MatterReplicatorBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterScannerBlock : BlockMatteryRotatable(), EntityBlock {
|
class MatterScannerBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterScannerBlockEntity(blockPos, blockState)
|
return MatterScannerBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import net.minecraft.world.level.material.MaterialColor
|
|||||||
import net.minecraft.world.phys.BlockHitResult
|
import net.minecraft.world.phys.BlockHitResult
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||||
|
|
||||||
abstract class BlockMattery @JvmOverloads constructor(
|
abstract class MatteryBlock @JvmOverloads constructor(
|
||||||
properties: Properties = DEFAULT_PROPERTIES
|
properties: Properties = DEFAULT_PROPERTIES
|
||||||
) : Block(properties) {
|
) : Block(properties) {
|
||||||
override fun setPlacedBy(
|
override fun setPlacedBy(
|
||||||
@ -87,7 +87,7 @@ abstract class BlockMattery @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class BlockMatteryRotatable @JvmOverloads constructor(properties: Properties = DEFAULT_PROPERTIES) : BlockMattery(properties) {
|
abstract class RotatableMatteryBlock @JvmOverloads constructor(properties: Properties = DEFAULT_PROPERTIES) : MatteryBlock(properties) {
|
||||||
init {
|
init {
|
||||||
registerDefaultState(getStateDefinition().any().setValue(facingProperty(), Direction.SOUTH))
|
registerDefaultState(getStateDefinition().any().setValue(facingProperty(), Direction.SOUTH))
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import net.minecraft.world.phys.shapes.VoxelShape
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.PatternStorageBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.PatternStorageBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class PatternStorageBlock : BlockMatteryRotatable(), EntityBlock {
|
class PatternStorageBlock : RotatableMatteryBlock(), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity? {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity? {
|
||||||
return PatternStorageBlockEntity(blockPos, blockState)
|
return PatternStorageBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class PlatePressBlock(properties: Properties = DEFAULT_PROPERTIES) : BlockMatteryRotatable(properties), EntityBlock {
|
class PlatePressBlock(properties: Properties = DEFAULT_PROPERTIES) : RotatableMatteryBlock(properties), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return PlatePressBlockEntity(p_153215_, p_153216_)
|
return PlatePressBlockEntity(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import net.minecraftforge.energy.CapabilityEnergy
|
|||||||
import net.minecraftforge.energy.IEnergyStorage
|
import net.minecraftforge.energy.IEnergyStorage
|
||||||
import net.minecraftforge.items.CapabilityItemHandler
|
import net.minecraftforge.items.CapabilityItemHandler
|
||||||
import ru.dbotthepony.mc.otm.block.BatteryBankBlock
|
import ru.dbotthepony.mc.otm.block.BatteryBankBlock
|
||||||
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.capability.*
|
import ru.dbotthepony.mc.otm.capability.*
|
||||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||||
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
|
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
|
||||||
@ -249,7 +249,7 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte
|
|||||||
if (cap === MatteryCapability.ENERGY || cap === CapabilityEnergy.ENERGY) {
|
if (cap === MatteryCapability.ENERGY || cap === CapabilityEnergy.ENERGY) {
|
||||||
if (side == null) return resolverEnergy.cast()
|
if (side == null) return resolverEnergy.cast()
|
||||||
|
|
||||||
if (side == blockState.getValue(BlockMatteryRotatable.FACING))
|
if (side == blockState.getValue(RotatableMatteryBlock.FACING))
|
||||||
return resolverEnergyExtractor.cast()
|
return resolverEnergyExtractor.cast()
|
||||||
else
|
else
|
||||||
return resolverEnergyReceive.cast()
|
return resolverEnergyReceive.cast()
|
||||||
@ -268,7 +268,7 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte
|
|||||||
fun checkSurroundings(level: Level) {
|
fun checkSurroundings(level: Level) {
|
||||||
if (isRemoved) return
|
if (isRemoved) return
|
||||||
|
|
||||||
val tile = level.getBlockEntity(blockPos.offset(blockState.getValue(BlockMatteryRotatable.FACING).normal))
|
val tile = level.getBlockEntity(blockPos.offset(blockState.getValue(RotatableMatteryBlock.FACING).normal))
|
||||||
|
|
||||||
if (tile == null) {
|
if (tile == null) {
|
||||||
outputCapability = LazyOptional.empty()
|
outputCapability = LazyOptional.empty()
|
||||||
@ -279,7 +279,7 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte
|
|||||||
outputCapability,
|
outputCapability,
|
||||||
tile,
|
tile,
|
||||||
CapabilityEnergy.ENERGY,
|
CapabilityEnergy.ENERGY,
|
||||||
-blockState.getValue(BlockMatteryRotatable.FACING)
|
-blockState.getValue(RotatableMatteryBlock.FACING)
|
||||||
) {
|
) {
|
||||||
@Suppress("name_shadowing")
|
@Suppress("name_shadowing")
|
||||||
val level = this.level
|
val level = this.level
|
||||||
|
@ -20,7 +20,7 @@ import net.minecraftforge.energy.CapabilityEnergy
|
|||||||
import net.minecraftforge.energy.IEnergyStorage
|
import net.minecraftforge.energy.IEnergyStorage
|
||||||
import net.minecraftforge.items.CapabilityItemHandler
|
import net.minecraftforge.items.CapabilityItemHandler
|
||||||
import ru.dbotthepony.mc.otm.*
|
import ru.dbotthepony.mc.otm.*
|
||||||
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.capability.*
|
import ru.dbotthepony.mc.otm.capability.*
|
||||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||||
@ -50,7 +50,7 @@ class ChemicalGeneratorBlockEntity(pos: BlockPos, state: BlockState) : MatteryBl
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
|
override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
|
||||||
if (valid && (cap === MatteryCapability.ENERGY || cap === CapabilityEnergy.ENERGY) && side !== blockState.getValue(BlockMatteryRotatable.FACING))
|
if (valid && (cap === MatteryCapability.ENERGY || cap === CapabilityEnergy.ENERGY) && side !== blockState.getValue(RotatableMatteryBlock.FACING))
|
||||||
return energy.resolver.cast()
|
return energy.resolver.cast()
|
||||||
|
|
||||||
if (valid && cap === CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
if (valid && cap === CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||||
@ -116,7 +116,7 @@ class ChemicalGeneratorBlockEntity(pos: BlockPos, state: BlockState) : MatteryBl
|
|||||||
|
|
||||||
for (direction in Direction.values()) {
|
for (direction in Direction.values()) {
|
||||||
// нельзя выталкивать энергию через перед
|
// нельзя выталкивать энергию через перед
|
||||||
if (direction == blockState.getValue(BlockMatteryRotatable.FACING))
|
if (direction == blockState.getValue(RotatableMatteryBlock.FACING))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
val resolver = level.getBlockEntity(blockPos + direction)?.getEnergySided(-direction)
|
val resolver = level.getBlockEntity(blockPos + direction)?.getEnergySided(-direction)
|
||||||
|
@ -11,7 +11,7 @@ import net.minecraft.world.level.block.state.BlockState
|
|||||||
import net.minecraft.world.phys.AABB
|
import net.minecraft.world.phys.AABB
|
||||||
import ru.dbotthepony.mc.otm.block.BlockGravitationStabilizer
|
import ru.dbotthepony.mc.otm.block.BlockGravitationStabilizer
|
||||||
import ru.dbotthepony.mc.otm.block.BlockGravitationStabilizerLens
|
import ru.dbotthepony.mc.otm.block.BlockGravitationStabilizerLens
|
||||||
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.core.plus
|
import ru.dbotthepony.mc.otm.core.plus
|
||||||
@ -27,7 +27,7 @@ class GravitationStabilizerBlockEntity(p_155229_: BlockPos, p_155230_: BlockStat
|
|||||||
|
|
||||||
fun tick(level: Level) {
|
fun tick(level: Level) {
|
||||||
var findBlackHole: BlackHoleBlockEntity? = null
|
var findBlackHole: BlackHoleBlockEntity? = null
|
||||||
val dir = blockState.getValue(BlockMatteryRotatable.FACING_FULL).normal
|
val dir = blockState.getValue(RotatableMatteryBlock.FACING_FULL).normal
|
||||||
|
|
||||||
for (i in 2 .. RANGE) {
|
for (i in 2 .. RANGE) {
|
||||||
val pos = blockPos + dir * i
|
val pos = blockPos + dir * i
|
||||||
|
@ -12,7 +12,7 @@ import net.minecraft.client.renderer.texture.OverlayTexture
|
|||||||
import net.minecraft.core.Direction
|
import net.minecraft.core.Direction
|
||||||
import net.minecraft.network.chat.TranslatableComponent
|
import net.minecraft.network.chat.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.block.BlackHoleBlock
|
import ru.dbotthepony.mc.otm.block.BlackHoleBlock
|
||||||
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.GravitationStabilizerBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.GravitationStabilizerBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
@ -37,7 +37,7 @@ class GravitationStabilizerRenderer(private val context: BlockEntityRendererProv
|
|||||||
|
|
||||||
var len = 64.0
|
var len = 64.0
|
||||||
var lenI = 64
|
var lenI = 64
|
||||||
val normal = tile.blockState.getValue(BlockMatteryRotatable.FACING_FULL).normal
|
val normal = tile.blockState.getValue(RotatableMatteryBlock.FACING_FULL).normal
|
||||||
val level = tile.level
|
val level = tile.level
|
||||||
var bhTile: BlackHoleBlockEntity? = null
|
var bhTile: BlackHoleBlockEntity? = null
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class GravitationStabilizerRenderer(private val context: BlockEntityRendererProv
|
|||||||
poseStack.pushPose()
|
poseStack.pushPose()
|
||||||
poseStack.translate(0.5, 0.5, 0.5)
|
poseStack.translate(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
val facing: Direction = tile.blockState.getValue(BlockMatteryRotatable.FACING_FULL)
|
val facing: Direction = tile.blockState.getValue(RotatableMatteryBlock.FACING_FULL)
|
||||||
|
|
||||||
val rotateZ: Double
|
val rotateZ: Double
|
||||||
val rotateY: Double
|
val rotateY: Double
|
||||||
|
Loading…
Reference in New Issue
Block a user