Specify proper piston push behavior for most blocks

This commit is contained in:
DBotThePony 2024-01-01 16:37:42 +07:00
parent 50112bfbaf
commit 64b8346424
Signed by: DBot
GPG Key ID: DCC23B5715498507
37 changed files with 57 additions and 44 deletions

View File

@ -19,6 +19,7 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition 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 net.minecraft.world.level.material.MapColor import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import net.minecraft.world.phys.BlockHitResult import net.minecraft.world.phys.BlockHitResult
import net.minecraft.world.phys.shapes.BooleanOp import net.minecraft.world.phys.shapes.BooleanOp
import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.CollisionContext
@ -113,7 +114,7 @@ abstract class CableBlock(properties: Properties) : MatteryBlock(properties) {
} }
} }
class MatterCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock { class MatterCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().pushReaction(PushReaction.DESTROY).sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
private val shapes = generateShapes(0.15) private val shapes = generateShapes(0.15)
@Suppress("OVERRIDE_DEPRECATION") @Suppress("OVERRIDE_DEPRECATION")
@ -126,7 +127,7 @@ class MatterCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).req
} }
} }
class StorageCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock { class StorageCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().pushReaction(PushReaction.DESTROY).sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
private val shapes = generateShapes(0.185) private val shapes = generateShapes(0.185)
@Suppress("OVERRIDE_DEPRECATION") @Suppress("OVERRIDE_DEPRECATION")
@ -139,7 +140,7 @@ class StorageCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).re
} }
} }
class EnergyCableBlock(val factory: (blockPos: BlockPos, blockState: BlockState) -> BlockEntity) : CableBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock { class EnergyCableBlock(val factory: (blockPos: BlockPos, blockState: BlockState) -> BlockEntity) : CableBlock(Properties.of().mapColor(MapColor.METAL).pushReaction(PushReaction.DESTROY).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
private val shapes = generateShapes(0.185) private val shapes = generateShapes(0.185)
@Suppress("OVERRIDE_DEPRECATION") @Suppress("OVERRIDE_DEPRECATION")

View File

@ -9,11 +9,12 @@ import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.entity.BlockEntityTicker import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.PushReaction
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger
import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MBlockEntities
class BlockExplosionDebugger : Block(Properties.of().sound(SoundType.STONE)), EntityBlock { class BlockExplosionDebugger : Block(Properties.of().sound(SoundType.STONE).pushReaction(PushReaction.BLOCK)), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
return BlockEntityExplosionDebugger(p_153215_, p_153216_) return BlockEntityExplosionDebugger(p_153215_, p_153216_)
} }

View File

@ -21,6 +21,7 @@ import net.minecraft.world.level.block.EntityBlock
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.properties.Property import net.minecraft.world.level.block.state.properties.Property
import net.minecraft.world.level.material.MapColor import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import net.minecraft.world.phys.BlockHitResult import net.minecraft.world.phys.BlockHitResult
import net.minecraft.world.phys.shapes.VoxelShape import net.minecraft.world.phys.shapes.VoxelShape
import ru.dbotthepony.mc.otm.block.entity.IRedstoneControlled import ru.dbotthepony.mc.otm.block.entity.IRedstoneControlled
@ -239,6 +240,7 @@ abstract class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block
companion object { companion object {
val DEFAULT_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f) val DEFAULT_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
val DEFAULT_MACHINE_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
} }
} }

View File

@ -4,10 +4,11 @@ import net.minecraft.core.BlockPos
import net.minecraft.world.level.block.EntityBlock import net.minecraft.world.level.block.EntityBlock
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.level.material.PushReaction
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity
class DevChestBlock : RotatableMatteryBlock(Properties.of().destroyTime(-1f).explosionResistance(360000f)), EntityBlock { class DevChestBlock : RotatableMatteryBlock(Properties.of().destroyTime(-1f).explosionResistance(360000f).pushReaction(PushReaction.BLOCK)), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
return DevChestBlockEntity(p_153215_, p_153216_) return DevChestBlockEntity(p_153215_, p_153216_)
} }

View File

