Merge branch '1.21' into new-container-api

This commit is contained in:
DBotThePony 2025-03-03 14:44:54 +07:00
commit edb3aa657d
Signed by: DBot
GPG Key ID: DCC23B5715498507
62 changed files with 1180 additions and 46 deletions

1
src/bb/loader.bbmodel Normal file

File diff suppressed because one or more lines are too long

View File

@ -226,6 +226,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
}
DataGen.decorativePillar(MBlocks.METAL_BEAM, "metal_beam_side", "metal_beam_top")
blockModelProvider.decorativeCubeAll(MBlocks.METAL_BEAM_CENTER, "metal_beam_top")
var labLampOn: BlockModelBuilder? = null
var labLampOff: BlockModelBuilder? = null
@ -259,6 +260,9 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
itemModelProvider.block(MItems.DANGER_STRIPE_BLOCK, MItems.DANGER_STRIPE_BLOCK.registryName!!.path + "_0")
itemModelProvider.block(MItems.METAL_BEAM)
blockStateProvider.block(MBlocks.METAL_BEAM_CENTER)
itemModelProvider.block(MItems.METAL_BEAM_CENTER)
blockStateProvider.exec {
blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP).forAllStates {
return@forAllStates ConfiguredModel.builder()

View File

@ -47,6 +47,18 @@ class SoundDataProvider(event: GatherDataEvent) : SoundDefinitionsProvider(event
.stream()
))
add(
MSoundEvents.LOADER_AMBIENT,
definition().subtitle("otm.sound.entity.loader.loader_ambient")
.with(
SoundDefinition.Sound.sound(modLocation("entity/loader/loader_ambient"), SoundDefinition.SoundType.SOUND)
.attenuationDistance(32)
.stream(),
SoundDefinition.Sound.sound(modLocation("entity/loader/loader_ambient2"), SoundDefinition.SoundType.SOUND)
.attenuationDistance(32)
.stream()
))
add(
MSoundEvents.ANDROID_PROJ_PARRY,
definition().subtitle("otm.sound.android.projectile_parry")

View File

@ -11,6 +11,8 @@ fun addBlockModels(provider: MatteryBlockModelProvider) {
resourceCubeAll(MBlocks.DEEPSLATE_TRITANIUM_ORE)
resourceCubeAll(MBlocks.TRITANIUM_INGOT_BLOCK)
resourceCubeAll(MBlocks.WITHERED_STEEL_BLOCK)
resourceCubeAll(MBlocks.DILITHIUM_ORE)
resourceCubeAll(MBlocks.DEEPSLATE_DILITHIUM_ORE)
resourceCubeAll(MBlocks.DILITHIUM_CRYSTAL_BLOCK)

View File

@ -32,6 +32,20 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
provider.ore(MBlocks.TRITANIUM_RAW_BLOCK)
provider.block(MBlocks.TRITANIUM_INGOT_BLOCK)
provider.block(MBlocks.WITHERED_STEEL_BLOCK)
provider.exec {
provider.getVariantBuilder(MBlocks.ROFLITE_ALLOY_BLOCK).forAllStates {
val side1 = modLocation("block/resource/roflite_alloy_1")
val side2 = modLocation("block/resource/roflite_alloy_2")
val top = modLocation("block/resource/roflite_alloy_top")
val a = provider.models().cube(MBlocks.ROFLITE_ALLOY_BLOCK.registryName!!.path, top, top, side1, side1, side2, side2).texture("particle", side1)
val b = provider.models().cube("${MBlocks.ROFLITE_ALLOY_BLOCK.registryName!!.path}_b", top, top, side2, side2, side1, side1).texture("particle", side2)
return@forAllStates arrayOf(ConfiguredModel.builder().modelFile(a).buildLast(), ConfiguredModel.builder().modelFile(b).buildLast())
}
}
provider.ore(MBlocks.DILITHIUM_ORE)
provider.ore(MBlocks.DEEPSLATE_DILITHIUM_ORE)
provider.block(MBlocks.DILITHIUM_CRYSTAL_BLOCK)

View File

@ -35,6 +35,9 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.block(MItems.TRITANIUM_RAW_BLOCK)
provider.block(MItems.TRITANIUM_INGOT_BLOCK)
provider.block(MItems.WITHERED_STEEL_BLOCK)
provider.block(MItems.ROFLITE_ALLOY_BLOCK)
provider.block(MItems.DILITHIUM_ORE)
provider.block(MItems.DEEPSLATE_DILITHIUM_ORE)
provider.block(MItems.DILITHIUM_CRYSTAL_BLOCK)
@ -68,6 +71,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.generated(MItems.PILL_HEAL)
provider.generated(MItems.PILL_NOT_NORMAL)
provider.generated(MItems.NUTRIENT_PASTE)
provider.generated(MItems.IMPERFECT_BREAD)
provider.generated(MItems.REDSTONE_INTERACTOR)
provider.generated(MItems.ESSENCE_DRIVE)
@ -100,6 +104,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.resource(MItems.DILITHIUM_CRYSTAL)
provider.resource(MItems.WITHERED_STEEL)
provider.resource(MItems.ROFLITE_ALLOY_INGOT)
provider.generated(MItems.EXOPACK_PROBE)
@ -110,6 +115,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.handheld(MItems.CHEST_UPGRADER)
provider.generated(MItems.BREAD_MONSTER_SPAWN_EGG, modLocation("item/egg/bread_monster"))
provider.generated(MItems.LOADER_SPAWN_EGG, modLocation("item/egg/loader"))
provider.generatedTiered(MItems.BATTERIES, "battery_tier")
provider.generated(MItems.BATTERY_CREATIVE)

View File

@ -612,6 +612,8 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.HOLO_SIGN, "desc", "Multi-line, colored and glowing, text sign")
add(MBlocks.TRITANIUM_INGOT_BLOCK, "Tritanium Plating Block")
add(MBlocks.WITHERED_STEEL_BLOCK, "Withered Steel Block")
add(MBlocks.ROFLITE_ALLOY_BLOCK, "Roflite Alloy Block")
addBlock(MBlocks.ENERGY_COUNTER.values, "Energy Counter")
addBlock(MBlocks.ENERGY_COUNTER.values, "desc", "Restricts energy flow direction;")
@ -679,6 +681,7 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.LABORATORY_LAMP_INVERTED, "Laboratory Lamp (Inverted signal)")
add(MBlocks.DANGER_STRIPE_BLOCK, "Danger Stripes")
add(MBlocks.METAL_BEAM, "Metal Beam")
add(MBlocks.METAL_BEAM_CENTER, "Metal Beam (Center)")
add(MBlocks.TRITANIUM_DOOR[null]!!, "Tritanium Door")
add(MBlocks.TRITANIUM_DOOR[null]!!, "description0", "High blast resistance door with redstone latch...")
@ -741,6 +744,7 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ESSENCE_SERVO, "desc2", "Can be used as a tool to pump essence manually")
add(MItems.NUTRIENT_PASTE, "Nutrient Paste")
add(MItems.IMPERFECT_BREAD, "Imperfect Bread")
add(MItems.FLUID_CAPSULE, "Fluid Capsule")
add(MItems.FLUID_CAPSULE, "named", "Fluid Capsule (%s)")
@ -788,6 +792,7 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.TRITANIUM_INGOT, "Tritanium Ingot")
add(MItems.DILITHIUM_CRYSTAL, "Dilithium Crystal")
add(MItems.WITHERED_STEEL, "Withered Steel Ingot")
add(MItems.ROFLITE_ALLOY_INGOT, "Roflite Alloy Ingot")
add(MItems.TRITANIUM_NUGGET, "Tritanium Nugget")
add(MItems.MATTER_IO_PORT, "Matter IO Port")
add(MItems.MATTER_TRANSFORM_MATRIX, "Matter Transformation Matrix")
@ -915,6 +920,9 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.BREAD_MONSTER_SPAWN_EGG, "Bread Monster Spawn Egg")
add(MEntityTypes.BREAD_MONSTER, "Bread Monster")
add(MItems.LOADER_SPAWN_EGG, "Loader Spawn Egg")
add(MEntityTypes.LOADER, "Loader")
}
}

View File

@ -616,6 +616,8 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.HOLO_SIGN, "desc", "Многострочная, крашеная и светящееся, табличка")
add(MBlocks.TRITANIUM_INGOT_BLOCK, "Блок слитков тритана")
add(MBlocks.WITHERED_STEEL_BLOCK, "Блок иссушенной стали")
add(MBlocks.ROFLITE_ALLOY_BLOCK, "Блок рофлитового сплава")
addBlock(MBlocks.ENERGY_COUNTER.values, "Счётчик энергии")
addBlock(MBlocks.ENERGY_COUNTER.values, "desc", "Ограничивает направление передачи энергии;")
@ -682,6 +684,7 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.LABORATORY_LAMP_INVERTED, "Лабораторная лампа (инвентированный сигнал)")
add(MBlocks.DANGER_STRIPE_BLOCK, "Полоски 'опасность'")
add(MBlocks.METAL_BEAM, "Металлическая опора")
add(MBlocks.METAL_BEAM_CENTER, "Металлическая опора (середина)")
add(MBlocks.TRITANIUM_DOOR[null]!!, "Тритановая дверь")
add(MBlocks.TRITANIUM_DOOR[null]!!, "description0", "Взрывоустойчивая дверь с засовом красного камня...")
@ -734,6 +737,7 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ESSENCE_SERVO, "desc2", "Может использоваться как инструмент для ручной перекачки эссенции")
add(MItems.NUTRIENT_PASTE, "Питательная паста")
add(MItems.IMPERFECT_BREAD, "Несовершенный хлеб")
add(MItems.FLUID_CAPSULE, "Жидкостная капсула")
add(MItems.FLUID_CAPSULE, "named", "Жидкостная капсула (%s)")
@ -781,6 +785,7 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.TRITANIUM_INGOT, "Тритановый слиток")
add(MItems.DILITHIUM_CRYSTAL, "Дилитевый кристалл")
add(MItems.WITHERED_STEEL, "Слиток иссушенной стали")
add(MItems.ROFLITE_ALLOY_INGOT, "Слиток рофлитового сплава")
add(MItems.TRITANIUM_NUGGET, "Тритановый самородок")
add(MItems.MATTER_IO_PORT, "Порт ввода/вывода материи")
add(MItems.MATTER_TRANSFORM_MATRIX, "Матрица преобразования материи")
@ -908,6 +913,9 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.BREAD_MONSTER_SPAWN_EGG, "Яйцо призыва хлебного монстра")
add(MEntityTypes.BREAD_MONSTER, "Хлебный монстр")
add(MItems.LOADER_SPAWN_EGG, "Яйцо призыва погрузчика")
add(MEntityTypes.LOADER, "Погрузчик")
}
}

