Dilithium ore and crystals
This commit is contained in:
parent
4898d18112
commit
e63bbb79d2
@ -8,6 +8,7 @@ import net.minecraft.tags.BiomeTags
|
||||
import net.minecraft.tags.BlockTags
|
||||
import net.minecraft.util.valueproviders.ClampedNormalFloat
|
||||
import net.minecraft.util.valueproviders.ClampedNormalInt
|
||||
import net.minecraft.util.valueproviders.ConstantFloat
|
||||
import net.minecraft.util.valueproviders.UniformInt
|
||||
import net.minecraft.world.level.levelgen.GenerationStep
|
||||
import net.minecraft.world.level.levelgen.VerticalAnchor
|
||||
@ -32,6 +33,7 @@ import ru.dbotthepony.mc.otm.worldgen.feature.BlackHolePlacerFeature
|
||||
|
||||
private object ConfiguredFeatures {
|
||||
val TRITANIUM_ORE = key("tritanium_ore")
|
||||
val DILITHIUM = key("dilithium")
|
||||
val BLACK_HOLE = key("black_hole")
|
||||
|
||||
private fun key(name: String): ResourceKey<ConfiguredFeature<*, *>> {
|
||||
@ -43,12 +45,24 @@ fun registerConfiguredFeatures(context: BootstrapContext<ConfiguredFeature<*, *>
|
||||
val stone = TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES)
|
||||
val deepslate = TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES)
|
||||
|
||||
val target = listOf(
|
||||
OreConfiguration.target(stone, MBlocks.TRITANIUM_ORE.defaultBlockState()),
|
||||
OreConfiguration.target(deepslate, MBlocks.DEEPSLATE_TRITANIUM_ORE.defaultBlockState()),
|
||||
)
|
||||
run {
|
||||
val target = listOf(
|
||||
OreConfiguration.target(stone, MBlocks.TRITANIUM_ORE.defaultBlockState()),
|
||||
OreConfiguration.target(deepslate, MBlocks.DEEPSLATE_TRITANIUM_ORE.defaultBlockState()),
|
||||
)
|
||||
|
||||
context.register(ConfiguredFeatures.TRITANIUM_ORE, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 9)))
|
||||
}
|
||||
|
||||
run {
|
||||
val target = listOf(
|
||||
OreConfiguration.target(stone, MBlocks.DILITHIUM_ORE.defaultBlockState()),
|
||||
OreConfiguration.target(deepslate, MBlocks.DEEPSLATE_DILITHIUM_ORE.defaultBlockState()),
|
||||
)
|
||||
|
||||
context.register(ConfiguredFeatures.DILITHIUM, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 3)))
|
||||
}
|
||||
|
||||
context.register(ConfiguredFeatures.TRITANIUM_ORE, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 9)))
|
||||
context.register(ConfiguredFeatures.BLACK_HOLE, ConfiguredFeature(MWorldGenFeatures.BLACK_HOLE_PLACER,
|
||||
BlackHolePlacerFeature.Config(0.001f, Decimal("0.25"), Decimal(1))))
|
||||
}
|
||||
@ -57,6 +71,7 @@ private object PlacedFeatures {
|
||||
val NORMAL_TRITANIUM = key("normal_tritanium")
|
||||
val DEEP_TRITANIUM = key("deep_tritanium")
|
||||
val CLOUD_TITANIUM = key("cloud_tritanium")
|
||||
val DILITHIUM = key("dilithium")
|
||||
val BLACK_HOLE = key("black_hole")
|
||||
|
||||
private fun key(name: String): ResourceKey<PlacedFeature> {
|
||||
@ -66,43 +81,70 @@ private object PlacedFeatures {
|
||||
|
||||
fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
|
||||
val configured = context.lookup(Registries.CONFIGURED_FEATURE)
|
||||
val ore = configured.getOrThrow(ConfiguredFeatures.TRITANIUM_ORE)
|
||||
|
||||
context.register(PlacedFeatures.NORMAL_TRITANIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
CountPlacement.of(UniformInt.of(2, 6)),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(10), 15.0))
|
||||
)
|
||||
))
|
||||
run {
|
||||
val ore = configured.getOrThrow(ConfiguredFeatures.TRITANIUM_ORE)
|
||||
|
||||
context.register(PlacedFeatures.DEEP_TRITANIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
CountPlacement.of(UniformInt.of(4, 8)),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(VeryBiasedToBottomHeight.of(VerticalAnchor.aboveBottom(4), VerticalAnchor.absolute(0), 16))
|
||||
)
|
||||
))
|
||||
|
||||
context.register(PlacedFeatures.CLOUD_TITANIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
RarityFilter.onAverageOnceEvery(6),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(10), 15.0)),
|
||||
EllipsoidPlacement(
|
||||
x = ClampedNormalInt.of(0f, 12f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
y = ClampedNormalInt.of(0f, 12f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
z = ClampedNormalInt.of(0f, 8f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
count = ClampedNormalInt.of(100f, 100f, 80, 300),
|
||||
xLength = ClampedNormalFloat.of(11f, 4f, 4f, 16f),
|
||||
yLength = ClampedNormalFloat.of(11f, 4f, 4f, 16f),
|
||||
zLength = ClampedNormalFloat.of(11f, 4f, 4f, 16f),
|
||||
context.register(PlacedFeatures.NORMAL_TRITANIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
CountPlacement.of(UniformInt.of(2, 6)),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(10), 15.0))
|
||||
)
|
||||
)
|
||||
))
|
||||
))
|
||||
|
||||
context.register(PlacedFeatures.DEEP_TRITANIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
CountPlacement.of(UniformInt.of(4, 8)),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(VeryBiasedToBottomHeight.of(VerticalAnchor.aboveBottom(4), VerticalAnchor.absolute(0), 16))
|
||||
)
|
||||
))
|
||||
|
||||
context.register(PlacedFeatures.CLOUD_TITANIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
RarityFilter.onAverageOnceEvery(6),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(10), 15.0)),
|
||||
EllipsoidPlacement(
|
||||
x = ClampedNormalInt.of(0f, 8f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
y = ClampedNormalInt.of(0f, 12f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
z = ClampedNormalInt.of(0f, 8f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
count = ClampedNormalInt.of(100f, 100f, 80, 300),
|
||||
xLength = ClampedNormalFloat.of(11f, 4f, 4f, 14f),
|
||||
yLength = ClampedNormalFloat.of(11f, 4f, 4f, 14f),
|
||||
zLength = ClampedNormalFloat.of(11f, 4f, 4f, 14f),
|
||||
)
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
run {
|
||||
val ore = configured.getOrThrow(ConfiguredFeatures.DILITHIUM)
|
||||
|
||||
context.register(PlacedFeatures.DILITHIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
RarityFilter.onAverageOnceEvery(12),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(0), 15.0)),
|
||||
EllipsoidPlacement(
|
||||
x = ClampedNormalInt.of(0f, 8f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
y = ClampedNormalInt.of(0f, 20f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
z = ClampedNormalInt.of(0f, 8f, Int.MIN_VALUE, Int.MAX_VALUE),
|
||||
count = ClampedNormalInt.of(300f, 200f, 200, 800),
|
||||
xLength = ClampedNormalFloat.of(11f, 4f, 8f, 14f),
|
||||
// allow crystals to generate as far as standard deviation allows
|
||||
// to increase chance for player to discover crystal vein
|
||||
yLength = ConstantFloat.of(60f),
|
||||
zLength = ClampedNormalFloat.of(11f, 4f, 8f, 14f),
|
||||
)
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
val blackHole = configured.getOrThrow(ConfiguredFeatures.BLACK_HOLE)
|
||||
|
||||
@ -116,7 +158,7 @@ fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
|
||||
}
|
||||
|
||||
private object BiomeModifiers {
|
||||
val TRITANIUM_ORE = key("tritanium_ore")
|
||||
val ORES = key("ores")
|
||||
val BLACK_HOLE = key("black_hole")
|
||||
|
||||
private fun key(name: String): ResourceKey<BiomeModifier> {
|
||||
@ -129,13 +171,14 @@ fun registerBiomeModifiers(context: BootstrapContext<BiomeModifier>) {
|
||||
val biomes = context.lookup(Registries.BIOME)
|
||||
|
||||
context.register(
|
||||
BiomeModifiers.TRITANIUM_ORE,
|
||||
BiomeModifiers.ORES,
|
||||
net.neoforged.neoforge.common.world.BiomeModifiers.AddFeaturesBiomeModifier(
|
||||
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
|
||||
HolderSet.direct(
|
||||
placed.getOrThrow(PlacedFeatures.NORMAL_TRITANIUM),
|
||||
placed.getOrThrow(PlacedFeatures.DEEP_TRITANIUM),
|
||||
placed.getOrThrow(PlacedFeatures.CLOUD_TITANIUM),
|
||||
placed.getOrThrow(PlacedFeatures.DILITHIUM),
|
||||
),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES
|
||||
)
|
||||
|
@ -608,6 +608,10 @@ private fun blocks(provider: MatteryLanguageProvider) {
|
||||
add(MBlocks.DEEPSLATE_TRITANIUM_ORE, "Deepslate Tritanium Ore")
|
||||
add(MBlocks.TRITANIUM_RAW_BLOCK, "Raw Tritanium Block")
|
||||
|
||||
add(MBlocks.DILITHIUM_ORE, "Dilithium Ore")
|
||||
add(MBlocks.DEEPSLATE_DILITHIUM_ORE, "Deepslate Dilithium Ore")
|
||||
add(MBlocks.DILITHIUM_CRYSTAL_BLOCK, "Dilithium Crystal Block")
|
||||
|
||||
add(MBlocks.STORAGE_CABLE, "Storage Cable")
|
||||
addBlock(MBlocks.STORAGE_POWER_SUPPLIER.values, "Storage Power Supplier")
|
||||
add(MBlocks.STORAGE_BUS, "Storage Bus")
|
||||
@ -726,6 +730,7 @@ private fun items(provider: MatteryLanguageProvider) {
|
||||
|
||||
add(MItems.TRITANIUM_DUST, "Tritanium Dust")
|
||||
add(MItems.TRITANIUM_INGOT, "Tritanium Ingot")
|
||||
add(MItems.DILITHIUM_CRYSTAL, "Dilithium Crystal")
|
||||
add(MItems.TRITANIUM_NUGGET, "Tritanium Nugget")
|
||||
add(MItems.MATTER_IO_PORT, "Matter IO Port")
|
||||
add(MItems.MATTER_TRANSFORM_MATRIX, "Matter Transformation Matrix")
|
||||
|
@ -607,8 +607,11 @@ private fun blocks(provider: MatteryLanguageProvider) {
|
||||
add(MBlocks.METAL_JUNK, "desc", "Бесполезный хлам, или нет?")
|
||||
|
||||
add(MBlocks.TRITANIUM_ORE, "Тритановая руда")
|
||||
add(MBlocks.DILITHIUM_ORE, "Дилитевая руда")
|
||||
add(MBlocks.DEEPSLATE_TRITANIUM_ORE, "Тританоносный глубинный сланец")
|
||||
add(MBlocks.DEEPSLATE_DILITHIUM_ORE, "Глубинный сланец со вкраплением дилития")
|
||||
add(MBlocks.TRITANIUM_RAW_BLOCK, "Блок рудного тритана")
|
||||
add(MBlocks.DILITHIUM_CRYSTAL_BLOCK, "Блок кристалла дилития")
|
||||
|
||||
add(MBlocks.STORAGE_CABLE, "Кабель хранилища")
|
||||
addBlock(MBlocks.STORAGE_POWER_SUPPLIER.values, "Подстанция сети хранилища")
|
||||
@ -728,6 +731,7 @@ private fun items(provider: MatteryLanguageProvider) {
|
||||
|
||||
add(MItems.TRITANIUM_DUST, "Тритановая пыль")
|
||||
add(MItems.TRITANIUM_INGOT, "Тритановый слиток")
|
||||
add(MItems.DILITHIUM_CRYSTAL, "Дилитевый кристалл")
|
||||
add(MItems.TRITANIUM_NUGGET, "Тритановый самородок")
|
||||
add(MItems.MATTER_IO_PORT, "Порт ввода/вывода материи")
|
||||
add(MItems.MATTER_TRANSFORM_MATRIX, "Матрица преобразования материи")
|
||||
|
@ -15,11 +15,14 @@ import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
|
||||
import net.minecraft.world.level.storage.loot.entries.AlternativesEntry
|
||||
import net.minecraft.world.level.storage.loot.entries.LootItem
|
||||
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount
|
||||
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||
import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition
|
||||
import net.minecraft.world.level.storage.loot.predicates.MatchTool
|
||||
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator
|
||||
import ru.dbotthepony.mc.otm.core.lookupOrThrow
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.data.loot.Int2NumberProvider
|
||||
import ru.dbotthepony.mc.otm.data.world.UniformDecimal
|
||||
import ru.dbotthepony.mc.otm.datagen.modLootTable
|
||||
import ru.dbotthepony.mc.otm.item.ProceduralBatteryItem
|
||||
@ -29,7 +32,7 @@ import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
|
||||
private fun ore(lootTables: LootTables, ore: Block, clump: ItemLike) {
|
||||
private fun ore(lootTables: LootTables, ore: Block, clump: ItemLike, count: Int = 1) {
|
||||
lootTables.builder(ore) {
|
||||
add(AlternativesEntry.alternatives(
|
||||
LootItem.lootTableItem(ore).also {
|
||||
@ -44,6 +47,9 @@ private fun ore(lootTables: LootTables, ore: Block, clump: ItemLike) {
|
||||
},
|
||||
|
||||
LootItem.lootTableItem(clump).also {
|
||||
if (count != 1)
|
||||
it.apply(SetItemCountFunction.setCount(Int2NumberProvider(UniformInt.of(1, count))))
|
||||
|
||||
it.apply(ApplyBonusCount.addOreBonusCount(lootTables.registry.get().lookupOrThrow(Enchantments.FORTUNE)))
|
||||
it.condition(ExplosionCondition.survivesExplosion())
|
||||
}
|
||||
@ -97,6 +103,9 @@ fun addLootTables(lootTables: LootTables) {
|
||||
ore(lootTables, MBlocks.TRITANIUM_ORE, MItems.TRITANIUM_ORE_CLUMP)
|
||||
ore(lootTables, MBlocks.DEEPSLATE_TRITANIUM_ORE, MItems.TRITANIUM_ORE_CLUMP)
|
||||
|
||||
ore(lootTables, MBlocks.DILITHIUM_ORE, MItems.DILITHIUM_CRYSTAL, 2)
|
||||
ore(lootTables, MBlocks.DEEPSLATE_DILITHIUM_ORE, MItems.DILITHIUM_CRYSTAL, 2)
|
||||
|
||||
lootTables.dropsSelf(MBlocks.INFINITE_WATER_SOURCE) { condition(ExplosionCondition.survivesExplosion()) }
|
||||
|
||||
lootTables.dropsSelf(MBlocks.ENGINE) { condition(ExplosionCondition.survivesExplosion()) }
|
||||
|
@ -527,4 +527,16 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.rowAB(Items.LEVER, Tags.Items.NUGGETS_IRON)
|
||||
.rowB(Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ItemStack(MItems.DILITHIUM_CRYSTAL_BLOCK))
|
||||
.requires(MItems.DILITHIUM_CRYSTAL, 9)
|
||||
.unlockedBy(MItems.DILITHIUM_CRYSTAL)
|
||||
.unlockedBy(MItems.DILITHIUM_CRYSTAL_BLOCK)
|
||||
.save(consumer, modLocation("dilithium_crystal/to_block"))
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ItemStack(MItems.DILITHIUM_CRYSTAL, 9))
|
||||
.requires(MItems.DILITHIUM_CRYSTAL_BLOCK)
|
||||
.unlockedBy(MItems.DILITHIUM_CRYSTAL)
|
||||
.unlockedBy(MItems.DILITHIUM_CRYSTAL_BLOCK)
|
||||
.save(consumer, modLocation("dilithium_crystal/from_block"))
|
||||
}
|
||||
|
@ -54,14 +54,26 @@ fun addTags(tagsProvider: TagsProvider) {
|
||||
.add(MRegistry.TRITANIUM_STRIPED_BLOCK.blocks.values.stream().flatMap { it.values.stream() })
|
||||
|
||||
tagsProvider.stoneOre("tritanium", MBlocks.TRITANIUM_ORE)
|
||||
tagsProvider.stoneOre("dilithium", MBlocks.DILITHIUM_ORE)
|
||||
|
||||
tagsProvider.deepslateOre("tritanium", MBlocks.DEEPSLATE_TRITANIUM_ORE)
|
||||
tagsProvider.deepslateOre("dilithium", MBlocks.DEEPSLATE_DILITHIUM_ORE)
|
||||
|
||||
tagsProvider.singleDropOre(
|
||||
MBlocks.TRITANIUM_ORE,
|
||||
MBlocks.DEEPSLATE_TRITANIUM_ORE
|
||||
)
|
||||
|
||||
tagsProvider.denseDropOre(
|
||||
MBlocks.DILITHIUM_ORE,
|
||||
MBlocks.DEEPSLATE_DILITHIUM_ORE,
|
||||
)
|
||||
|
||||
tagsProvider.clump("tritanium", MItems.TRITANIUM_ORE_CLUMP, MBlocks.TRITANIUM_RAW_BLOCK)
|
||||
|
||||
tagsProvider.gems.add(MItems.DILITHIUM_CRYSTAL)
|
||||
tagsProvider.items.forge("gems/dilithium").add(MItems.DILITHIUM_CRYSTAL)
|
||||
|
||||
tagsProvider.wires.add("copper", MItems.COPPER_WIRING)
|
||||
tagsProvider.wires.add("gold", MItems.GOLD_WIRING)
|
||||
|
||||
@ -374,6 +386,9 @@ fun addTags(tagsProvider: TagsProvider) {
|
||||
tagsProvider.requiresPickaxe(MBlocks.DANGER_STRIPE_BLOCK)
|
||||
|
||||
tagsProvider.requiresPickaxe(listOf(
|
||||
MBlocks.DILITHIUM_ORE,
|
||||
MBlocks.DEEPSLATE_DILITHIUM_ORE,
|
||||
|
||||
MBlocks.GRAVITATION_STABILIZER,
|
||||
MBlocks.GRAVITATION_STABILIZER_LENS,
|
||||
), Tiers.DIAMOND)
|
||||
|
@ -240,6 +240,15 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
return this
|
||||
}
|
||||
|
||||
fun denseDropOre(vararg blocks: Block): TagsProvider {
|
||||
for (block in blocks) {
|
||||
itemOreRatesSingular.add(block.asItem())
|
||||
blockOreRatesSingular.add(block)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
fun ore(key: String, block: Block): TagsProvider {
|
||||
val forgeKey = ResourceLocation("c", "ores/$key")
|
||||
val b = TagKey.create(Registries.BLOCK, forgeKey)
|
||||
@ -276,6 +285,7 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
val dusts = items.Appender(Tags.Items.DUSTS)
|
||||
val ingots = items.Appender(Tags.Items.INGOTS)
|
||||
val itemOres = items.Appender(Tags.Items.ORES)
|
||||
val gems = items.Appender(Tags.Items.GEMS)
|
||||
val blockOres = blocks.Appender(Tags.Blocks.ORES)
|
||||
val plates = items.forge("plates")
|
||||
val storageBlocksAsItem = items.Appender(Tags.Items.STORAGE_BLOCKS)
|
||||
@ -292,10 +302,10 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
|
||||
// val blockOreRatesSparse = blocks.forge("ore_rates/sparse")
|
||||
val blockOreRatesSingular = blocks.Appender(Tags.Blocks.ORE_RATES_SINGULAR)
|
||||
// val blockOreRatesDense = blocks.forge("ore_rates/dense")
|
||||
val blockOreRatesDense = blocks.forge("ore_rates/dense")
|
||||
// val itemOreRatesSparse = items.forge("ore_rates/sparse")
|
||||
val itemOreRatesSingular = items.Appender(Tags.Items.ORE_RATES_SINGULAR)
|
||||
// val itemOreRatesDense = items.forge("ore_rates/dense")
|
||||
val itemOreRatesDense = items.forge("ore_rates/dense")
|
||||
|
||||
val gameEvents = Delegate(Registries.GAME_EVENT)
|
||||
val vibrations = gameEvents.Appender(GameEventTags.VIBRATIONS)
|
||||
|
@ -100,6 +100,7 @@ object OverdriveThatMatters {
|
||||
CommandArgumentTypes.register(MOD_BUS)
|
||||
MHeightProviders.register(MOD_BUS)
|
||||
MPlacementModifiers.register(MOD_BUS)
|
||||
MLootNumberProviders.register(MOD_BUS)
|
||||
|
||||
StorageStack.Companion.register(MOD_BUS)
|
||||
MatteryChestMenu.Companion.register(MOD_BUS)
|
||||
|
@ -0,0 +1,31 @@
|
||||
package ru.dbotthepony.mc.otm.data.loot
|
||||
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.util.valueproviders.IntProvider
|
||||
import net.minecraft.world.level.storage.loot.LootContext
|
||||
import net.minecraft.world.level.storage.loot.providers.number.LootNumberProviderType
|
||||
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider
|
||||
import ru.dbotthepony.mc.otm.registry.MLootNumberProviders
|
||||
|
||||
class Int2NumberProvider(val parent: IntProvider) : NumberProvider {
|
||||
override fun getFloat(context: LootContext): Float {
|
||||
return getInt(context).toFloat()
|
||||
}
|
||||
|
||||
override fun getInt(context: LootContext): Int {
|
||||
return parent.sample(context.random)
|
||||
}
|
||||
|
||||
override fun getType(): LootNumberProviderType {
|
||||
return MLootNumberProviders.INT_2_NUMBER_TYPE
|
||||
}
|
||||
|
||||
companion object {
|
||||
val CODEC: MapCodec<Int2NumberProvider> by lazy {
|
||||
RecordCodecBuilder.mapCodec {
|
||||
it.group(IntProvider.CODEC.fieldOf("value").forGetter(Int2NumberProvider::parent)).apply(it, ::Int2NumberProvider)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -57,6 +57,7 @@ data class EllipsoidPlacement(
|
||||
val yPow = yLength * yLength
|
||||
|
||||
count = minOf(count, (xLength * zLength * yLength * PI * (4.0 / 3.0)).roundToInt())
|
||||
count = 600
|
||||
|
||||
return Stream.generate { position + BlockPos(this.x.sample(random), this.y.sample(random), this.z.sample(random)) }
|
||||
.limit(count * 10L) // failsafe
|
||||
|
@ -194,7 +194,7 @@ object MBlocks {
|
||||
UniformInt.of(0, 3),
|
||||
BlockBehaviour.Properties.of()
|
||||
.mapColor(MapColor.STONE)
|
||||
.strength(3.25f, 6.0f)
|
||||
.strength(3f, 15.0f)
|
||||
.requiresCorrectToolForDrops(),
|
||||
) }
|
||||
|
||||
@ -248,6 +248,26 @@ object MBlocks {
|
||||
BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).instrument(NoteBlockInstrument.BASEDRUM).strength(8.0f, 10f).requiresCorrectToolForDrops()
|
||||
) }
|
||||
|
||||
val DILITHIUM_ORE: Block by registry.register("dilithium_ore") { DropExperienceBlock(
|
||||
UniformInt.of(1, 6),
|
||||
BlockBehaviour.Properties.of()
|
||||
.mapColor(MapColor.STONE)
|
||||
.strength(3.5f, 25.0f)
|
||||
.requiresCorrectToolForDrops(),
|
||||
) }
|
||||
|
||||
val DEEPSLATE_DILITHIUM_ORE: Block by registry.register("deepslate_dilithium_ore") { DropExperienceBlock(
|
||||
UniformInt.of(1, 6),
|
||||
BlockBehaviour.Properties.of()
|
||||
.mapColor(MapColor.DEEPSLATE)
|
||||
.strength(4.5f, 25.0f)
|
||||
.requiresCorrectToolForDrops(),
|
||||
) }
|
||||
|
||||
val DILITHIUM_CRYSTAL_BLOCK: Block by registry.register("dilithium_crystal_block") {
|
||||
Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).sound(SoundType.AMETHYST).explosionResistance(400f).destroyTime(3f).requiresCorrectToolForDrops())
|
||||
}
|
||||
|
||||
val LABORATORY_LAMP: Block by registry.register(MNames.LABORATORY_LAMP) { LaboratoryLamp(false) }
|
||||
val LABORATORY_LAMP_INVERTED: Block by registry.register(MNames.LABORATORY_LAMP_INVERTED) { LaboratoryLamp(true) }
|
||||
val LABORATORY_LAMP_LIGHT: Block by registry.register(MNames.LABORATORY_LAMP_LIGHT) { LaboratoryLampLight() }
|
||||
|
@ -160,6 +160,11 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
|
||||
accept(MItems.TRITANIUM_INGOT)
|
||||
accept(MItems.TRITANIUM_INGOT_BLOCK)
|
||||
|
||||
accept(MItems.DILITHIUM_ORE)
|
||||
accept(MItems.DEEPSLATE_DILITHIUM_ORE)
|
||||
accept(MItems.DILITHIUM_CRYSTAL)
|
||||
accept(MItems.DILITHIUM_CRYSTAL_BLOCK)
|
||||
|
||||
accept(MItems.TRITANIUM_TOOLS)
|
||||
accept(MItems.TRITANIUM_SHIELD)
|
||||
accept(MItems.SIMPLE_TRITANIUM_ARMOR)
|
||||
|
@ -27,6 +27,9 @@ object MItemTags {
|
||||
val INDUSTRIAL_GLASS: TagKey<Item> = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "industrial_glass"))
|
||||
val UPGRADES: TagKey<Item> = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "upgrades"))
|
||||
|
||||
val DILITHIUM_ORES: TagKey<Item> = ItemTags.create(ResourceLocation("c", "ores/dilithium"))
|
||||
val DILITHIUM_GEMS: TagKey<Item> = ItemTags.create(ResourceLocation("c", "gems/dilithium"))
|
||||
|
||||
val CRAFTING_TABLES: TagKey<Item> = ItemTags.create(ResourceLocation("c", "crafting_tables"))
|
||||
val WORKBENCHES: TagKey<Item> = ItemTags.create(ResourceLocation("c", "workbenches"))
|
||||
val WORKBENCH: TagKey<Item> = ItemTags.create(ResourceLocation("c", "workbench"))
|
||||
|
@ -325,6 +325,11 @@ object MItems {
|
||||
val TRITANIUM_BARS: BlockItem by registry.register(MNames.TRITANIUM_BARS) { BlockItem(MBlocks.TRITANIUM_BARS, DEFAULT_PROPERTIES) }
|
||||
val METAL_RAILING: BlockItem by registry.register(MNames.METAL_RAILING) { BlockItem(MBlocks.METAL_RAILING, DEFAULT_PROPERTIES) }
|
||||
|
||||
val DILITHIUM_CRYSTAL by registry.register("dilithium_crystal") { MatteryItem(DEFAULT_PROPERTIES) }
|
||||
val DILITHIUM_ORE by registry.register("dilithium_ore") { BlockItem(MBlocks.DILITHIUM_ORE, DEFAULT_PROPERTIES) }
|
||||
val DEEPSLATE_DILITHIUM_ORE by registry.register("deepslate_dilithium_ore") { BlockItem(MBlocks.DEEPSLATE_DILITHIUM_ORE, DEFAULT_PROPERTIES) }
|
||||
val DILITHIUM_CRYSTAL_BLOCK by registry.register("dilithium_crystal_block") { BlockItem(MBlocks.DILITHIUM_CRYSTAL_BLOCK, DEFAULT_PROPERTIES) }
|
||||
|
||||
val REDSTONE_INTERACTOR: RedstoneInteractorItem by registry.register("redstone_interactor") { RedstoneInteractorItem() }
|
||||
|
||||
val ESSENCE_SERVO: EssenceServoItem by registry.register("essence_servo") { EssenceServoItem() }
|
||||
|
@ -15,17 +15,11 @@ import ru.dbotthepony.mc.otm.data.condition.ChanceCondition
|
||||
object MLootItemConditions {
|
||||
private val registry = MDeferredRegister(Registries.LOOT_CONDITION_TYPE, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
val HAS_EXOPACK: LootItemConditionType by registry.register("has_exopack") { LootItemConditionType(
|
||||
SingletonCodec(HasExoPackCondition)
|
||||
) }
|
||||
val HAS_EXOPACK: LootItemConditionType by registry.register("has_exopack") { LootItemConditionType(SingletonCodec(HasExoPackCondition)) }
|
||||
val CHANCE_WITH_PLAYTIME: LootItemConditionType by registry.register("chance_with_playtime") { LootItemConditionType(ChanceWithPlaytimeCondition.CODEC) }
|
||||
val ITEM_IN_INVENTORY: LootItemConditionType by registry.register("item_in_inventory") { LootItemConditionType(ItemInInventoryCondition.CODEC) }
|
||||
val KILLED_BY_REAL_PLAYER: LootItemConditionType by registry.register("killed_by_real_player") { LootItemConditionType(
|
||||
SingletonCodec(KilledByRealPlayer)
|
||||
) }
|
||||
val KILLED_BY_REAL_PLAYER_OR_INDIRECTLY: LootItemConditionType by registry.register("killed_by_real_player_or_indirectly") { LootItemConditionType(
|
||||
SingletonCodec(KilledByRealPlayerOrIndirectly)
|
||||
) }
|
||||
val KILLED_BY_REAL_PLAYER: LootItemConditionType by registry.register("killed_by_real_player") { LootItemConditionType(SingletonCodec(KilledByRealPlayer)) }
|
||||
val KILLED_BY_REAL_PLAYER_OR_INDIRECTLY: LootItemConditionType by registry.register("killed_by_real_player_or_indirectly") { LootItemConditionType(SingletonCodec(KilledByRealPlayerOrIndirectly)) }
|
||||
val CHANCE: LootItemConditionType by registry.register("chance") { LootItemConditionType(ChanceCondition.CODEC) }
|
||||
|
||||
fun register(bus: IEventBus) {
|
||||
|
@ -0,0 +1,17 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.world.level.storage.loot.providers.number.LootNumberProviderType
|
||||
import net.neoforged.bus.api.IEventBus
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.data.loot.Int2NumberProvider
|
||||
|
||||
object MLootNumberProviders {
|
||||
private val registry = MDeferredRegister(BuiltInRegistries.LOOT_NUMBER_PROVIDER_TYPE, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
fun register(bus: IEventBus) {
|
||||
registry.register(bus)
|
||||
}
|
||||
|
||||
val INT_2_NUMBER_TYPE by registry.register("int2number") { LootNumberProviderType(Int2NumberProvider.CODEC) }
|
||||
}
|
@ -58,7 +58,7 @@ object MNames {
|
||||
|
||||
const val STORAGE_CABLE = "storage_cable" // нужен рецепт
|
||||
const val STORAGE_POWER_SUPPLIER = "storage_power_supplier" // нужен рецепт
|
||||
const val GRILL = "grill" // нужен рецепт
|
||||
const val GRILL = "grill"
|
||||
|
||||
const val DEBUG_EXPLOSION_SMALL = "debug_explosion_small"
|
||||
const val DEBUG_SPHERE_POINTS = "debug_sphere_points"
|
||||
|
Loading…
Reference in New Issue
Block a user