diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt index 52fb18559..29dfcf112 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt @@ -134,6 +134,11 @@ object DataGen { blockStateProvider.simplePillar(block) } + fun decorativeLadder(block: Block){ + blockModelProvider.decorativeLadder(block) + blockStateProvider.simpleLadder(block) + } + fun stairs(block: StairBlock, side: String, top: String) { blockStateProvider.exec { blockStateProvider.stairsBlock(block, modLocation(side), modLocation(top), modLocation(top)) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt index d33289852..41f2be4ed 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt @@ -38,6 +38,8 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr DataGen.decorativeCubeAllCutout(MBlocks.METAL_MESH) DataGen.decorativePillar(MBlocks.TIRE_BLOCK, "carbon_fibre_block", "tire") + DataGen.decorativeLadder(MBlocks.INDUSTRIAL_LADDER) + DataGen.decoratives(MRegistry.TRITANIUM_BLOCK) for (color in DyeColor.entries) { @@ -260,6 +262,10 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr itemModelProvider.block(MItems.LABORATORY_LAMP_INVERTED, MItems.LABORATORY_LAMP.registryName!!.path + "_unlit") itemModelProvider.block(MItems.DANGER_STRIPE_BLOCK, MItems.DANGER_STRIPE_BLOCK.registryName!!.path + "_0") itemModelProvider.block(MItems.METAL_BEAM) + + itemModelProvider.generatedBlockDecorative(MItems.INDUSTRIAL_LADDER) + + itemModelProvider.block(MItems.TIRE_BLOCK) blockStateProvider.block(MBlocks.METAL_BEAM_CENTER) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt index 434aa56ed..5ee909877 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt @@ -3,11 +3,13 @@ package ru.dbotthepony.mc.otm.datagen.blocks import net.minecraft.core.Direction import net.minecraft.resources.ResourceLocation import net.minecraft.world.level.block.Block +import net.minecraft.world.level.block.HorizontalDirectionalBlock import net.minecraft.world.level.block.RotatedPillarBlock import net.minecraft.world.level.block.state.BlockState import net.neoforged.neoforge.client.model.generators.BlockStateProvider import net.neoforged.neoforge.client.model.generators.ConfiguredModel import net.neoforged.neoforge.data.event.GatherDataEvent +import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.core.getValueNullable import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom @@ -119,6 +121,28 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve return this } + fun simpleLadder(vararg blocks: Block): MatteryBlockStateProvider { + for (block in blocks) { + exec { + + getVariantBuilder(block) + .partialState().with(HorizontalDirectionalBlock.FACING, Direction.NORTH) + .modelForState().modelFile(models().getExistingFile(modLocation("block/decorative/${block.registryName!!.path}"))).addModel() + + .partialState().with(HorizontalDirectionalBlock.FACING, Direction.SOUTH) + .modelForState().modelFile(models().getExistingFile(modLocation("block/decorative/${block.registryName!!.path}"))).rotationY(180).addModel() + + .partialState().with(HorizontalDirectionalBlock.FACING, Direction.WEST) + .modelForState().modelFile(models().getExistingFile(modLocation("block/decorative/${block.registryName!!.path}"))).rotationY(270).addModel() + + .partialState().with(HorizontalDirectionalBlock.FACING, Direction.EAST) + .modelForState().modelFile(models().getExistingFile(modLocation("block/decorative/${block.registryName!!.path}"))).rotationY(90).addModel() + } + } + + return this + } + fun simpleBlockM(blocks: Collection): MatteryBlockStateProvider { blocks.forEach(this::simpleBlockM) return this diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/models/MatteryModelProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/models/MatteryModelProvider.kt index c86b884e0..683931e9c 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/models/MatteryModelProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/models/MatteryModelProvider.kt @@ -5,6 +5,7 @@ import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.WaterloggedTransparentBlock import net.neoforged.neoforge.client.model.generators.BlockModelProvider import net.neoforged.neoforge.data.event.GatherDataEvent +import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.datagen.modLocation @@ -51,6 +52,12 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve } } + fun decorativeLadder(block: Block) { + withExistingParent(block.registryName!!.path, ResourceLocation("minecraft", "block/ladder")) + .texture("texture", modLocation("block/decorative/${block.registryName!!.path}")) + .renderType("cutout") + } + fun decorativeGlassAll(blocks: Collection) { for (block in blocks) { exec { diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt index 6f0af90f0..40171e4fe 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt @@ -82,6 +82,8 @@ fun addTags(tagsProvider: TagsProvider) { tagsProvider.impermeable.add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values) + tagsProvider.blocks.Appender(BlockTags.CLIMBABLE).add(MBlocks.INDUSTRIAL_LADDER) + tagsProvider.androidImmuneEffects.add( MobEffects.CONDUIT_POWER, MobEffects.HEAL, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/Enforcer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/Enforcer.kt index f24fc232d..2c39a8d30 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/Enforcer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/Enforcer.kt @@ -343,7 +343,7 @@ class Enforcer(type: EntityType, level: Level) : Monster(type,level) { } override fun tick() { - mob.lookControl.setLookAt(target, 30.0f, 30.0f) + target?.let { mob.lookControl.setLookAt(it, 30.0f, 30.0f) } val target = mob.target ?: return if (moveCD > 0) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt index 8a63d73d4..e8c9787cb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt @@ -122,6 +122,8 @@ object MNames { const val TRITANIUM_BARS = "tritanium_bars" const val METAL_RAILING = "metal_railing" + const val INDUSTRIAL_LADDER = "industrial_ladder" + // items const val GRAVITATIONAL_DISRUPTOR = "gravitational_disruptor" const val MATTER_DUST = "matter_dust" diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MBlocks.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MBlocks.kt index 73a509453..d010d6ac3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MBlocks.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MBlocks.kt @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Blocks import net.minecraft.world.level.block.DropExperienceBlock import net.minecraft.world.level.block.IronBarsBlock +import net.minecraft.world.level.block.LadderBlock import net.minecraft.world.level.block.LiquidBlock import net.minecraft.world.level.block.RedstoneLampBlock import net.minecraft.world.level.block.RotatedPillarBlock @@ -295,6 +296,17 @@ object MBlocks { .requiresCorrectToolForDrops()) } + val INDUSTRIAL_LADDER: LadderBlock by registry.register(MNames.INDUSTRIAL_LADDER){ + LadderBlock(BlockBehaviour.Properties.of() + .mapColor(MapColor.COLOR_GRAY) + .sound(SoundType.COPPER_GRATE) + .explosionResistance(30f) + .noOcclusion() + .destroyTime(2f) + .requiresCorrectToolForDrops() + ) + } + val DEEPSLATE_TRITANIUM_ORE: Block by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { DropExperienceBlock( UniformInt.of(0, 3), BlockBehaviour.Properties.of() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt index 0bf7f9c66..2d49e79c1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt @@ -516,6 +516,7 @@ object MItems { val METAL_BEAM_CENTER: Item by registry.register(MNames.METAL_BEAM_CENTER) { BlockItem(MBlocks.METAL_BEAM_CENTER, DEFAULT_PROPERTIES) } val ENGINE: Item by registry.register(MNames.ENGINE) { BlockItem(MBlocks.ENGINE, DEFAULT_PROPERTIES) } val HOLO_SIGN: Item by registry.register(MNames.HOLO_SIGN) { BlockItem(MBlocks.HOLO_SIGN, DEFAULT_PROPERTIES) } + val INDUSTRIAL_LADDER: Item by registry.register(MNames.INDUSTRIAL_LADDER) { BlockItem(MBlocks.INDUSTRIAL_LADDER, DEFAULT_PROPERTIES) } val TRITANIUM_DOOR = register(MNames.TRITANIUM_DOOR, MBlocks.TRITANIUM_DOOR) val TRITANIUM_TRAPDOOR = register(MNames.TRITANIUM_TRAPDOOR, MBlocks.TRITANIUM_TRAPDOOR)