This commit is contained in:
DBotThePony 2024-01-08 14:13:04 +07:00
commit 55c0be74d3
Signed by: DBot
GPG Key ID: DCC23B5715498507
7 changed files with 65 additions and 8 deletions

View File

@ -331,6 +331,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, 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<AdvancementHolder>, 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<AdvancementHolder>, 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)
}

View File

@ -18,7 +18,7 @@ import java.util.function.Consumer
typealias AdvancementHolder = Advancement
private data class CraftEntry(
data class CraftEntry(
val item: Collection<Item>,
val englishName: String,
val englishSuffix: String? = null,
@ -108,6 +108,12 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, 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",

View File

@ -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")

View File

@ -323,4 +323,28 @@ fun addPainterRecipes(consumer: RecipeOutput) {
}
consumer.accept(PainterArmorDyeRecipe(modLocation("painter/armor_clear_dye"), mapOf(null to 15)).toFinished())
consumer.accept(PainterRecipe(
Ingredient.of(MRegistry.TRITANIUM_BLOCK.item),
ItemStack(MItems.TRITANIUM_STRIPED_BLOCK),
mapOf(DyeColor.YELLOW to 1)
).toFinished(modLocation("painter/tritanium_yellow_stripe")))
consumer.accept(PainterRecipe(
Ingredient.of(MRegistry.TRITANIUM_STAIRS.item),
ItemStack(MItems.TRITANIUM_STRIPED_STAIRS),
mapOf(DyeColor.YELLOW to 1)
).toFinished(modLocation("painter/tritanium_yellow_stripe_stairs")))
consumer.accept(PainterRecipe(
Ingredient.of(MRegistry.TRITANIUM_SLAB.item),
ItemStack(MItems.TRITANIUM_STRIPED_SLAB),
mapOf(DyeColor.YELLOW to 1)
).toFinished(modLocation("painter/tritanium_yellow_stripe_slab")))
consumer.accept(PainterRecipe(
Ingredient.of(MRegistry.TRITANIUM_WALL.item),
ItemStack(MItems.TRITANIUM_STRIPED_WALL),
mapOf(DyeColor.YELLOW to 1)
).toFinished(modLocation("painter/tritanium_yellow_stripe_wall")))
}

View File

@ -535,6 +535,8 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
waitForServerLevel.forEach { it.invoke() }
} else {
waitForServerLevel.clear()
BlockEntitySyncPacket.applyBacklog(this)
}
}

View File

@ -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 {

View File

@ -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)
}
}
}
}