View File

@ -50,6 +50,8 @@ fun addDecorativeLoot(lootTables: LootTables) {
lootTables.dropsSelf(MBlocks.TRITANIUM_INGOT_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_BARS) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.WITHERED_STEEL_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_HULL) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.GENERATOR_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }

View File

@ -177,6 +177,11 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.save(consumer, modLocation("decorative/vent/from_alt/${color?.name?.lowercase() ?: "default"}"))
}
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.METAL_BEAM_CENTER, 1).requires(MItems.METAL_BEAM)
.unlockedBy(MItems.METAL_BEAM)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.METAL_BEAM, 1).requires(MItems.METAL_BEAM_CENTER)
.unlockedBy(MItems.METAL_BEAM_CENTER)
MatteryRecipe(MRegistry.DECORATIVE_CRATE.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(Tags.Items.INGOTS_IRON)
.row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONES, Tags.Items.INGOTS_IRON)

View File

@ -93,4 +93,24 @@ fun addShapelessRecipes(consumer: RecipeOutput) {
hammerRecipe(MItems.TRITANIUM_PLATE, MItemTags.TRITANIUM_INGOTS, consumer)
hammerRecipe(MItems.IRON_PLATE, Tags.Items.INGOTS_IRON, consumer)
hammerRecipe(MItems.GOLD_PLATE, Tags.Items.INGOTS_GOLD, consumer)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.WITHERED_STEEL_BLOCK, 1)
.requires(Ingredient.of(MItems.WITHERED_STEEL), 9)
.unlockedBy(MItems.WITHERED_STEEL)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.WITHERED_STEEL, 9)
.requires(Ingredient.of(MItems.WITHERED_STEEL_BLOCK))
.unlockedBy(MItems.WITHERED_STEEL_BLOCK)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.ROFLITE_ALLOY_BLOCK, 1)
.requires(Ingredient.of(MItems.ROFLITE_ALLOY_INGOT), 9)
.unlockedBy(MItems.ROFLITE_ALLOY_INGOT)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.ROFLITE_ALLOY_INGOT, 9)
.requires(Ingredient.of(MItems.ROFLITE_ALLOY_BLOCK))
.unlockedBy(MItems.ROFLITE_ALLOY_BLOCK)
.save(consumer)
}

View File

