Actually add ship engine block
This commit is contained in:
parent
7b22bd72c1
commit
8abf97f7f8
@ -262,4 +262,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
|
|||||||
val textureRailing = ResourceLocation(DataGen.MOD_ID, "block/decorative/industrial_glass_frame")
|
val textureRailing = ResourceLocation(DataGen.MOD_ID, "block/decorative/industrial_glass_frame")
|
||||||
DataGen.pane(glass, textureSide, textureRailing)
|
DataGen.pane(glass, textureSide, textureRailing)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockStateProvider.block(MBlocks.ENGINE)
|
||||||
|
itemModelProvider.block(MItems.ENGINE)
|
||||||
}
|
}
|
||||||
|
@ -569,4 +569,24 @@ public class BlockShapes {
|
|||||||
new SimpleCuboid(0.03125d, 0.125d, 0.65625d, 0.34375d, 0.625d, 0.96875d),
|
new SimpleCuboid(0.03125d, 0.125d, 0.65625d, 0.34375d, 0.625d, 0.96875d),
|
||||||
new SimpleCuboid(0.65625d, 0.125d, 0.65625d, 0.96875d, 0.625d, 0.96875d)
|
new SimpleCuboid(0.65625d, 0.125d, 0.65625d, 0.96875d, 0.625d, 0.96875d)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public static final BlockShape ENGINE = new BlockShape(
|
||||||
|
new SimpleCuboid(0d, 0d, 0.875d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.0625d, 0.625d, 0.9375d, 0.9375d, 0.875d),
|
||||||
|
new SimpleCuboid(0.25d, 0.25d, 0.4375d, 0.75d, 0.75d, 0.625d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.1875d, 0.25d, 0.8125d, 0.8125d, 0.4375d),
|
||||||
|
new SimpleCuboid(0.125d, 0.125d, 0d, 0.875d, 0.875d, 0.25d),
|
||||||
|
new SimpleCuboid(0d, 0.875d, 0.5625d, 0.125d, 1d, 0.875d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.875d, 0.25d, 0.125d, 0.9375d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.0625d, 0.25d, 0.125d, 0.125d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.875d, 0.0625d, 0.25d, 0.9375d, 0.125d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.875d, 0.875d, 0.25d, 0.9375d, 0.9375d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0.4375d, 0.9375d, 0.875d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.125d, 0.4375d, 0.125d, 0.875d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.125d, 0.875d, 0.4375d, 0.875d, 0.9375d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.125d, 0.0625d, 0.4375d, 0.875d, 0.125d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.875d, 0.875d, 0.5625d, 1d, 1d, 0.875d),
|
||||||
|
new SimpleCuboid(0.875d, 0d, 0.5625d, 1d, 0.125d, 0.875d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0.5625d, 0.125d, 0.125d, 0.875d)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,29 @@ abstract class RotatableMatteryBlock @JvmOverloads constructor(properties: Prope
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
/**
|
||||||
|
* Allows to instance [RotatableMatteryBlock] directly
|
||||||
|
*/
|
||||||
|
fun make(properties: Properties, hasFreeRotation: Boolean = false, faceToPlayer: Boolean = true): RotatableMatteryBlock {
|
||||||
|
if (hasFreeRotation) { // can't have one class for two cases - superclass (both in OTM and in Minecraft) are leaking "this"
|
||||||
|
return object : RotatableMatteryBlock(properties) {
|
||||||
|
override val hasFreeRotation get() = true // this is accessed from superclass constructor
|
||||||
|
|
||||||
|
override fun faceToPlayer(context: BlockPlaceContext): Boolean {
|
||||||
|
return faceToPlayer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return object : RotatableMatteryBlock(properties) {
|
||||||
|
override val hasFreeRotation get() = false // this is accessed from superclass constructor
|
||||||
|
|
||||||
|
override fun faceToPlayer(context: BlockPlaceContext): Boolean {
|
||||||
|
return faceToPlayer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val FACING: EnumProperty<Direction> = EnumProperty.create(
|
val FACING: EnumProperty<Direction> = EnumProperty.create(
|
||||||
"facing",
|
"facing",
|
||||||
Direction::class.java,
|
Direction::class.java,
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.block.decorative
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
|
import net.minecraft.world.level.BlockGetter
|
||||||
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.level.material.Material
|
||||||
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
|
class EngineBlock : RotatableMatteryBlock(Properties.of(Material.METAL, DyeColor.ORANGE).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) {
|
||||||
|
override val hasFreeRotation: Boolean
|
||||||
|
get() = true
|
||||||
|
|
||||||
|
private val shapes = getShapeForEachState {
|
||||||
|
BlockShapes.ENGINE.rotateInv(it[FACING_FULL]).computeShape()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getShape(
|
||||||
|
p_60555_: BlockState,
|
||||||
|
p_60556_: BlockGetter,
|
||||||
|
p_60557_: BlockPos,
|
||||||
|
p_60558_: CollisionContext
|
||||||
|
): VoxelShape {
|
||||||
|
return shapes[p_60555_]!!
|
||||||
|
}
|
||||||
|
}
|
@ -42,8 +42,10 @@ import ru.dbotthepony.mc.otm.block.LaboratoryLampLight
|
|||||||
import ru.dbotthepony.mc.otm.block.MatterCableBlock
|
import ru.dbotthepony.mc.otm.block.MatterCableBlock
|
||||||
import ru.dbotthepony.mc.otm.block.PhantomAttractorBlock
|
import ru.dbotthepony.mc.otm.block.PhantomAttractorBlock
|
||||||
import ru.dbotthepony.mc.otm.block.PlatePressBlock
|
import ru.dbotthepony.mc.otm.block.PlatePressBlock
|
||||||
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.StorageCableBlock
|
import ru.dbotthepony.mc.otm.block.StorageCableBlock
|
||||||
import ru.dbotthepony.mc.otm.block.TritaniumPressurePlate
|
import ru.dbotthepony.mc.otm.block.TritaniumPressurePlate
|
||||||
|
import ru.dbotthepony.mc.otm.block.decorative.EngineBlock
|
||||||
import ru.dbotthepony.mc.otm.block.matter.MatterBottlerBlock
|
import ru.dbotthepony.mc.otm.block.matter.MatterBottlerBlock
|
||||||
import ru.dbotthepony.mc.otm.block.matter.MatterCapacitorBankBlock
|
import ru.dbotthepony.mc.otm.block.matter.MatterCapacitorBankBlock
|
||||||
import ru.dbotthepony.mc.otm.block.matter.MatterDecomposerBlock
|
import ru.dbotthepony.mc.otm.block.matter.MatterDecomposerBlock
|
||||||
@ -132,7 +134,7 @@ object MBlocks {
|
|||||||
val LABORATORY_LAMP_LIGHT: Block by registry.register(MNames.LABORATORY_LAMP_LIGHT) { LaboratoryLampLight() }
|
val LABORATORY_LAMP_LIGHT: Block by registry.register(MNames.LABORATORY_LAMP_LIGHT) { LaboratoryLampLight() }
|
||||||
val DANGER_STRIPE_BLOCK: Block by registry.register(MNames.DANGER_STRIPE_BLOCK) { Block(BlockBehaviour.Properties.of(Material.METAL, DyeColor.GRAY).explosionResistance(6f).destroyTime(1.5f).requiresCorrectToolForDrops()) }
|
val DANGER_STRIPE_BLOCK: Block by registry.register(MNames.DANGER_STRIPE_BLOCK) { Block(BlockBehaviour.Properties.of(Material.METAL, DyeColor.GRAY).explosionResistance(6f).destroyTime(1.5f).requiresCorrectToolForDrops()) }
|
||||||
val METAL_BEAM: Block by registry.register(MNames.METAL_BEAM) { Block(BlockBehaviour.Properties.of(Material.METAL, DyeColor.GRAY).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) }
|
val METAL_BEAM: Block by registry.register(MNames.METAL_BEAM) { Block(BlockBehaviour.Properties.of(Material.METAL, DyeColor.GRAY).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) }
|
||||||
val ENGINE: Block by registry.register(MNames.ENGINE) { Block(BlockBehaviour.Properties.of(Material.METAL, DyeColor.ORANGE).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) }
|
val ENGINE: Block by registry.register(MNames.ENGINE) { EngineBlock() }
|
||||||
|
|
||||||
val TRITANIUM_DOOR = registry.allColored(MNames.TRITANIUM_DOOR) { color, _ ->
|
val TRITANIUM_DOOR = registry.allColored(MNames.TRITANIUM_DOOR) { color, _ ->
|
||||||
object : DoorBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops(), SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN) {
|
object : DoorBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops(), SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN) {
|
||||||
|
Loading…
Reference in New Issue
Block a user