This commit is contained in:
GearShocky 2025-03-05 05:59:10 +05:00
parent 4187e7818e
commit 5956b5d76f
7 changed files with 103 additions and 7 deletions

View File

@ -585,6 +585,7 @@ object DataGen {
addDecorativeLoot(lootTableProvider)
addAdvancementLoot(lootTableProvider)
addVaultLoot(lootTableProvider)
addEntityLoot(lootTableProvider)
addChestLootTables(lootTableProvider)
recipeProvider.exec { _, consumer ->

View File

@ -0,0 +1,21 @@
package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import ru.dbotthepony.mc.otm.datagen.modLootTable
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addEntityLoot(loot: LootTables) {
loot.builder(LootContextParamSets.ENTITY, modLootTable("entities/loader")) {
lootPool {
item(MItems.MECHANICAL_PARTS) {
setCount(1, 3)
setWeight(7)
}
item(MItems.ELECTRIC_PARTS) {
setCount(1, 1)
setWeight(1)
}
setRolls(1)
}
}
}

View File

@ -1,8 +1,14 @@
package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.item.Items
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.data.world.UniformDecimal
import ru.dbotthepony.mc.otm.datagen.modLootTable
import ru.dbotthepony.mc.otm.item.ProceduralBatteryItem
import ru.dbotthepony.mc.otm.item.exopack.ProceduralExopackSlotUpgradeItem
import ru.dbotthepony.mc.otm.item.matter.MatterDustItem
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addChestLootTables(loot: LootTables) {
@ -28,24 +34,72 @@ fun addChestLootTables(loot: LootTables) {
item(Items.COPPER_INGOT) { setCount(minimal = 1, maximal = 3) }
item(Items.EXPOSED_COPPER) { setCount(minimal = 1, maximal = 2) }
setRolls(3)
item(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1)
setWeight(1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(1, 9), UniformInt.of(0, 3)))
}
setRolls(7)
}
}
loot.builder(LootContextParamSets.CHEST, modLootTable("frigate_cargo")) {
lootPool {
item(Items.IRON_INGOT) { setCount(minimal = 1, maximal = 3) }
item(Items.IRON_INGOT) {
setCount(minimal = 1, maximal = 3)
setWeight(3)
}
item(Items.GOLD_INGOT) { setCount(minimal = 1, maximal = 3) }
item(Items.EMERALD) { setCount(minimal = 1, maximal = 3) }
item(MItems.TRITANIUM_INGOT) { setCount(minimal = 1, maximal = 3) }
item(MItems.MECHANICAL_PARTS) { setCount(minimal = 2, maximal = 3) }
item(MItems.MECHANICAL_PARTS) {
setCount(minimal = 2, maximal = 3)
setWeight(2)
}
item(MItems.CIRCUIT_PLATING) { setCount(minimal = 2, maximal = 3) }
item(MItems.ENERGY_BUS) { setCount(minimal = 0, maximal = 2) }
item(MItems.ROFLITE_ALLOY_INGOT) { setCount(minimal = 0, maximal = 3) }
item(MItems.WITHERED_STEEL) { setCount(minimal = 0, maximal = 3) }
item(Items.SADDLE) { setCount(minimal = 0, maximal = 1) }
item(Items.DIAMOND) { setCount(minimal = 0, maximal = 3) }
setRolls(3)
item(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.2)
setWeight(3)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(1, 9), UniformInt.of(0, 3)))
}
item(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1)
setWeight(2)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18), UniformInt.of(0, 3)))
}
item(MItems.PROCEDURAL_BATTERY) {
chanceCondition(0.05)
setWeight(1)
apply(
ProceduralBatteryItem.Randomizer(
maxBatteryLevel = UniformDecimal(Decimal(10_000_000), Decimal(50_000_000)),
batteryLevel = UniformDecimal(Decimal(0), Decimal(25_000_000)),
maxInput = UniformDecimal(Decimal(1_000), Decimal(5_000)),
))
}
item(MItems.ZPM_BATTERY) {
chanceCondition(0.001)
setWeight(1)
}
item(MItems.MATTER_DUST) {
chanceCondition(0.1)
setWeight(4)
apply(MatterDustItem.Randomizer(UniformDecimal(Decimal(100), Decimal(2_500))))
}
setRolls(12)
}
}
@ -57,7 +111,16 @@ fun addChestLootTables(loot: LootTables) {
item(Items.SNOWBALL) { setCount(minimal = 1, maximal = 5) }
item(Items.PACKED_ICE) { setCount(minimal = 2, maximal = 3) }
setRolls(3)
setRolls(7)
}
}
loot.builder(LootContextParamSets.CHEST, modLootTable("laboratory/reward")) {
lootPool {
item(MItems.NUTRIENT_PASTE) { setCount(minimal = 2, maximal = 3) }
setRolls(5)
}
}
}

View File

@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.datagen.models
import net.minecraft.world.item.DyeColor
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.datagen.DataGen
@ -81,7 +82,6 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
}
}
}
fun decorativeCubeAll(subdir: String, vararg blocks: Block) {
for (block in blocks) {
exec {

View File

@ -3,6 +3,10 @@ package ru.dbotthepony.mc.otm.entity
import net.minecraft.network.syncher.EntityDataAccessor
import net.minecraft.network.syncher.EntityDataSerializers
import net.minecraft.network.syncher.SynchedEntityData
import net.minecraft.resources.ResourceKey
import net.minecraft.core.registries.Registries
import ru.dbotthepony.mc.otm.core.ResourceLocation
import net.minecraft.world.level.storage.loot.LootTable
import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents
import net.minecraft.world.entity.AnimationState
@ -21,6 +25,7 @@ import net.minecraft.world.entity.ai.navigation.PathNavigation
import net.minecraft.world.entity.monster.Monster
import net.minecraft.world.entity.player.Player
import net.minecraft.world.level.Level
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
@ -100,6 +105,11 @@ class Loader(type: EntityType<Loader>, level: Level) : Monster(type, level) {
return success
}
override fun getDefaultLootTable(): ResourceKey<LootTable> {
return ResourceKey.create(Registries.LOOT_TABLE,
ResourceLocation(OverdriveThatMatters.MOD_ID, "entities/loader"))
}
override fun aiStep() {
super.aiStep()

View File

@ -18,6 +18,7 @@ import net.minecraft.world.level.block.SoundType
import net.minecraft.world.level.block.StairBlock
import net.minecraft.world.level.block.TransparentBlock
import net.minecraft.world.level.block.WallBlock
import net.minecraft.world.level.block.WaterloggedTransparentBlock
import net.minecraft.world.level.block.state.BlockBehaviour
import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument
@ -266,7 +267,7 @@ object MBlocks {
}
val METAL_MESH: Block by registry.register(MNames.METAL_MESH) {
TransparentBlock(BlockBehaviour.Properties.of()
WaterloggedTransparentBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_GRAY)
.noOcclusion()
.sound(SoundType.COPPER_GRATE)

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B