@ -11,7 +11,11 @@ import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry
fun addConstructionTags(tagsProvider: TagsProvider) {
tagsProvider.blocks.Appender(BlockTags.BEACON_BASE_BLOCKS).add(MBlocks.TRITANIUM_INGOT_BLOCK)
tagsProvider.blocks.Appender(BlockTags.BEACON_BASE_BLOCKS)
.add(MBlocks.TRITANIUM_INGOT_BLOCK)
.add(MBlocks.DILITHIUM_CRYSTAL_BLOCK)
.add(MBlocks.WITHERED_STEEL_BLOCK)
.add(MBlocks.ROFLITE_ALLOY_BLOCK)
tagsProvider.blocks.Appender(MBlockTags.MULTIBLOCK_STRUCTURE)
.add(MBlockTags.MULTIBLOCK_HARD_STRUCTURE, MBlockTags.MULTIBLOCK_SOFT_STRUCTURE)

View File

@ -51,6 +51,8 @@ fun addMineableTags(tagsProvider: TagsProvider) {
*MBlocks.ENERGY_SERVO.values.toTypedArray(),
MBlocks.TRITANIUM_INGOT_BLOCK,
MBlocks.WITHERED_STEEL_BLOCK,
MBlocks.METAL_JUNK,
MBlocks.METAL_MESH,
MBlocks.TRITANIUM_BARS,
@ -96,6 +98,7 @@ fun addMineableTags(tagsProvider: TagsProvider) {
MBlocks.DILITHIUM_ORE,
MBlocks.DEEPSLATE_DILITHIUM_ORE,
MBlocks.DILITHIUM_CRYSTAL_BLOCK,
MBlocks.ROFLITE_ALLOY_BLOCK,
MBlocks.GRAVITATION_STABILIZER,
MBlocks.GRAVITATION_STABILIZER_LENS,
@ -143,6 +146,7 @@ fun addMineableTags(tagsProvider: TagsProvider) {
tagsProvider.requiresPickaxe(MBlocks.LABORATORY_LAMP, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.LABORATORY_LAMP_INVERTED, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.METAL_BEAM, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.METAL_BEAM_CENTER, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.DANGER_STRIPE_BLOCK)
}

View File

@ -21,6 +21,8 @@ fun addResourceTags(tagsProvider: TagsProvider) {
tagsProvider.dusts.add("tritanium", MItems.TRITANIUM_DUST)
tagsProvider.ingots.add("tritanium", MItems.TRITANIUM_INGOT)
tagsProvider.ingots.add("withered_steel", MItems.WITHERED_STEEL)
tagsProvider.ingots.add("roflite_alloy", MItems.ROFLITE_ALLOY_INGOT)
tagsProvider.wires.add("copper", MItems.COPPER_WIRING)
tagsProvider.wires.add("gold", MItems.GOLD_WIRING)
@ -32,6 +34,10 @@ fun addResourceTags(tagsProvider: TagsProvider) {
tagsProvider.storageBlocksAsItem.add("tritanium", MItems.TRITANIUM_INGOT_BLOCK)
tagsProvider.storageBlocksAsBlock.add("tritanium", MBlocks.TRITANIUM_INGOT_BLOCK)
tagsProvider.storageBlocksAsItem.add("withered_steel", MItems.WITHERED_STEEL_BLOCK)
tagsProvider.storageBlocksAsBlock.add("withered_steel", MBlocks.WITHERED_STEEL_BLOCK)
tagsProvider.storageBlocksAsItem.add("roflite_alloy", MItems.ROFLITE_ALLOY_BLOCK)
tagsProvider.storageBlocksAsBlock.add("roflite_alloy", MBlocks.ROFLITE_ALLOY_BLOCK)
tagsProvider.singleDropOre(
MBlocks.TRITANIUM_ORE,

View File

@ -20,6 +20,8 @@ fun addTags(tagsProvider: TagsProvider) {
tagsProvider.items.Appender(ItemTags.BEACON_PAYMENT_ITEMS)
.add(MItems.TRITANIUM_INGOT)
.add(MItems.DILITHIUM_CRYSTAL)
.add(MItems.WITHERED_STEEL)
.add(MItems.ROFLITE_ALLOY_INGOT)
tagsProvider.items.Appender(ItemTags.MEAT).add(MItems.NUTRIENT_PASTE)

View File

@ -0,0 +1,129 @@
package ru.dbotthepony.mc.otm.client.animation;
import net.minecraft.client.animation.AnimationChannel;
import net.minecraft.client.animation.AnimationDefinition;
import net.minecraft.client.animation.Keyframe;
import net.minecraft.client.animation.KeyframeAnimations;
public class LoaderAnimation {
public static final AnimationDefinition IDLE = AnimationDefinition.Builder.withLength(0.16F).looping()
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.08F, KeyframeAnimations.posVec(0F, -0.1F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Head", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.08F, KeyframeAnimations.posVec(0F, -0.1F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0.1F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, -0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0.1F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, -0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
public static final AnimationDefinition MOVE = AnimationDefinition.Builder.withLength(0.48F).looping()
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0.3F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0.3F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Head", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0.3F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0.3F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftLeg", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, -2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 1F, 1F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 2F, -2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, -2F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightLeg", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 2F, -2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, -2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 2F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(-22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(-6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowR", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-30F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(-19.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-30F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowL", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-16.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(-25.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-16.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.withLength(0.48F).looping()
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-135F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowR", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-24.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-2F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-135F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowL", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-24.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-2F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
}

View File

@ -0,0 +1,100 @@
package ru.dbotthepony.mc.otm.client.model.entity;
import net.minecraft.client.model.HierarchicalModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import org.jetbrains.annotations.NotNull;
import ru.dbotthepony.mc.otm.client.animation.LoaderAnimation;
import ru.dbotthepony.mc.otm.entity.Loader;
import ru.dbotthepony.mc.otm.registry.MNames;
import static ru.dbotthepony.mc.otm.OverdriveThatMatters.loc;
public class LoaderModel {
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(loc(MNames.LOADER), "main");
private static HierarchicalModel<Loader> model;
private static LayerDefinition def;
public static HierarchicalModel<Loader> getModel() {
if (def == null) {
def = createBodyLayer(); // Ensure def is created before using it
}
if (model == null) {
return model = new LoaderHierarchicalModel<>(def.bakeRoot());
}
return model;
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F));
PartDefinition Head = root.addOrReplaceChild("Head", CubeListBuilder.create().texOffs(48, 23).addBox(-3.0F, -1.0F, -2.0F, 6.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-4.0F, -32.0F, -5.0F));
PartDefinition Body = root.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(0, 0).addBox(-10.0F, -16.0F, -5.0F, 20.0F, 10.0F, 13.0F, new CubeDeformation(0.0F))
.texOffs(0, 50).addBox(-3.0F, -3.0F, -4.0F, 6.0F, 5.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(112, 52).addBox(10.0F, -13.0F, 0.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(96, 52).addBox(-12.0F, -13.0F, -1.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(53, 0).addBox(-5.0F, -1.0F, 4.0F, 10.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -26.0F, -1.0F));
PartDefinition antenna_r1 = Body.addOrReplaceChild("antenna_r1", CubeListBuilder.create().texOffs(76, 6).addBox(0.0F, -7.0F, -1.0F, 0.0F, 14.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(8.0F, -22.0F, 8.0F, -0.2618F, 0.0F, 0.0F));
PartDefinition waist_r1 = Body.addOrReplaceChild("waist_r1", CubeListBuilder.create().texOffs(28, 50).addBox(-2.0F, -5.0F, -4.0F, 4.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, 2.0F, -0.2618F, 0.0F, 0.0F));
PartDefinition LeftLeg = root.addOrReplaceChild("LeftLeg", CubeListBuilder.create().texOffs(106, 24).addBox(0.0F, 10.0F, -2.0F, 4.0F, 16.0F, 7.0F, new CubeDeformation(0.0F))
.texOffs(66, 46).addBox(-1.0F, -2.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(4.0F, -26.0F, -1.0F));
PartDefinition RightLeg = root.addOrReplaceChild("RightLeg", CubeListBuilder.create().texOffs(84, 24).addBox(-4.0F, 10.0F, -2.0F, 4.0F, 16.0F, 7.0F, new CubeDeformation(0.0F))
.texOffs(48, 34).addBox(-5.0F, -2.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(-4.0F, -26.0F, -1.0F));
PartDefinition LeftArm = root.addOrReplaceChild("LeftArm", CubeListBuilder.create().texOffs(104, 0).addBox(-1.0F, -7.0F, -4.0F, 4.0F, 16.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(13.0F, -36.0F, 2.0F));
PartDefinition ElbowL = LeftArm.addOrReplaceChild("ElbowL", CubeListBuilder.create().texOffs(24, 23).addBox(-2.0F, -0.2F, -2.0F, 4.0F, 19.0F, 8.0F, new CubeDeformation(-0.1F)), PartPose.offset(1.0F, 9.0F, -1.0F));
PartDefinition RightArm = root.addOrReplaceChild("RightArm", CubeListBuilder.create().texOffs(80, 0).addBox(-3.0F, -7.0F, -4.0F, 4.0F, 16.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(-13.0F, -36.0F, 1.0F));
PartDefinition ElbowR = RightArm.addOrReplaceChild("ElbowR", CubeListBuilder.create().texOffs(0, 23).addBox(-2.0F, -0.2F, -2.0F, 4.0F, 19.0F, 8.0F, new CubeDeformation(-0.1F)), PartPose.offset(-1.0F, 9.0F, -1.0F));
model = null;
return def = LayerDefinition.create(meshdefinition, 128, 64);
}
private static class LoaderHierarchicalModel<T extends Loader> extends HierarchicalModel<T> {
private final ModelPart root;
public LoaderHierarchicalModel(ModelPart root) {
this.root = root.getChild("root");
}
@Override
public void setupAnim(@NotNull T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
this.root().getAllParts().forEach(ModelPart::resetPose);
this.root.getChild("Head").yRot = netHeadYaw * ((float) Math.PI / 180F);
this.root.getChild("Head").xRot = headPitch * ((float) Math.PI / 180F);
if (entity.getAttackAnimationTick() > 0) {
this.animate(entity.getIdleState(), LoaderAnimation.ATTACK, ageInTicks, 1.0F);
}
this.animateWalk(LoaderAnimation.MOVE, limbSwing, limbSwingAmount, 1.0F, 2.5F);
this.animate(entity.getIdleState(), LoaderAnimation.IDLE, ageInTicks, 1.0F);
}
public ModelPart getHead() {
return this.root.getChild("Head");
}
@Override
public @NotNull ModelPart root() {
return this.root;
}
}
public static void register(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(LAYER_LOCATION, LoaderModel::createBodyLayer);
}
}

View File

@ -0,0 +1,18 @@
package ru.dbotthepony.mc.otm.mixin;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import ru.dbotthepony.mc.otm.core.IMatteryLevel;
import ru.dbotthepony.mc.otm.core.util.CMWCRandom;
@Mixin(Level.class)
public abstract class LevelMixin implements IMatteryLevel {
public final RandomSource otm_random = new CMWCRandom();
@Override
public @NotNull RandomSource getOtmRandom() {
return otm_random;
}
}

View File

@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import ru.dbotthepony.mc.otm.capability.IMatteryPlayer;
import ru.dbotthepony.mc.otm.core.IMatteryLevel;
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents;
@Mixin(AbstractHurtingProjectile.class)
@ -24,7 +25,7 @@ public class MixinAbstractHurtingProjectile {
AbstractHurtingProjectile proj = (AbstractHurtingProjectile)(Object)this;
if (cap.isAndroid() && proj.getOwner() != entity) {
entity.level().playSound(entity, proj.blockPosition(), MSoundEvents.INSTANCE.getANDROID_PROJ_PARRY(), SoundSource.PLAYERS, 1.0f, 0.95f + entity.level().random.nextFloat() * 0.1f);
entity.level().playSound(entity, proj.blockPosition(), MSoundEvents.INSTANCE.getANDROID_PROJ_PARRY(), SoundSource.PLAYERS, 1.0f, 0.95f + ((IMatteryLevel) entity.level()).getOtmRandom().nextFloat() * 0.1f);
}
}
}

View File

@ -49,6 +49,7 @@ import ru.dbotthepony.mc.otm.core.math.rotateXDegrees
import ru.dbotthepony.mc.otm.core.math.rotateYDegrees
import ru.dbotthepony.mc.otm.core.math.shortestDistanceBetween
import ru.dbotthepony.mc.otm.core.math.times
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.milliTime
import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures
import ru.dbotthepony.mc.otm.triggers.EnderTeleporterFallDeathTrigger
@ -302,7 +303,7 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A
val event = EventHooks.onEnderTeleport(ply, blockPos.x + 0.5, blockPos.y.toDouble(), blockPos.z + 0.5)
if (event.isCanceled) {
(ply as ServerPlayer).connection.send(ClientboundSoundEntityPacket(SoundEvents.ITEM_BREAK.holder, SoundSource.PLAYERS, ply, 0.3f, 0.5f, ply.level().random.nextLong()))
(ply as ServerPlayer).connection.send(ClientboundSoundEntityPacket(SoundEvents.ITEM_BREAK.holder, SoundSource.PLAYERS, ply, 0.3f, 0.5f, ply.level().otmRandom.nextLong()))
return false
}
@ -310,9 +311,9 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A
lastTeleport = ply.server!!.tickCount
android.androidEnergy.extractEnergy(AndroidConfig.EnderTeleporter.ENERGY_COST, false)
ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 0.3f, 0.8f + ply.level().random.nextFloat() * 0.4f)
ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 0.3f, 0.8f + ply.level().otmRandom.nextFloat() * 0.4f)
ply.teleportTo(event.targetX, event.targetY, event.targetZ)
ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 1f, 0.8f + ply.level().random.nextFloat() * 0.4f)
ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 1f, 0.8f + ply.level().otmRandom.nextFloat() * 0.4f)
ply.deltaMovement = Vector(0.0, 0.0, 0.0)
ply.resetFallDistance()

View File

@ -44,6 +44,7 @@ import ru.dbotthepony.mc.otm.core.math.getSphericalBlockPositions
import ru.dbotthepony.mc.otm.core.math.times
import ru.dbotthepony.mc.otm.core.nbt.map
import ru.dbotthepony.mc.otm.core.nbt.set
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.isClient
import ru.dbotthepony.mc.otm.matter.MatterManager
import ru.dbotthepony.mc.otm.registry.MDamageTypes
@ -270,7 +271,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mattery
}
// шанс 1% что черная дыра потеряет 0.1 MtU каждую секунду * силу гравитации дыры ^ -1
if (level.random.nextDouble() < 0.01 * 0.05 * (1 / gravitationStrength)) {
if (level.otmRandom.nextDouble() < 0.01 * 0.05 * (1 / gravitationStrength)) {
this.mass += HAWKING_MASS_LOSE_STEP
}

View File

@ -34,6 +34,7 @@ import ru.dbotthepony.mc.otm.core.math.times
import ru.dbotthepony.mc.otm.core.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.core.multiblock.MultiblockStatus
import ru.dbotthepony.mc.otm.core.multiblock.shapedMultiblock
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.util.InvalidableLazy
import ru.dbotthepony.mc.otm.menu.tech.BlackHoleGeneratorMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
@ -85,8 +86,8 @@ class BlackHoleGeneratorBlockEntity(blockPos: BlockPos, blockState: BlockState)
multiblock?.blockEntities(MatterHatchBlockEntity.INPUT_TAG)?.iterator()?.map { it.matter }?.toList() ?: listOf()
}
val energy = CombinedProfiledEnergyStorage(FlowDirection.NONE, energyTarget::value, { level?.random })
val matter = CombinedProfiledMatterStorage(FlowDirection.NONE, matterTarget::value, { level?.random })
val energy = CombinedProfiledEnergyStorage(FlowDirection.NONE, energyTarget::value, { level?.otmRandom })
val matter = CombinedProfiledMatterStorage(FlowDirection.NONE, matterTarget::value, { level?.otmRandom })
enum class Mode(val label: Component, val tooltip: Component) {
TARGET_MASS(TranslatableComponent("otm.gui.black_hole_generator.sustain.mode"), TranslatableComponent("otm.gui.black_hole_generator.sustain.desc")),

View File

@ -13,6 +13,7 @@ import ru.dbotthepony.mc.otm.core.collect.map
import ru.dbotthepony.mc.otm.core.collect.reduce
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.math.RelativeSide
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.shuffle
import ru.dbotthepony.mc.otm.graph.GraphNodeList
import ru.dbotthepony.mc.otm.onceServer
@ -614,7 +615,7 @@ class EnergyCableGraph : GraphNodeList<EnergyCableBlockEntity.Node, EnergyCableG
}
fun receiveEnergy(howMuch: Decimal, simulate: Boolean, fromNode: EnergyCableBlockEntity.Node, fromSide: RelativeSide): Decimal {
livelyNodesList.shuffle(fromNode.blockEntity.level!!.random)
livelyNodesList.shuffle(fromNode.blockEntity.level!!.otmRandom)
val itr = livelyNodesList.iterator()
var received = Decimal.ZERO

View File

@ -37,6 +37,7 @@ import ru.dbotthepony.mc.otm.container.slotted.SlottedContainer
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.core.nbt.map
import ru.dbotthepony.mc.otm.core.nbt.set
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.menu.decorative.CargoCrateMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
@ -79,7 +80,7 @@ class CargoCrateBlockEntity(
if (interactingPlayers++ == 0 && level != null && !isRemoved && level.getBlockState(blockPos).block is CargoCrateBlock) {
level.setBlock(blockPos, blockState.setValue(CargoCrateBlock.IS_OPEN, true), Block.UPDATE_CLIENTS)
level.playSound(null, blockPos, MSoundEvents.CARGO_CRATE_OPEN, SoundSource.BLOCKS, 1f, 0.8f + level.random.nextFloat() * 0.2f)
level.playSound(null, blockPos, MSoundEvents.CARGO_CRATE_OPEN, SoundSource.BLOCKS, 1f, 0.8f + level.otmRandom.nextFloat() * 0.2f)
level.gameEvent(GameEvent.CONTAINER_OPEN, blockPos, GameEvent.Context.of(blockState))
}
}

View File

@ -24,6 +24,7 @@ import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.container.HandlerFilter
import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.data.codec.DecimalCodec
import ru.dbotthepony.mc.otm.data.codec.minRange
import ru.dbotthepony.mc.otm.graph.matter.SimpleMatterNode
@ -125,7 +126,7 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState)
return JobContainer.success(
DecomposerJob(
(level?.random?.nextDouble() ?: 1.0) <= 0.2 * upgrades.failureMultiplier,
(level?.otmRandom?.nextDouble() ?: 1.0) <= 0.2 * upgrades.failureMultiplier,
matter.matter,
matter.complexity * MachinesConfig.MATTER_DECOMPOSER.workTimeMultiplier
)

View File

@ -28,6 +28,7 @@ import ru.dbotthepony.mc.otm.container.HandlerFilter
import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.container.UpgradeContainer
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.graph.matter.MatterNode
import ru.dbotthepony.mc.otm.matter.IMatterValue
@ -263,7 +264,7 @@ class MatterReconstructorBlockEntity(blockPos: BlockPos, blockState: BlockState)
return
}
if (failureChance * upgrades.failureMultiplier <= 0.0 || level!!.random.nextDouble() >= failureChance * upgrades.failureMultiplier)
if (failureChance * upgrades.failureMultiplier <= 0.0 || level!!.otmRandom.nextDouble() >= failureChance * upgrades.failureMultiplier)
repairProgress += progressPerTick
energy.extractEnergy(energyConsumption * (progressPerTick / thisProgressPerTick), false)

View File

@ -24,6 +24,7 @@ import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.container.HandlerFilter
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.graph.matter.MatterGraph
import ru.dbotthepony.mc.otm.item.matter.MatterDustItem
import ru.dbotthepony.mc.otm.menu.matter.MatterRecyclerMenu
@ -116,7 +117,7 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState)
stack.shrink(1)
container.setChanged(0)
val actualMatter = dustMatter.matter * (0.4 + level!!.random.nextDouble() * 0.6)
val actualMatter = dustMatter.matter * (0.4 + level!!.otmRandom.nextDouble() * 0.6)
return JobContainer.success(
RecyclerJob(

View File

@ -28,6 +28,7 @@ import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.container.HandlerFilter
import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.data.codec.DecimalCodec
import ru.dbotthepony.mc.otm.data.codec.minRange
import ru.dbotthepony.mc.otm.graph.matter.MatterNode
@ -183,7 +184,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
task = allocation.task.id,
matterValue = matter.matter,
pattern = Optional.ofNullable(allocation.pattern),
asDust = (level?.random?.nextDouble() ?: 1.0) * upgrades.failureMultiplier > (allocation.pattern?.researchPercent ?: 2.0),
asDust = (level?.otmRandom?.nextDouble() ?: 1.0) * upgrades.failureMultiplier > (allocation.pattern?.researchPercent ?: 2.0),
ticks = ticks,
))
}

View File

@ -35,6 +35,7 @@ import ru.dbotthepony.mc.otm.container.balance
import ru.dbotthepony.mc.otm.core.collect.filter
import ru.dbotthepony.mc.otm.core.collect.maybe
import ru.dbotthepony.mc.otm.core.immutableList
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.menu.tech.PoweredFurnaceMenu
import ru.dbotthepony.mc.otm.recipe.MatteryCookingRecipe
import ru.dbotthepony.mc.otm.recipe.MicrowaveRecipe
@ -152,7 +153,7 @@ sealed class AbstractPoweredFurnaceBlockEntity<P : AbstractCookingRecipe, S : Ma
recipe.getResultItem(level.registryAccess()).copyWithCount(toProcess),
recipe.workTime * config.workTimeMultiplier,
config.energyConsumption * toProcess,
experience = recipe.experience.sample(level.random) * toProcess))
experience = recipe.experience.sample(level.otmRandom) * toProcess))
}
}