@ -9,6 +9,7 @@ import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.block.SoundType import net.minecraft.world.level.block.SoundType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.MapColor import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.VoxelShape import net.minecraft.world.phys.shapes.VoxelShape
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
@ -17,7 +18,7 @@ import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_ORANGE).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) { class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_ORANGE).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops().pushReaction(PushReaction.NORMAL)) {
override fun appendHoverText( override fun appendHoverText(
p_49816_: ItemStack, p_49816_: ItemStack,
p_49817_: BlockGetter?, p_49817_: BlockGetter?,

View File

@ -21,7 +21,7 @@ import ru.dbotthepony.mc.otm.block.getShapeForEachState
import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class FluidTankBlock : RotatableMatteryBlock(), EntityBlock { class FluidTankBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity { override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
return FluidTankBlockEntity(pPos, pState) return FluidTankBlockEntity(pPos, pState)
} }

View File

@ -13,7 +13,7 @@ import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class HoloSignBlock : RotatableMatteryBlock(), EntityBlock { class HoloSignBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun rotationFreedom(): BlockRotationFreedom { override fun rotationFreedom(): BlockRotationFreedom {
return BlockRotationFreedom.DIRECTIONAL_WITH_ROTATION return BlockRotationFreedom.DIRECTIONAL_WITH_ROTATION
} }

View File

@ -8,10 +8,11 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.MapColor import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
import ru.dbotthepony.mc.otm.block.entity.decorative.InfiniteWaterSourceBlockEntity import ru.dbotthepony.mc.otm.block.entity.decorative.InfiniteWaterSourceBlockEntity
class InfiniteWaterSourceBlock : RotatableMatteryBlock(Properties.of().destroyTime(1.5f).explosionResistance(10f).requiresCorrectToolForDrops().mapColor(MapColor.WATER)), EntityBlock { class InfiniteWaterSourceBlock : RotatableMatteryBlock(Properties.of().destroyTime(1.5f).explosionResistance(10f).pushReaction(PushReaction.NORMAL).requiresCorrectToolForDrops().mapColor(MapColor.WATER)), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
return InfiniteWaterSourceBlockEntity(p_153215_, p_153216_) return InfiniteWaterSourceBlockEntity(p_153215_, p_153216_)
} }

View File

@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BlockStateProperties import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.material.MapColor import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.Shapes import net.minecraft.world.phys.shapes.Shapes
import net.minecraft.world.phys.shapes.VoxelShape import net.minecraft.world.phys.shapes.VoxelShape
@ -28,7 +29,7 @@ import ru.dbotthepony.mc.otm.registry.MBlocks
private val FACING_FULL = BlockRotationFreedom.DIRECTIONAL.property private val FACING_FULL = BlockRotationFreedom.DIRECTIONAL.property
class LaboratoryLampLight : Block(Properties.of().strength(-1.0F, 3600000.8F).noCollission().noLootTable().replaceable().lightLevel { 15 }) { class LaboratoryLampLight : Block(Properties.of().strength(-1.0F, 3600000.8F).noCollission().noLootTable().replaceable().pushReaction(PushReaction.DESTROY).lightLevel { 15 }) {
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) { override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
super.createBlockStateDefinition(builder) super.createBlockStateDefinition(builder)
builder.add(FACING_FULL) builder.add(FACING_FULL)
@ -102,7 +103,7 @@ class LaboratoryLampLight : Block(Properties.of().strength(-1.0F, 3600000.8F).no
} }
} }
class LaboratoryLamp(val invertRedstone: Boolean) : Block(Properties.of().mapColor(MapColor.METAL).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()) { class LaboratoryLamp(val invertRedstone: Boolean) : Block(Properties.of().mapColor(MapColor.METAL).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops().pushReaction(PushReaction.BLOCK)) {
init { init {
registerDefaultState(stateDefinition.any().setValue(BlockStateProperties.LIT, !invertRedstone)) registerDefaultState(stateDefinition.any().setValue(BlockStateProperties.LIT, !invertRedstone))
} }

View File

@ -10,7 +10,7 @@ import net.minecraft.world.level.block.state.BlockState
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
import ru.dbotthepony.mc.otm.block.entity.decorative.PainterBlockEntity import ru.dbotthepony.mc.otm.block.entity.decorative.PainterBlockEntity
class PainterBlock : RotatableMatteryBlock(), EntityBlock { class PainterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
return PainterBlockEntity(p_153215_, p_153216_) return PainterBlockEntity(p_153215_, p_153216_)
} }

View File

@ -22,8 +22,8 @@ import ru.dbotthepony.mc.otm.core.get
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 MatterBottlerBlock : RotatableMatteryBlock(), EntityBlock { class MatterBottlerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -18,7 +18,7 @@ import ru.dbotthepony.mc.otm.block.getShapeForEachState
import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class MatterCapacitorBankBlock : RotatableMatteryBlock(), EntityBlock { class MatterCapacitorBankBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -22,9 +22,7 @@ import ru.dbotthepony.mc.otm.core.get
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
@MethodsReturnNonnullByDefault class MatterDecomposerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
@ParametersAreNonnullByDefault
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)
} }

View File

@ -10,7 +10,7 @@ import net.minecraft.world.level.block.state.BlockState
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
import ru.dbotthepony.mc.otm.block.entity.matter.MatterEntanglerBlockEntity import ru.dbotthepony.mc.otm.block.entity.matter.MatterEntanglerBlockEntity
class MatterEntanglerBlock : RotatableMatteryBlock(), EntityBlock { class MatterEntanglerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity { override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
return MatterEntanglerBlockEntity(blockPos, blockState) return MatterEntanglerBlockEntity(blockPos, blockState)
} }

View File

@ -17,7 +17,7 @@ import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.math.BlockRotation import ru.dbotthepony.mc.otm.core.math.BlockRotation
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
class MatterPanelBlock : RotatableMatteryBlock(), EntityBlock { class MatterPanelBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -16,7 +16,7 @@ import ru.dbotthepony.mc.otm.block.getShapeForEachState
import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class MatterReconstructorBlock : RotatableMatteryBlock(), EntityBlock { class MatterReconstructorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity { override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
return MatterReconstructorBlockEntity(pPos, pState) return MatterReconstructorBlockEntity(pPos, pState)
} }

View File

@ -20,7 +20,7 @@ import ru.dbotthepony.mc.otm.core.get
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 MatterRecyclerBlock : RotatableMatteryBlock(), EntityBlock { class MatterRecyclerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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_)
} }

View File

@ -20,7 +20,7 @@ import ru.dbotthepony.mc.otm.core.get
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 : RotatableMatteryBlock(), EntityBlock { class MatterReplicatorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -20,7 +20,7 @@ import ru.dbotthepony.mc.otm.core.get
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 : RotatableMatteryBlock(), EntityBlock { class MatterScannerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -19,8 +19,8 @@ import ru.dbotthepony.mc.otm.block.getShapeForEachState
import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class PatternStorageBlock : RotatableMatteryBlock(), EntityBlock { class PatternStorageBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -22,7 +22,7 @@ import ru.dbotthepony.mc.otm.core.get
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 : RotatableMatteryBlock(), EntityBlock { class DriveRackBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -27,7 +27,7 @@ import ru.dbotthepony.mc.otm.core.get
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 DriveViewerBlock : RotatableMatteryBlock(), EntityBlock { class DriveViewerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -22,7 +22,7 @@ import ru.dbotthepony.mc.otm.core.get
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 : RotatableMatteryBlock(), EntityBlock { class ItemMonitorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -31,7 +31,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.core.math.unaryMinus import ru.dbotthepony.mc.otm.core.math.unaryMinus
class StorageBusBlock : RotatableMatteryBlock(), EntityBlock { class StorageBusBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun rotationFreedom(): BlockRotationFreedom { override fun rotationFreedom(): BlockRotationFreedom {
return BlockRotationFreedom.DIRECTIONAL return BlockRotationFreedom.DIRECTIONAL
} }

View File

@ -32,7 +32,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.core.math.unaryMinus import ru.dbotthepony.mc.otm.core.math.unaryMinus
class StorageImporterBlock : RotatableMatteryBlock(), EntityBlock { class StorageImporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun rotationFreedom(): BlockRotationFreedom { override fun rotationFreedom(): BlockRotationFreedom {
return BlockRotationFreedom.DIRECTIONAL return BlockRotationFreedom.DIRECTIONAL
} }
@ -105,7 +105,7 @@ class StorageImporterBlock : RotatableMatteryBlock(), EntityBlock {
} }
} }
class StorageExporterBlock : RotatableMatteryBlock(), EntityBlock { class StorageExporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun rotationFreedom(): BlockRotationFreedom { override fun rotationFreedom(): BlockRotationFreedom {
return BlockRotationFreedom.DIRECTIONAL return BlockRotationFreedom.DIRECTIONAL
} }

View File

@ -22,7 +22,7 @@ import ru.dbotthepony.mc.otm.core.get
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 StoragePowerSupplierBlock : RotatableMatteryBlock(), EntityBlock { class StoragePowerSupplierBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
return StoragePowerSupplierBlockEntity(p_153215_, p_153216_) return StoragePowerSupplierBlockEntity(p_153215_, p_153216_)
} }

View File

@ -29,7 +29,7 @@ import ru.dbotthepony.mc.otm.core.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 : MatteryBlock(), EntityBlock { class AndroidStationBlock : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun use( override fun use(
blockState: BlockState, blockState: BlockState,
level: Level, level: Level,

View File

@ -27,7 +27,7 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
class BatteryBankBlock : RotatableMatteryBlock(), EntityBlock { class BatteryBankBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun <T : BlockEntity> getTicker( override fun <T : BlockEntity> getTicker(
level: Level, level: Level,
p_153213_: BlockState, p_153213_: BlockState,

View File

@ -34,7 +34,7 @@ import ru.dbotthepony.mc.otm.oncePre
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 ChemicalGeneratorBlock : RotatableMatteryBlock(), EntityBlock { class ChemicalGeneratorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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_)
} }

View File

@ -16,7 +16,7 @@ import ru.dbotthepony.mc.otm.block.entity.tech.CobblerBlockEntity
import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class CobblerBlock : RotatableMatteryBlock(), EntityBlock { class CobblerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity { override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
return CobblerBlockEntity(pPos, pState) return CobblerBlockEntity(pPos, pState)
} }

View File

@ -22,7 +22,7 @@ import ru.dbotthepony.mc.otm.once
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 : MatteryBlock(), EntityBlock { class EnergyCounterBlock : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), 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)
} }

View File

@ -19,7 +19,7 @@ import ru.dbotthepony.mc.otm.core.get
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 EnergyServoBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()), EntityBlock { class EnergyServoBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
return EnergyServoBlockEntity(p_153215_, p_153216_) return EnergyServoBlockEntity(p_153215_, p_153216_)
} }

View File

@ -21,7 +21,7 @@ import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class EssenceStorageBlock : RotatableMatteryBlock(), EntityBlock { class EssenceStorageBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity { override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
return EssenceStorageBlockEntity(pPos, pState) return EssenceStorageBlockEntity(pPos, pState)
} }

View File

@ -21,6 +21,7 @@ import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BlockStateProperties import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
import net.minecraft.world.level.material.MapColor import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.material.PushReaction
import net.minecraft.world.phys.AABB import net.minecraft.world.phys.AABB
import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.VoxelShape import net.minecraft.world.phys.shapes.VoxelShape
@ -34,7 +35,7 @@ import ru.dbotthepony.mc.otm.once
import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).destroyTime(3f).explosionResistance(12f).randomTicks()) { class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).destroyTime(3f).explosionResistance(12f).randomTicks()) {
@Suppress("OVERRIDE_DEPRECATION") @Suppress("OVERRIDE_DEPRECATION")
override fun randomTick( override fun randomTick(
blockState: BlockState, blockState: BlockState,

View File

@ -24,7 +24,7 @@ import ru.dbotthepony.mc.otm.block.getShapeForEachState
import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class PlatePressBlock(properties: Properties = DEFAULT_PROPERTIES, val isTwin: Boolean = false) : RotatableMatteryBlock(properties), EntityBlock { class PlatePressBlock(properties: Properties = DEFAULT_MACHINE_PROPERTIES, val isTwin: Boolean = false) : 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_, isTwin) return PlatePressBlockEntity(p_153215_, p_153216_, isTwin)
} }

View File

@ -31,7 +31,7 @@ class PoweredFurnaceBlock(
val secondaryRecipeType: (() -> RecipeType<out MatteryCookingRecipe>)?, val secondaryRecipeType: (() -> RecipeType<out MatteryCookingRecipe>)?,
val config: WorkerBalanceValues, val config: WorkerBalanceValues,
shape: BlockShape? shape: BlockShape?
) : RotatableMatteryBlock(), EntityBlock { ) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): PoweredFurnaceBlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): PoweredFurnaceBlockEntity {
return PoweredFurnaceBlockEntity(type.invoke(), p_153215_, p_153216_, recipeType, secondaryRecipeType, config) return PoweredFurnaceBlockEntity(type.invoke(), p_153215_, p_153216_, recipeType, secondaryRecipeType, config)
} }

View File

@ -180,7 +180,13 @@ object MBlocks {
} }
val TRITANIUM_BARS: IronBarsBlock by registry.register(MNames.TRITANIUM_BARS) { val TRITANIUM_BARS: IronBarsBlock by registry.register(MNames.TRITANIUM_BARS) {
IronBarsBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).sound(SoundType.METAL).explosionResistance(45f).destroyTime(2.5f).requiresCorrectToolForDrops()) IronBarsBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_LIGHT_BLUE)
.sound(SoundType.METAL)
.explosionResistance(45f)
.noOcclusion()
.destroyTime(2.5f)
.requiresCorrectToolForDrops())
} }
val DEEPSLATE_TRITANIUM_ORE: Block by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { DropExperienceBlock( val DEEPSLATE_TRITANIUM_ORE: Block by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { DropExperienceBlock(