diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/advancements/AdvancementData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/advancements/AdvancementData.kt index 4513da0a9..eb0c2d907 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/advancements/AdvancementData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/advancements/AdvancementData.kt @@ -331,6 +331,12 @@ fun addAdvancements(serializer: Consumer, lang: MatteryLangua } .save(serializer, modLocation("regular/industrial_glass")) + CraftEntry(MItems.FLUID_TANK, "Liquid Packaging", + russianName = "Упаковка для жидкостей").make(serializer, glass, translation) + + CraftEntry(MItems.FLUID_CAPSULE, "Liquid Canning", + russianName = "Банка для жидкостей").make(serializer, glass, translation) + AdvancementBuilder() .parent(glass) .display( @@ -560,7 +566,7 @@ fun addAdvancements(serializer: Consumer, lang: MatteryLangua .addCriterion("pill4", criterion(MItems.PILL_OBLIVION)) .save(serializer, modLocation("regular/all_pills")) - AdvancementBuilder() + val essenceCapsule = AdvancementBuilder() .parent(root) .display( itemStack = ItemStack(MItems.ESSENCE_CAPSULE), @@ -589,4 +595,7 @@ fun addAdvancements(serializer: Consumer, lang: MatteryLangua ) .addCriterion("damage", NailedEntityTrigger.Instance().criterion()) .save(serializer, modLocation("regular/explosive_hammer")) + + CraftEntry(MItems.ESSENCE_STORAGE.values, "Did not Forgot to Remember", + russianName = "Не забыл запомнить").make(serializer, essenceCapsule, translation) } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/advancements/MachineAdvancementsData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/advancements/MachineAdvancementsData.kt index f4a692864..d5fc2c3e3 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/advancements/MachineAdvancementsData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/advancements/MachineAdvancementsData.kt @@ -18,7 +18,7 @@ import java.util.function.Consumer typealias AdvancementHolder = Advancement -private data class CraftEntry( +data class CraftEntry( val item: Collection, val englishName: String, val englishSuffix: String? = null, @@ -108,6 +108,12 @@ fun addMachineAdvancements(serializer: Consumer, lang: Matter CraftEntry(MItems.TWIN_PLATE_PRESS.values, "Twice the Thud", russianName = "Двойной стук").make(serializer, press, translation) + CraftEntry(MItems.ENERGY_SERVO.values, "Power Goes In, Powered Things Go Out", + russianName = "Энергия на вход, электроинструмент на выход").make(serializer, press, translation) + + CraftEntry(MItems.ENERGY_SERVO.values, "Power Goes In, Powered Things Go Out", + russianName = "Энергия на вход, электроинструмент на выход").make(serializer, press, translation) + val scanner = CraftEntry(MItems.MATTER_SCANNER.values, "Scanning Things that Matter", russianName = "Сканируем вещи которые материальны") val decomposer = CraftEntry(MItems.MATTER_DECOMPOSER.values, "Decaying the Atoms", "Keep your limbs outside of the working chamber at all times", diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt index 7664ba033..1400c12d9 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt @@ -896,7 +896,7 @@ private fun gui(provider: MatteryLanguageProvider) { gui("experience.set_exact", "Set your experience level to %s") gui("essence_capsule", "(Almost) Everything you ever knew is within") - gui("essence_capsule2", "This item can be recycled at Essence Servo") + gui("essence_capsule2", "This item can be recycled at Essence Storage") gui("essence_capsule3", "Use to break free most of stored knowledge") gui("essence_capsule.digital", "Use to scan memories stored within") diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/PainterRecipes.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/PainterRecipes.kt index 149164b41..033cdc39b 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/PainterRecipes.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/PainterRecipes.kt @@ -323,4 +323,32 @@ fun addPainterRecipes(consumer: RecipeOutput) { } consumer.accept(PainterArmorDyeRecipe(modLocation("painter/armor_clear_dye"), mapOf(null to 15)).toFinished()) + + consumer.accept(PainterRecipe( + modLocation("painter/tritanium_yellow_stripe"), + Ingredient.of(MRegistry.TRITANIUM_BLOCK.item), + ItemStack(MItems.TRITANIUM_STRIPED_BLOCK), + mapOf(DyeColor.YELLOW to 1) + ).toFinished()) + + consumer.accept(PainterRecipe( + modLocation("painter/tritanium_yellow_stripe_stairs"), + Ingredient.of(MRegistry.TRITANIUM_STAIRS.item), + ItemStack(MItems.TRITANIUM_STRIPED_STAIRS), + mapOf(DyeColor.YELLOW to 1) + ).toFinished()) + + consumer.accept(PainterRecipe( + modLocation("painter/tritanium_yellow_stripe_slab"), + Ingredient.of(MRegistry.TRITANIUM_SLAB.item), + ItemStack(MItems.TRITANIUM_STRIPED_SLAB), + mapOf(DyeColor.YELLOW to 1) + ).toFinished()) + + consumer.accept(PainterRecipe( + modLocation("painter/tritanium_yellow_stripe_wall"), + Ingredient.of(MRegistry.TRITANIUM_WALL.item), + ItemStack(MItems.TRITANIUM_STRIPED_WALL), + mapOf(DyeColor.YELLOW to 1) + ).toFinished()) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt index dcf460a57..21dab6a97 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt @@ -535,6 +535,8 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc waitForServerLevel.forEach { it.invoke() } } else { waitForServerLevel.clear() + + BlockEntitySyncPacket.applyBacklog(this) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt index 5bb1b860b..cc3358134 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/MachinesConfig.kt @@ -70,7 +70,7 @@ object MachinesConfig : AbstractConfig("machines") { private val CHEMICAL_GENERATOR = workerValues( MNames.CHEMICAL_GENERATOR, - energyStorage = Decimal(24_000), + energyStorage = Decimal(32_000), energyThroughput = Decimal(160), energyConsumption = Decimal(40), workTimeMultiplier = null @@ -80,7 +80,7 @@ object MachinesConfig : AbstractConfig("machines") { object ChemicalGenerator { val VALUES by ::CHEMICAL_GENERATOR - val RATIO: Int by builder.comment("This amount of burn ticks result in 1 generation tick").defineInRange("RATIO", 4, 0) + val RATIO: Int by builder.comment("This amount of burn ticks result in 1 generation tick").defineInRange("RATIO", 2, 0) } object MatterBottler { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/GenericNetworkChannel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/GenericNetworkChannel.kt index 9b9197192..fa826533b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/GenericNetworkChannel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/GenericNetworkChannel.kt @@ -69,9 +69,7 @@ class BlockEntitySyncPacket(val position: BlockPos, val buffer: ByteArray, val v val blockEntity = level.getBlockEntity(position) if (blockEntity == null) { - LOGGER.warn("Putting BlockEntitySyncPacket received for $position into backlog because there is literally no block entity there!") - LOGGER.warn("This is CERTAINLY a bug in one of optimizing mods you have or server has installed!") - LOGGER.warn("This can cause memory leak.") + LOGGER.warn("Putting BlockEntitySyncPacket received for $position into backlog because there is literally no block entity there! This is CERTAINLY a bug in one of optimizing mods you have or server has installed! This might cause memory leak.") backlog.computeIfAbsent(level) { Object2ObjectOpenHashMap() } .computeIfAbsent(position, Object2ObjectFunction { ArrayList() }) @@ -88,6 +86,8 @@ class BlockEntitySyncPacket(val position: BlockPos, val buffer: ByteArray, val v try { if (packets != null) { + LOGGER.info("Unfolding ${packets.size} backlog packets for $position (${level.getBlockState(position)}/$blockEntity)") + for (packet in packets) { blockEntity.synchronizer.read(FastByteArrayInputStream(packet.buffer, 0, packet.validBytes)) } @@ -115,6 +115,22 @@ class BlockEntitySyncPacket(val position: BlockPos, val buffer: ByteArray, val v } private val LOGGER = LogManager.getLogger() + + internal fun applyBacklog(blockEntity: MatteryBlockEntity) { + val packets = backlog[blockEntity.level]?.remove(blockEntity.blockPos) + + try { + if (packets != null) { + LOGGER.info("Unfolding ${packets.size} backlog packets for ${blockEntity.blockPos} (${blockEntity.level!!.getBlockState(blockEntity.blockPos)}/$blockEntity)") + + for (packet in packets) { + blockEntity.synchronizer.read(FastByteArrayInputStream(packet.buffer, 0, packet.validBytes)) + } + } + } catch(err: Throwable) { + LOGGER.error("Exception while reading synchronized BlockEntity data!\nPosition: ${blockEntity.blockPos}\nBlock: ${blockEntity.level!!.getBlockState(blockEntity.blockPos)}\nBlock entity: $blockEntity", err) + } + } } }