View File

@ -23,6 +23,7 @@ import ru.dbotthepony.mc.otm.container.HandlerFilter
import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.core.immutableList
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.shuffle
import ru.dbotthepony.mc.otm.menu.tech.BatteryBankMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
@ -59,7 +60,7 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte
if (!howMuch.isPositive)
return Decimal.ZERO
containerSlotIndices.shuffle(level!!.random)
containerSlotIndices.shuffle(level!!.otmRandom)
var summ = Decimal.ZERO
var remaining = howMuch

View File

@ -24,6 +24,7 @@ import ru.dbotthepony.mc.otm.core.math.RelativeSide
import ru.dbotthepony.mc.otm.core.multiblock.BlockEntityTag
import ru.dbotthepony.mc.otm.core.multiblock.IMultiblockAccess
import ru.dbotthepony.mc.otm.core.multiblock.IMultiblockListener
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.util.InvalidableLazy
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
@ -42,7 +43,7 @@ class EnergyInterfaceBlockEntity(
multiblocks.keys.iterator().flatMap { it.blockEntities(TARGET).iterator() }.map { it.energyInterfaceTarget }.toList()
}
val energy = CombinedProfiledEnergyStorage(FlowDirection.input(isInput), targets::value, { level?.random })
val energy = CombinedProfiledEnergyStorage(FlowDirection.input(isInput), targets::value, { level?.otmRandom })
override fun onAddedToMultiblock(multiblock: IMultiblockAccess) {
check(!isRemoved) { "Block was removed" }

View File

@ -28,6 +28,7 @@ import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid
import ru.dbotthepony.mc.otm.core.lookupOrThrow
import ru.dbotthepony.mc.otm.core.math.Vector
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.util.countingLazy
import ru.dbotthepony.mc.otm.item.consumables.EssenceCapsuleItem
import ru.dbotthepony.mc.otm.item.EssenceServoItem
@ -172,7 +173,7 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
val diff = dmgPerExp - repairPoints.toFloat()
if (diff > 0f) {
repairPoints += if ((level?.random?.nextFloat() ?: 1f) <= diff) 1 else 0
repairPoints += if ((level?.otmRandom?.nextFloat() ?: 1f) <= diff) 1 else 0
}
experienceStored -= 1
@ -201,7 +202,7 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
level!!.playSound(null, ent.x, ent.y, ent.z,
SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.BLOCKS,
0.1F, 0.5F + level!!.random.nextFloat() * 0.25F
0.1F, 0.5F + level!!.otmRandom.nextFloat() * 0.25F
)
}

View File

@ -21,6 +21,7 @@ import ru.dbotthepony.mc.otm.container.HandlerFilter
import ru.dbotthepony.mc.otm.container.balance
import ru.dbotthepony.mc.otm.core.collect.filter
import ru.dbotthepony.mc.otm.core.collect.maybe
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.menu.tech.PlatePressMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
import ru.dbotthepony.mc.otm.registry.game.MRecipes
@ -89,7 +90,7 @@ class PlatePressBlockEntity(
recipe.getResultItem(level.registryAccess()).copyWithCount(toProcess),
recipe.workTime * MachinesConfig.PLATE_PRESS.workTimeMultiplier,
MachinesConfig.PLATE_PRESS.energyConsumption * toProcess,
experience = recipe.experience.sample(level.random) * toProcess))
experience = recipe.experience.sample(level.otmRandom) * toProcess))
}
override fun tick() {

View File

@ -542,7 +542,7 @@ class MatteryPlayer(val ply: Player) {
override fun onJobTick(status: JobStatus<ItemJob>) {
super.onJobTick(status)
if (isExopackVisible && ply.level().random.nextFloat() <= 0.05f) {
if (isExopackVisible && ply.level().otmRandom.nextFloat() <= 0.05f) {
PacketDistributor.sendToPlayersTrackingEntityAndSelf(ply, ExopackSmokePacket(ply.uuid))
}
}
@ -1405,7 +1405,7 @@ class MatteryPlayer(val ply: Player) {
pos.mul(RenderSystem.getProjectionMatrix())
pos.mul(poseStack.last().pose())
makeSmoke(cam.x + pos.x, cam.y + pos.y, cam.z + pos.z, ply.level().random, ply.level())
makeSmoke(cam.x + pos.x, cam.y + pos.y, cam.z + pos.z, ply.level().otmRandom, ply.level())
}
}

View File

@ -0,0 +1,18 @@
package ru.dbotthepony.mc.otm.client.render.entity
import net.minecraft.client.model.HierarchicalModel
import net.minecraft.client.renderer.entity.EntityRendererProvider
import net.minecraft.client.renderer.entity.MobRenderer
import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.mc.otm.OverdriveThatMatters.loc
import ru.dbotthepony.mc.otm.client.model.entity.LoaderModel
import ru.dbotthepony.mc.otm.entity.Loader
class LoaderRenderer(context: EntityRendererProvider.Context)
: MobRenderer<Loader, HierarchicalModel<Loader>>(context, LoaderModel.getModel(), 0.8f) {
override fun getTextureLocation(entity: Loader): ResourceLocation = TEXTURE_LOCATION
companion object {
private val TEXTURE_LOCATION = loc("textures/entity/loader.png")
}
}

View File

@ -104,7 +104,7 @@ class PainterScreen(menu: PainterMenu, inventory: Inventory, title: Component) :
it.dock = Dock.FILL
it.dockResize = DockResizeMode.NONE
it.slotBackgroundEmpty =
ItemStackIcon(ItemStack(BuiltInRegistries.ITEM.getOrCreateTag(Tags.Items.DYES).getRandomElement(menu.player.level().random).map { it.value() }.orElse(Items.AIR)), 16f, 16f)
ItemStackIcon(ItemStack(BuiltInRegistries.ITEM.getOrCreateTag(Tags.Items.DYES).getRandomElement(menu.random).map { it.value() }.orElse(Items.AIR)), 16f, 16f)
.fixed()
.composeBefore(FlatRectangleIcon(16f, 16f, RGBAColor.rgb(0x8b8b8b).copy(alpha = 0.6f)))
.fixed()

View File

@ -0,0 +1,16 @@
package ru.dbotthepony.mc.otm.core
import net.minecraft.util.RandomSource
import net.minecraft.world.level.Level
interface IMatteryLevel {
/**
* OTM provided [RandomSource], which has better statistical parameters
*
* Original Minecraft use LCG, which may show bad behavior when repeatedly sampled *a lot*,
* which is what [Level]'s random is used for. OTM provided PRNG should behave better in this scenario.
*/
val otmRandom: RandomSource
}
val Level.otmRandom: RandomSource get() = (this as IMatteryLevel).otmRandom

View File

@ -0,0 +1,115 @@
package ru.dbotthepony.mc.otm.core.util
import net.minecraft.util.Mth
import net.minecraft.util.RandomSource
import net.minecraft.world.level.levelgen.MarsagliaPolarGaussian
import net.minecraft.world.level.levelgen.PositionalRandomFactory
import java.lang.StringBuilder
import java.util.random.RandomGenerator
class CMWCRandom(seed: Long = System.nanoTime(), private val stateSize: Int = CMWC_DEFAULT_STATE_SIZE) : RandomGenerator, RandomSource {
private val state = IntArray(stateSize)
private var carry = 0
private var stateIndex = 0
private val gaussian = MarsagliaPolarGaussian(this)
var seed: Long = seed
private set
init {
setSeed(seed)
}
override fun setSeed(seed: Long) {
this.seed = seed
carry = Integer.remainderUnsigned(seed.toInt(), CMWC_CARRY_MAX)
// init state with regular LCG produced values
state[0] = seed.toInt()
state[1] = seed.shr(32).toInt()
for (i in 2 until state.size) {
state[i] = 69069 * state[i - 2] + 362437
}
stateIndex = state.size - 1
gaussian.reset()
}
override fun nextInt(): Int {
stateIndex = (stateIndex + 1) % state.size
val t = 18782L * state[stateIndex] + carry
carry = t.ushr(32).toInt()
var x = t.toInt() + carry
if (x < carry) {
x++
carry++
}
state[stateIndex] = 0xfffffffe.toInt() - x
return state[stateIndex]
}
override fun nextLong(): Long {
val a = nextInt().toLong() and 0xFFFFFFFFL
val b = nextInt().toLong() and 0xFFFFFFFFL
return a.shl(32) or b
}
override fun nextInt(bound: Int): Int {
return super<RandomGenerator>.nextInt(bound)
}
override fun nextInt(origin: Int, bound: Int): Int {
return super<RandomGenerator>.nextInt(origin, bound)
}
override fun nextBoolean(): Boolean {
return super.nextBoolean()
}
override fun nextFloat(): Float {
return super.nextFloat()
}
override fun nextDouble(): Double {
return super.nextDouble()
}
override fun nextGaussian(): Double {
return gaussian.nextGaussian()
}
override fun fork(): RandomSource {
return CMWCRandom(nextLong(), stateSize)
}
override fun forkPositional(): PositionalRandomFactory {
return Positional(nextLong(), stateSize)
}
class Positional(val seed: Long, val stateSize: Int = CMWC_DEFAULT_STATE_SIZE) : PositionalRandomFactory {
override fun at(x: Int, y: Int, z: Int): RandomSource {
return CMWCRandom(Mth.getSeed(x, y, z).xor(seed), stateSize)
}
override fun fromHashOf(name: String): RandomSource {
return CMWCRandom(name.hashCode().toLong().xor(seed), stateSize)
}
override fun fromSeed(seed: Long): RandomSource {
return CMWCRandom(seed, stateSize)
}
override fun parityConfigString(builder: StringBuilder) {
throw UnsupportedOperationException()
}
}
companion object {
const val CMWC_DEFAULT_STATE_SIZE = 256 // 4096
const val CMWC_CARRY_MAX = 809430660
}
}

View File

@ -0,0 +1,130 @@
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.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents
import net.minecraft.world.entity.AnimationState
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.EntityType
import net.minecraft.world.entity.ai.attributes.AttributeSupplier
import net.minecraft.world.entity.ai.attributes.Attributes
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation
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.registry.game.MSoundEvents
class Loader(type: EntityType<Loader>, level: Level) : Monster(type, level) {
val idleState = AnimationState()
var attackAnimationState = AnimationState()
var attackAnimationTick = 0
companion object {
fun createAttributes() : AttributeSupplier.Builder {
return createMonsterAttributes()
.add(Attributes.MAX_HEALTH, 60.0)
.add(Attributes.MOVEMENT_SPEED, 0.3)
.add(Attributes.ATTACK_DAMAGE, 5.0)
.add(Attributes.KNOCKBACK_RESISTANCE, 0.7)
}
private val DATA_ATTACKING: EntityDataAccessor<Boolean> =
SynchedEntityData.defineId(Loader::class.java, EntityDataSerializers.BOOLEAN)
}
override fun defineSynchedData(builder: SynchedEntityData.Builder) {
super.defineSynchedData(builder)
builder.define(DATA_ATTACKING, false)
}
var isAttacking: Boolean
get() = this.entityData.get(DATA_ATTACKING)
set(value) {
this.entityData.set(DATA_ATTACKING, value)
}
//https://nc.dbotthepony.ru/s/qqKdbQEYy74KyGM
init {
idleState.start(tickCount)
}
override fun registerGoals() {
goalSelector.addGoal(8, RandomLookAroundGoal(this))
goalSelector.addGoal(7, WaterAvoidingRandomStrollGoal(this, 0.8))
goalSelector.addGoal(8, LookAtPlayerGoal(this, Player::class.java, 8f))
goalSelector.addGoal(3, NearestAttackableTargetGoal(this, Player::class.java , true, true))
goalSelector.addGoal(2, MeleeAttackGoal(this, 1.0, true))
targetSelector.addGoal(1, HurtByTargetGoal(this))
}
override fun handleEntityEvent(id: Byte) {
if (id.toInt() == 4) {
this.attackAnimationTick = 7 // Attack animation lasts 10 ticks
} else {
super.handleEntityEvent(id)
}
}
override fun doHurtTarget(target: Entity): Boolean {
level().broadcastEntityEvent(this, 4.toByte())
val success = super.doHurtTarget(target)
if (success) {
this.playSound(SoundEvents.IRON_GOLEM_ATTACK, 1.0f, 1.0f)
//THIS IS FUCKING RETARDED
//fuck everything
level().broadcastEntityEvent(this, 4.toByte())
idleState.stop()
idleState.start(tickCount)
val dirx = target.x - this.x
val dirz = target.z - this.z
val dist = Math.sqrt(dirx * dirx + dirx * dirz)
target.push(dirx / dist * 0.6, 0.3, dirz / dist * 0.6)
}
return success
}
override fun aiStep() {
super.aiStep()
if (attackAnimationTick > 0) {
attackAnimationTick--
if (attackAnimationTick == 0) {
isAttacking = false
}
}
}
override fun getAmbientSound(): SoundEvent {
return MSoundEvents.LOADER_AMBIENT
}
override fun getHurtSound(damageSource: net.minecraft.world.damagesource.DamageSource): SoundEvent {
return SoundEvents.IRON_GOLEM_HURT
}
override fun getDeathSound(): SoundEvent {
return SoundEvents.IRON_GOLEM_DEATH
}
override fun playStepSound(pos: net.minecraft.core.BlockPos, blockState: net.minecraft.world.level.block.state.BlockState) {
this.playSound(SoundEvents.IRON_GOLEM_STEP, 1.0f, 1.0f)
}
override fun createNavigation(level: Level): PathNavigation = GroundPathNavigation(this, level)
}

View File

@ -19,6 +19,7 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.gameevent.GameEvent
import ru.dbotthepony.mc.otm.block.decorative.CargoCrateBlock
import ru.dbotthepony.mc.otm.block.entity.decorative.CargoCrateBlockEntity
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.position
import ru.dbotthepony.mc.otm.menu.decorative.MinecartCargoCrateMenu
import ru.dbotthepony.mc.otm.registry.game.MItems
@ -89,7 +90,7 @@ class MinecartCargoCrate(
if (interactingPlayers++ == 0) {
if (!isRemoved) {
level().playSound(null, this, MSoundEvents.CARGO_CRATE_OPEN, SoundSource.BLOCKS, 1f, 0.8f + level().random.nextFloat() * 0.2f)
level().playSound(null, this, MSoundEvents.CARGO_CRATE_OPEN, SoundSource.BLOCKS, 1f, 0.8f + level().otmRandom.nextFloat() * 0.2f)
this.gameEvent(GameEvent.CONTAINER_OPEN, player)
PiglinAi.angerNearbyPiglins(player, true)
}

View File

@ -184,7 +184,7 @@ class CrudeBatteryItem : BatteryItem(ItemsConfig.Batteries.CRUDE) {
if (player is ServerPlayer) {
if (!mattery.androidEnergy.item.isEmpty) {
mattery.androidEnergy.item.getCapability(Capabilities.EnergyStorage.ITEM)?.let {
it.extractEnergy((it.maxEnergyStored * level.random.nextFloat() * .2f).roundToInt(), false)
it.extractEnergy((it.maxEnergyStored * level.otmRandom.nextFloat() * .2f).roundToInt(), false)
}
mattery.dropBattery()
@ -194,7 +194,7 @@ class CrudeBatteryItem : BatteryItem(ItemsConfig.Batteries.CRUDE) {
copyStack.count = 1
mattery.androidEnergy.item = copyStack
val extraDamageMult = level.random.nextFloat()
val extraDamageMult = level.otmRandom.nextFloat()
player.hurt(MatteryDamageSource(level.registryAccess().damageType(MDamageTypes.EMP), inflictor = itemStack), 1.5f + extraDamageMult * 3.5f)
val debuffDuration = 100 + (100 * (1f - extraDamageMult)).roundToInt()

View File

@ -17,6 +17,7 @@ import ru.dbotthepony.mc.otm.capability.matteryPlayer
import ru.dbotthepony.mc.otm.client.isShiftDown
import ru.dbotthepony.mc.otm.client.minecraft
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.util.getLevelFromXp
import ru.dbotthepony.mc.otm.item.MatteryItem
import ru.dbotthepony.mc.otm.registry.game.MDataComponentTypes
@ -80,7 +81,7 @@ class EssenceCapsuleItem(private val digital: Boolean) : MatteryItem(Properties(
} else {
if (level is ServerLevel) {
level.levelEvent(2002, player.blockPosition(), PotionContents.getColor(Potions.WATER))
ExperienceOrb.award(level, player.position(), (exp * (.5 + level.random.nextFloat() * .25)).toInt())
ExperienceOrb.award(level, player.position(), (exp * (.5 + level.otmRandom.nextFloat() * .25)).toInt())
}
}

View File

@ -0,0 +1,25 @@
package ru.dbotthepony.mc.otm.item.consumables
import net.minecraft.world.effect.MobEffectInstance
import net.minecraft.world.effect.MobEffects
import net.minecraft.world.level.Level
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import net.minecraft.world.food.FoodProperties
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
class ImperfectBread(properties: Item.Properties) : Item(properties) {
override fun finishUsingItem(stack: ItemStack, level: Level, entity: LivingEntity): ItemStack {
if (entity is Player) {
entity.addEffect(MobEffectInstance(MobEffects.POISON, 80, 0))
}
return super.finishUsingItem(stack, level, entity)
}
}
val IMPERFECT_BREAD_FOOD: FoodProperties = FoodProperties.Builder()
.nutrition(5)
.saturationModifier(0.6f)
.build()

View File

@ -84,7 +84,7 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
itemStack.hurtAndBreak(8, level, player) {}
if (isPrimed(itemStack)) {
itemStack.hurtAndBreak(level.random.nextInt(1, 20), level, player) {}
itemStack.hurtAndBreak(level.otmRandom.nextInt(1, 20), level, player) {}
unprime(itemStack)
val (ex, ey, ez) = Vector.atCenterOf(player.blockPosition())
@ -226,7 +226,7 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
val copy = itemStack.copy()
itemStack.hurtAndBreak(level.random.nextInt(1, 20), attacker, EquipmentSlot.MAINHAND)
itemStack.hurtAndBreak(level.otmRandom.nextInt(1, 20), attacker, EquipmentSlot.MAINHAND)
if (!itemStack.isEmpty && attacker.random.nextDouble() <= ToolsConfig.ExplosiveHammer.FLY_OFF_CHANCE) {
attacker.setItemInHand(hand, ItemStack.EMPTY)

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm.item.weapon
import net.minecraft.core.BlockPos
import net.minecraft.core.component.DataComponents
import net.minecraft.tags.BlockTags
import net.minecraft.world.entity.EquipmentSlotGroup
import net.minecraft.world.entity.LivingEntity
@ -32,6 +33,7 @@ import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.math.DecimalConfigValue
import ru.dbotthepony.mc.otm.core.math.defineDecimal
import ru.dbotthepony.mc.otm.core.math.nextVariance
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.util.WriteOnce
import ru.dbotthepony.mc.otm.item.MatteryItem
import ru.dbotthepony.mc.otm.item.addSimpleDescription
@ -96,10 +98,10 @@ class EnergySwordItem : MatteryItem(Properties().stacksTo(1).rarity(Rarity.RARE)
itemStack.getCapability(MatteryCapability.ITEM_ENERGY)?.let {
if (it.extractEnergyExact(ENERGY_PER_SWING, false)) {
it.extractEnergy(attacker.level().random.nextVariance(ENERGY_PER_SWING_VARIANCE), false)
it.extractEnergy(attacker.level().otmRandom.nextVariance(ENERGY_PER_SWING_VARIANCE), false)
victim.matteryPlayer?.let {
if (it.isAndroid && it.androidEnergy.extractEnergyExact(ENERGY_ZAP, false)) {
it.androidEnergy.extractEnergy(attacker.level().random.nextVariance(ENERGY_ZAP_VARIANCE), false)
it.androidEnergy.extractEnergy(attacker.level().otmRandom.nextVariance(ENERGY_ZAP_VARIANCE), false)
victim.hurt(MatteryDamageSource(attacker.level().registryAccess().damageType(MDamageTypes.EMP), attacker, itemStack), 8f)
}
}
@ -137,23 +139,34 @@ class EnergySwordItem : MatteryItem(Properties().stacksTo(1).rarity(Rarity.RARE)
p_41419_: BlockPos,
user: LivingEntity
): Boolean {
if (blockState.getDestroySpeed(p_41417_, p_41419_) != 0f && (user !is Player || !user.isCreative)) {
if (blockState.getDestroySpeed(p_41417_, p_41419_) > 0f && (user !is Player || !user.isCreative)) {
val energy = itemStack.matteryEnergy
if (blockState.`is`(BlockTags.SWORD_EFFICIENT)) {
if (energy?.extractEnergyExact(PLANT_POWER_COST, false) == true)
energy.extractEnergyExact(user.level().random.nextVariance(PLANT_POWER_COST_VARIANCE), false)
energy.extractEnergyExact(user.level().otmRandom.nextVariance(PLANT_POWER_COST_VARIANCE), false)
}
if (blockState.`is`(Blocks.COBWEB)) {
if (energy?.extractEnergyExact(COBWEB_POWER_COST, false) == true)
energy.extractEnergyExact(user.level().random.nextVariance(COBWEB_POWER_COST_VARIANCE), false)
energy.extractEnergyExact(user.level().otmRandom.nextVariance(COBWEB_POWER_COST_VARIANCE), false)
}
}
return true
}
override fun isCorrectToolForDrops(stack: ItemStack, state: BlockState): Boolean {
val energy = stack.matteryEnergy ?: return super.isCorrectToolForDrops(stack, state)
if (state.`is`(BlockTags.SWORD_EFFICIENT) && energy.batteryLevel >= PLANT_POWER_COST)
return true
else if (state.`is`(Blocks.COBWEB) && energy.batteryLevel >= COBWEB_POWER_COST)
return true
return super.isCorrectToolForDrops(stack, state)
}
private fun cap(stack: ItemStack) = EnergyConsumerItem(stack, MAX_ENERGY)
override fun registerCapabilities(event: RegisterCapabilitiesEvent) {

View File

@ -24,6 +24,7 @@ import ru.dbotthepony.mc.otm.core.math.component1
import ru.dbotthepony.mc.otm.core.math.component2
import ru.dbotthepony.mc.otm.core.math.component3
import ru.dbotthepony.mc.otm.core.math.toRadians
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.position
import ru.dbotthepony.mc.otm.core.readItem
import ru.dbotthepony.mc.otm.core.writeItem
@ -445,7 +446,7 @@ class ExopackSmokePacket(val player: UUID) : CustomPacketPayload {
z += kotlin.math.sin(deg) * -0.4
val level = ply.level()
val random = level.random
val random = level.otmRandom
for (i in 0 .. random.nextInt(2, 4))
level.addParticle(

View File

@ -13,6 +13,7 @@ import net.neoforged.neoforge.network.handling.IPayloadContext
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.client.minecraft
import ru.dbotthepony.mc.otm.core.ResourceLocation
import ru.dbotthepony.mc.otm.core.otmRandom
class SmokeParticlesPacket(val x: Double, val y: Double, val z: Double) : CustomPacketPayload {
fun write(buff: FriendlyByteBuf) {
@ -23,7 +24,7 @@ class SmokeParticlesPacket(val x: Double, val y: Double, val z: Double) : Custom
fun play(context: IPayloadContext) {
minecraft.player?.level()?.let {
makeSmoke(x, y, z, it.random, it)
makeSmoke(x, y, z, it.otmRandom, it)
}
}

View File

@ -12,6 +12,7 @@ object MNames {
const val LABORATORY_LAMP_LIGHT = "laboratory_lamp_light"
const val DANGER_STRIPE_BLOCK = "danger_stripe_block"
const val METAL_BEAM = "metal_beam"
const val METAL_BEAM_CENTER = "metal_beam_center"
const val ENGINE = "engine"
const val HOLO_SIGN = "holo_sign"
const val FLUID_TANK = "fluid_tank"
@ -93,10 +94,12 @@ object MNames {
// building blocks
const val TRITANIUM_BLOCK = "tritanium_block"
const val TRITANIUM_BLOCK_YELLOW_CLASSIC = "tritanium_block_yellow_classic"
const val TRITANIUM_STAIRS = "tritanium_stairs"
const val TRITANIUM_SLAB = "tritanium_slab"
const val TRITANIUM_WALL = "tritanium_wall"
const val TRITANIUM_STRIPED_BLOCK = "tritanium_striped_block"
const val TRITANIUM_CLASSIC_STRIPED_BLOCK = "tritanium_classic_striped_block"
const val TRITANIUM_STRIPED_STAIRS = "tritanium_striped_stairs"
const val TRITANIUM_STRIPED_SLAB = "tritanium_striped_slab"
const val TRITANIUM_STRIPED_WALL = "tritanium_striped_wall"
@ -128,6 +131,8 @@ object MNames {
const val PILL_HEAL = "pill_heal"
const val PILL_NOT_NORMAL = "pill_not_normal"
const val IMPERFECT_BREAD = "imperfect_bread"
const val BATTERY_CRUDE = "battery_crude"
const val BATTERY_BASIC = "battery_basic"
const val BATTERY_NORMAL = "battery_normal"
@ -198,6 +203,7 @@ object MNames {
// eg
const val BREAD_MONSTER_SPAWN_EGG = "bead_monster_spawn_egg"
const val LOADER_SPAWN_EGG = "loader_spawn_egg"
// items: crafting components
const val TRITANIUM_DUST = "tritanium_dust"
@ -205,8 +211,12 @@ object MNames {
const val TRITANIUM_INGOT = "tritanium_ingot"
const val TRITANIUM_INGOT_BLOCK = "tritanium_ingot_block"
const val WITHERED_STEEL_BLOCK = "withered_steel_block"
const val WITHERED_STEEL = "withered_steel"
const val ROFLITE_ALLOY_INGOT = "roflite_alloy_ingot"
const val ROFLITE_ALLOY_BLOCK = "roflite_alloy_block"
const val MATTER_IO_PORT = "matter_io_port"
const val CARBON_MESH = "carbon_mesh"
@ -315,6 +325,7 @@ object MNames {
const val PLASMA = "plasma_projectile"
const val RIDEABLE_DUMMY = "rideable_dummy"
const val BREAD_MONSTER = "bread_monster"
const val LOADER = "loader"
const val PHANTOM_ATTRACTOR = "phantom_attractor"
const val JUMP_BOOST = "jump_boost"

View File

@ -252,6 +252,14 @@ object MBlocks {
Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).explosionResistance(400f).destroyTime(3f).requiresCorrectToolForDrops())
}
val WITHERED_STEEL_BLOCK: Block by registry.register(MNames.WITHERED_STEEL_BLOCK) {
Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).sound(SoundType.NETHERITE_BLOCK).explosionResistance(400f).destroyTime(3f).requiresCorrectToolForDrops())
}
val ROFLITE_ALLOY_BLOCK: Block by registry.register(MNames.ROFLITE_ALLOY_BLOCK) {
Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).sound(SoundType.NETHERITE_BLOCK).explosionResistance(400f).destroyTime(3f).requiresCorrectToolForDrops())
}
val METAL_JUNK: MatteryBlock by registry.register(MNames.METAL_JUNK) {
MatteryBlock(BlockBehaviour.Properties.of().sound(SoundType.NETHERITE_BLOCK).mapColor(MapColor.COLOR_GRAY).explosionResistance(45f).destroyTime(3f).requiresCorrectToolForDrops())
.addSimpleDescription()
@ -351,6 +359,7 @@ object MBlocks {
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().mapColor(MapColor.COLOR_GRAY).explosionResistance(6f).destroyTime(1.5f).requiresCorrectToolForDrops()) }
val METAL_BEAM: Block by registry.register(MNames.METAL_BEAM) { RotatedPillarBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) }
val METAL_BEAM_CENTER: Block by registry.register(MNames.METAL_BEAM_CENTER) { RotatedPillarBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) }
val ENGINE: Block by registry.register(MNames.ENGINE) { EngineBlock() }
val HOLO_SIGN: Block by registry.register(MNames.HOLO_SIGN) { HoloSignBlock() }

View File

@ -237,6 +237,10 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
accept(MItems.DILITHIUM_CRYSTAL_BLOCK)
accept(MItems.WITHERED_STEEL)
accept(MItems.WITHERED_STEEL_BLOCK)
accept(MItems.ROFLITE_ALLOY_INGOT)
accept(MItems.ROFLITE_ALLOY_BLOCK)
accept(MItems.TRITANIUM_TOOLS)
accept(MItems.TRITANIUM_SHIELD)
@ -281,6 +285,7 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
base(MItems.CARGO_CRATE_MINECARTS)
accept(MItems.NUTRIENT_PASTE)
accept(MItems.IMPERFECT_BREAD)
// exo
accept(MItems.EXOPACK_PROBE)
@ -313,6 +318,7 @@ private fun addDecorativeTabItems(consumer: CreativeModeTab.Output) {
accept(MItems.DANGER_STRIPE_BLOCK)
accept(MItems.METAL_BEAM)
accept(MItems.METAL_BEAM_CENTER)
accept(MItems.ENGINE)
accept(MItems.TRITANIUM_STRIPED_BLOCK.values)

View File

@ -14,11 +14,9 @@ import net.neoforged.bus.api.IEventBus
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent
import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent
import ru.dbotthepony.mc.otm.client.render.entity.BreadMonsterRenderer
import ru.dbotthepony.mc.otm.client.render.entity.LoaderRenderer
import ru.dbotthepony.mc.otm.client.render.entity.PlasmaProjectileRenderer
import ru.dbotthepony.mc.otm.entity.BreadMonster
import ru.dbotthepony.mc.otm.entity.MinecartCargoCrate
import ru.dbotthepony.mc.otm.entity.PlasmaProjectile
import ru.dbotthepony.mc.otm.entity.RideableDummy
import ru.dbotthepony.mc.otm.entity.*
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
import ru.dbotthepony.mc.otm.registry.MNames
@ -50,6 +48,15 @@ object MEntityTypes {
.build(MNames.BREAD_MONSTER)
}
val LOADER: EntityType<Loader> by registry.register(MNames.LOADER) {
EntityType.Builder.of(::Loader, MobCategory.MONSTER)
.sized(1.2f, 2.5f)
.eyeHeight(2.0f)
.passengerAttachments(2.5f)
.clientTrackingRange(12)
.build(MNames.LOADER)
}
fun register(bus: IEventBus) {
registry.register(bus)
bus.addListener(this::registerAttributes)
@ -58,6 +65,7 @@ object MEntityTypes {
private fun registerAttributes(event: EntityAttributeCreationEvent) {
event.put(BREAD_MONSTER, BreadMonster.createAttributes().build())
event.put(LOADER, Loader.createAttributes().build())
}
@Suppress("unchecked_cast")
@ -71,6 +79,7 @@ object MEntityTypes {
EntityRenderers.register(RIDEABLE_DUMMY, ::NoopRenderer)
EntityRenderers.register(BREAD_MONSTER, ::BreadMonsterRenderer)
EntityRenderers.register(LOADER, ::LoaderRenderer)
}
}
}

View File

@ -26,6 +26,7 @@ import net.minecraft.world.item.Tiers
import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.block.Block
import net.neoforged.bus.api.IEventBus
import net.neoforged.neoforge.common.DeferredSpawnEggItem
import net.neoforged.neoforge.common.SimpleTier
import ru.dbotthepony.mc.otm.block.MatteryBlock
import ru.dbotthepony.mc.otm.block.addSimpleDescription
@ -43,16 +44,12 @@ import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.item.BatteryItem
import ru.dbotthepony.mc.otm.item.ChestUpgraderItem
import ru.dbotthepony.mc.otm.item.CrudeBatteryItem
import ru.dbotthepony.mc.otm.item.consumables.EssenceCapsuleItem
import ru.dbotthepony.mc.otm.item.EssenceServoItem
import ru.dbotthepony.mc.otm.item.FluidCapsuleItem
import ru.dbotthepony.mc.otm.item.block.FluidTankItem
import ru.dbotthepony.mc.otm.item.GravitationalDisruptorItem
import ru.dbotthepony.mc.otm.item.consumables.HealPillItem
import ru.dbotthepony.mc.otm.item.MatteryItem
import ru.dbotthepony.mc.otm.item.MinecartCargoCrateItem
import ru.dbotthepony.mc.otm.item.consumables.PillItem
import ru.dbotthepony.mc.otm.item.consumables.PillType
import ru.dbotthepony.mc.otm.item.PortableCondensationDriveItem
import ru.dbotthepony.mc.otm.item.ProceduralBatteryItem
import ru.dbotthepony.mc.otm.item.QuantumBatteryItem
@ -62,7 +59,7 @@ import ru.dbotthepony.mc.otm.item.addSimpleDescription
import ru.dbotthepony.mc.otm.item.armor.PortableGravitationStabilizerItem
import ru.dbotthepony.mc.otm.item.armor.TritaniumArmorItem
import ru.dbotthepony.mc.otm.item.block.EnergyCableItem
import ru.dbotthepony.mc.otm.item.consumables.NotNormalPill
import ru.dbotthepony.mc.otm.item.consumables.*
import ru.dbotthepony.mc.otm.item.exopack.ExopackProbeItem
import ru.dbotthepony.mc.otm.item.exopack.ExopackSlotUpgradeItem
import ru.dbotthepony.mc.otm.item.exopack.ExopackUpgradeItem
@ -301,6 +298,9 @@ object MItems {
val TRITANIUM_NUGGET: Item by registry.register(MNames.TRITANIUM_NUGGET) { Item(DEFAULT_PROPERTIES) }
val TRITANIUM_INGOT: Item by registry.register(MNames.TRITANIUM_INGOT) { Item(DEFAULT_PROPERTIES) }
val TRITANIUM_INGOT_BLOCK: BlockItem by registry.register(MNames.TRITANIUM_INGOT_BLOCK) { BlockItem(MBlocks.TRITANIUM_INGOT_BLOCK, DEFAULT_PROPERTIES) }
val WITHERED_STEEL_BLOCK: BlockItem by registry.register(MNames.WITHERED_STEEL_BLOCK) { BlockItem(MBlocks.WITHERED_STEEL_BLOCK, DEFAULT_PROPERTIES) }
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) }
@ -426,6 +426,8 @@ object MItems {
val PILL_HEAL: Item by registry.register(MNames.PILL_HEAL) { HealPillItem() }
val PILL_NOT_NORMAL: Item by registry.register(MNames.PILL_NOT_NORMAL) { NotNormalPill() }
val IMPERFECT_BREAD: Item by registry.register(MNames.IMPERFECT_BREAD) { ImperfectBread(Item.Properties().food(IMPERFECT_BREAD_FOOD)) }
val PILLS = SupplierList(
MItems::PILL_ANDROID,
MItems::PILL_HUMANE,
@ -511,6 +513,7 @@ object MItems {
val LABORATORY_LAMP_INVERTED: Item by registry.register(MNames.LABORATORY_LAMP_INVERTED) { BlockItem(MBlocks.LABORATORY_LAMP_INVERTED, DEFAULT_PROPERTIES) }
val DANGER_STRIPE_BLOCK: Item by registry.register(MNames.DANGER_STRIPE_BLOCK) { BlockItem(MBlocks.DANGER_STRIPE_BLOCK, DEFAULT_PROPERTIES) }
val METAL_BEAM: Item by registry.register(MNames.METAL_BEAM) { BlockItem(MBlocks.METAL_BEAM, DEFAULT_PROPERTIES) }
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) }
@ -664,6 +667,10 @@ object MItems {
val CHEST_UPGRADER: Item by registry.register(MNames.CHEST_UPGRADER) { ChestUpgraderItem() }
val BREAD_MONSTER_SPAWN_EGG: Item by registry.register(MNames.BREAD_MONSTER_SPAWN_EGG){ SpawnEggItem(MEntityTypes.BREAD_MONSTER, 0xFFFFFF, 0xFFFFFF, Item.Properties())}
val LOADER_SPAWN_EGG: Item by registry.register(MNames.LOADER_SPAWN_EGG){ SpawnEggItem(MEntityTypes.LOADER, 0xFFFFFF, 0xFFFFFF, Item.Properties())}
val ROFLITE_ALLOY_INGOT: Item by registry.register(MNames.ROFLITE_ALLOY_INGOT) { Item(DEFAULT_PROPERTIES) }
val ROFLITE_ALLOY_BLOCK: BlockItem by registry.register(MNames.ROFLITE_ALLOY_BLOCK) { BlockItem(MBlocks.ROFLITE_ALLOY_BLOCK, DEFAULT_PROPERTIES) }
init {
MRegistry.registerItems(registry)

View File

@ -25,6 +25,8 @@ object MSoundEvents {
val BLACK_HOLE by make("black_hole", 32F)
val LOADER_AMBIENT by make("loader_ambient")
fun register(bus: IEventBus) {
registry.register(bus)
}

View File

@ -0,0 +1,75 @@
// Made with Blockbench 4.12.3
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports
public class loader<T extends Entity> extends EntityModel<T> {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("modid", "loader"), "main");
private final ModelPart root;
private final ModelPart Head;
private final ModelPart Body;
private final ModelPart LeftLeg;
private final ModelPart RightLeg;
private final ModelPart LeftArm;
private final ModelPart ElbowL;
private final ModelPart RightArm;
private final ModelPart ElbowR;
public loader(ModelPart root) {
this.root = root.getChild("root");
this.Head = this.root.getChild("Head");
this.Body = this.root.getChild("Body");
this.LeftLeg = this.root.getChild("LeftLeg");
this.RightLeg = this.root.getChild("RightLeg");
this.LeftArm = this.root.getChild("LeftArm");
this.ElbowL = this.LeftArm.getChild("ElbowL");
this.RightArm = this.root.getChild("RightArm");
this.ElbowR = this.RightArm.getChild("ElbowR");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F));
PartDefinition Head = root.addOrReplaceChild("Head", CubeListBuilder.create().texOffs(48, 23).addBox(-3.0F, -1.0F, -2.0F, 6.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-4.0F, -32.0F, -5.0F));
PartDefinition Body = root.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(0, 0).addBox(-10.0F, -16.0F, -5.0F, 20.0F, 10.0F, 13.0F, new CubeDeformation(0.0F))
.texOffs(0, 50).addBox(-3.0F, -3.0F, -4.0F, 6.0F, 5.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(112, 52).addBox(10.0F, -13.0F, 0.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(96, 52).addBox(-12.0F, -13.0F, -1.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(53, 0).addBox(-5.0F, -1.0F, 4.0F, 10.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -26.0F, -1.0F));
PartDefinition antenna_r1 = Body.addOrReplaceChild("antenna_r1", CubeListBuilder.create().texOffs(76, 6).addBox(0.0F, -7.0F, -1.0F, 0.0F, 14.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(8.0F, -22.0F, 8.0F, -0.2618F, 0.0F, 0.0F));
PartDefinition waist_r1 = Body.addOrReplaceChild("waist_r1", CubeListBuilder.create().texOffs(28, 50).addBox(-2.0F, -5.0F, -4.0F, 4.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, 2.0F, -0.2618F, 0.0F, 0.0F));
PartDefinition LeftLeg = root.addOrReplaceChild("LeftLeg", CubeListBuilder.create().texOffs(106, 24).addBox(0.0F, 10.0F, -2.0F, 4.0F, 16.0F, 7.0F, new CubeDeformation(0.0F))
.texOffs(66, 46).addBox(-1.0F, -2.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(4.0F, -26.0F, -1.0F));
PartDefinition RightLeg = root.addOrReplaceChild("RightLeg", CubeListBuilder.create().texOffs(84, 24).addBox(-4.0F, 10.0F, -2.0F, 4.0F, 16.0F, 7.0F, new CubeDeformation(0.0F))
.texOffs(48, 34).addBox(-5.0F, -2.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(-4.0F, -26.0F, -1.0F));
PartDefinition LeftArm = root.addOrReplaceChild("LeftArm", CubeListBuilder.create().texOffs(104, 0).addBox(-1.0F, -7.0F, -4.0F, 4.0F, 16.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(13.0F, -36.0F, 2.0F));
PartDefinition ElbowL = LeftArm.addOrReplaceChild("ElbowL", CubeListBuilder.create().texOffs(24, 23).addBox(-2.0F, -0.2F, -2.0F, 4.0F, 19.0F, 8.0F, new CubeDeformation(-0.1F)), PartPose.offset(1.0F, 9.0F, -1.0F));
PartDefinition RightArm = root.addOrReplaceChild("RightArm", CubeListBuilder.create().texOffs(80, 0).addBox(-3.0F, -7.0F, -4.0F, 4.0F, 16.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(-13.0F, -36.0F, 1.0F));
PartDefinition ElbowR = RightArm.addOrReplaceChild("ElbowR", CubeListBuilder.create().texOffs(0, 23).addBox(-2.0F, -0.2F, -2.0F, 4.0F, 19.0F, 8.0F, new CubeDeformation(-0.1F)), PartPose.offset(-1.0F, 9.0F, -1.0F));
return LayerDefinition.create(meshdefinition, 128, 64);
}
@Override
public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
root.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}
}

View File

@ -0,0 +1,166 @@
{
"format_version": "1.8.0",
"animations": {
"Idle": {
"loop": true,
"animation_length": 0.16,
"bones": {
"Body": {
"position": {
"0.0": [0, 0, 0],
"0.08": [0, -0.1, 0],
"0.16": [0, 0, 0]
}
},
"Head": {
"position": {
"0.0": [0, 0, 0],
"0.08": [0, -0.1, 0],
"0.16": [0, 0, 0]
}
},
"LeftArm": {
"position": {
"0.0": [0, 0.1, 0],
"0.12": [0, -0.2, 0],
"0.16": [0, 0, 0]
}
},
"RightArm": {
"position": {
"0.0": [0, 0.1, 0],
"0.12": [0, -0.2, 0],
"0.16": [0, 0, 0]
}
}
}
},
"Move": {
"loop": true,
"animation_length": 0.48,
"bones": {
"Body": {
"position": {
"0.0": [0, 0, 0],
"0.12": [0, 0.3, 0],
"0.24": [0, 0, 0],
"0.36": [0, 0.3, 0],
"0.48": [0, 0, 0]
}
},
"Head": {
"position": {
"0.0": [0, 0, 0],
"0.12": [0, 0.3, 0],
"0.24": [0, 0, 0],
"0.36": [0, 0.3, 0],
"0.48": [0, 0, 0]
}
},
"LeftLeg": {
"rotation": {
"0.0": [-22.5, 0, 0],
"0.24": [22.5, 0, 0],
"0.48": [-22.5, 0, 0]
},
"position": {
"0.0": [0, 0, -2],
"0.12": [0, 0, 0],
"0.24": [0, 1, 1],
"0.36": [0, 2, -2],
"0.48": [0, 0, -2]
}
},
"RightLeg": {
"rotation": {
"0.0": [22.5, 0, 0],
"0.24": [-22.5, 0, 0],
"0.48": [22.5, 0, 0]
},
"position": {
"0.0": [0, 0, 2],
"0.12": [0, 2, -2],
"0.24": [0, 0, -2],
"0.36": [0, 0, 0],
"0.48": [0, 0, 2]
}
},
"LeftArm": {
"rotation": {
"0.0": [6, 0, 0],
"0.24": [-6, 0, 0],
"0.48": [6, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.12": [0, 0.2, 0],
"0.24": [0, 0, 0],
"0.36": [0, 0.2, 0],
"0.48": [0, 0, 0]
}
},
"ElbowR": {
"rotation": {
"0.0": [-30, 0, 0],
"0.24": [-19.5, 0, 0],
"0.48": [-30, 0, 0]
}
},
"RightArm": {
"rotation": {
"0.0": [-6, 0, 0],
"0.24": [6, 0, 0],
"0.48": [-6, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.12": [0, 0.2, 0],
"0.24": [0, 0, 0],
"0.36": [0, 0.2, 0],
"0.48": [0, 0, 0]
}
},
"ElbowL": {
"rotation": {
"0.0": [-16.5, 0, 0],
"0.24": [-25.5, 0, 0],
"0.48": [-16.5, 0, 0]
}
}
}
},
"Atack": {
"animation_length": 0.48,
"bones": {
"LeftArm": {
"rotation": {
"0.0": [0, 0, 0],
"0.2": [-135, 0, 0],
"0.48": [0, 0, 0]
}
},
"ElbowR": {
"rotation": {
"0.0": [-2, 0, 0],
"0.2": [-24.5, 0, 0],
"0.48": [-2, 0, 0]
}
},
"RightArm": {
"rotation": {
"0.0": [0, 0, 0],
"0.2": [-135, 0, 0],
"0.48": [0, 0, 0]
}
},
"ElbowL": {
"rotation": {
"0.0": [-2, 0, 0],
"0.2": [-24.5, 0, 0],
"0.48": [-2, 0, 0]
}
}
}
}
}
}

View File

@ -0,0 +1,167 @@
{
"format_version": "1.8.0",
"animations": {
"Idle": {
"loop": true,
"animation_length": 0.16,
"bones": {
"Body": {
"position": {
"0.0": [0, 0, 0],
"0.08": [0, -0.1, 0],
"0.16": [0, 0, 0]
}
},
"Head": {
"position": {
"0.0": [0, 0, 0],
"0.08": [0, -0.1, 0],
"0.16": [0, 0, 0]
}
},
"LeftArm": {
"position": {
"0.0": [0, 0.1, 0],
"0.12": [0, -0.2, 0],
"0.16": [0, 0, 0]
}
},
"RightArm": {
"position": {
"0.0": [0, 0.1, 0],
"0.12": [0, -0.2, 0],
"0.16": [0, 0, 0]
}
}
}
},
"Move": {
"loop": true,
"animation_length": 0.48,
"bones": {
"Body": {
"position": {
"0.0": [0, 0, 0],
"0.12": [0, 0.3, 0],
"0.24": [0, 0, 0],
"0.36": [0, 0.3, 0],
"0.48": [0, 0, 0]
}
},
"Head": {
"position": {
"0.0": [0, 0, 0],
"0.12": [0, 0.3, 0],
"0.24": [0, 0, 0],
"0.36": [0, 0.3, 0],
"0.48": [0, 0, 0]
}
},
"LeftLeg": {
"rotation": {
"0.0": [-22.5, 0, 0],
"0.24": [22.5, 0, 0],
"0.48": [-22.5, 0, 0]
},
"position": {
"0.0": [0, 0, -2],
"0.12": [0, 0, 0],
"0.24": [0, 1, 1],
"0.36": [0, 2, -2],
"0.48": [0, 0, -2]
}
},
"RightLeg": {
"rotation": {
"0.0": [22.5, 0, 0],
"0.24": [-22.5, 0, 0],
"0.48": [22.5, 0, 0]
},
"position": {
"0.0": [0, 0, 2],
"0.12": [0, 2, -2],
"0.24": [0, 0, -2],
"0.36": [0, 0, 0],
"0.48": [0, 0, 2]
}
},
"LeftArm": {
"rotation": {
"0.0": [6, 0, 0],
"0.24": [-6, 0, 0],
"0.48": [6, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.12": [0, 0.2, 0],
"0.24": [0, 0, 0],
"0.36": [0, 0.2, 0],
"0.48": [0, 0, 0]
}
},
"ElbowR": {
"rotation": {
"0.0": [-30, 0, 0],
"0.24": [-19.5, 0, 0],
"0.48": [-30, 0, 0]
}
},
"RightArm": {
"rotation": {
"0.0": [-6, 0, 0],
"0.24": [6, 0, 0],
"0.48": [-6, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.12": [0, 0.2, 0],
"0.24": [0, 0, 0],
"0.36": [0, 0.2, 0],
"0.48": [0, 0, 0]
}
},
"ElbowL": {
"rotation": {
"0.0": [-16.5, 0, 0],
"0.24": [-25.5, 0, 0],
"0.48": [-16.5, 0, 0]
}
}
}
},
"Atack": {
"animation_length": 0.48,
"override_previous_animation": true,
"bones": {
"LeftArm": {
"rotation": {
"0.0": [0, 0, 0],
"0.2": [-135, 0, 0],
"0.48": [0, 0, 0]
}
},
"ElbowR": {
"rotation": {
"0.0": [-2, 0, 0],
"0.2": [-24.5, 0, 0],
"0.48": [-2, 0, 0]
}
},
"RightArm": {
"rotation": {
"0.0": [0, 0, 0],
"0.2": [-135, 0, 0],
"0.48": [0, 0, 0]
}
},
"ElbowL": {
"rotation": {
"0.0": [-2, 0, 0],
"0.2": [-24.5, 0, 0],
"0.48": [-2, 0, 0]
}
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

View File

@ -18,7 +18,8 @@
"HopperBlockEntityMixin",
"DispenserBlockEntityMixin",
"GuiGraphicsMixin",
"BlockStateBaseMixin"
"BlockStateBaseMixin",
"LevelMixin"
],
"client": [
"MixinGameRenderer",