This commit is contained in:
YuRaNnNzZZ 2024-01-21 11:55:58 +03:00
parent d669fcb28d
commit 7c794126b6
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
5 changed files with 59 additions and 4 deletions
src
data/kotlin/ru/dbotthepony/mc/otm/datagen/lang
main
kotlin/ru/dbotthepony/mc/otm
resources/META-INF

View File

@ -608,8 +608,8 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ESSENCE_CAPSULE, "Essence Capsule")
add(MItems.ESSENCE_DRIVE, "Essence Memory Holotape")
add(MItems.ESSENCE_SERVO, "Essence Servo")
add(MItems.ESSENCE_SERVO, "desc", "Allows to 'pump' essence involving fleshy humanoids")
add(MItems.ESSENCE_SERVO, "desc2", "Can be used standalone, or as tool inside Essence Servo")
add(MItems.ESSENCE_SERVO, "desc", "Allows to absorb nearby experience orbs directly into essence storage")
add(MItems.ESSENCE_SERVO, "desc2", "Can be used as a tool to pump essence manually")
add(MItems.NUTRIENT_PASTE, "Nutrient Paste")

View File

@ -612,8 +612,8 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ESSENCE_CAPSULE, "Капсула эссенции")
add(MItems.ESSENCE_DRIVE, "Голодиск воспоминаний андроида")
add(MItems.ESSENCE_SERVO, "Помпа эссенции")
add(MItems.ESSENCE_SERVO, "desc", "Позволяет 'перекачивать' эссенцию гуманоидов из плоти")
add(MItems.ESSENCE_SERVO, "desc2", "Может быть использовано напрямую, или как инструмент внутри хранилища эссенции")
add(MItems.ESSENCE_SERVO, "desc", "Позволяет всасывать близлежащие сферы опыта напрямую в хранилище эссенции")
add(MItems.ESSENCE_SERVO, "desc2", "Может использоваться как инструмент для ручной перекачки эссенции")
add(MItems.NUTRIENT_PASTE, "Питательная паста")

View File

@ -1,6 +1,10 @@
package ru.dbotthepony.mc.otm.block.entity.tech
import net.minecraft.core.BlockPos
import net.minecraft.server.level.ServerLevel
import net.minecraft.sounds.SoundEvents
import net.minecraft.sounds.SoundSource
import net.minecraft.world.entity.ExperienceOrb
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
@ -12,9 +16,13 @@ import net.minecraftforge.fluids.capability.IFluidHandler
import ru.dbotthepony.mc.otm.block.entity.ExperienceStorage.Companion.XP_TO_LIQUID_RATIO
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
import ru.dbotthepony.mc.otm.capability.item.CombinedItemHandler
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.getEntitiesInEllipsoid
import ru.dbotthepony.mc.otm.core.math.Vector
import ru.dbotthepony.mc.otm.item.EssenceCapsuleItem
import ru.dbotthepony.mc.otm.item.EssenceServoItem
import ru.dbotthepony.mc.otm.menu.tech.EssenceStorageMenu
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.registry.MFluids
@ -146,6 +154,37 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
repairStack.damageValue -= repairPoints
}
}
val servo = servoContainer[0]
if (!servo.isEmpty && servo.item is EssenceServoItem && level is ServerLevel) {
val entities = level!!.getEntitiesInEllipsoid(
blockPos.center,
Vector(
MachinesConfig.EssenceStorage.RADIUS_HORIZONTAL,
MachinesConfig.EssenceStorage.RADIUS_VERTICAL,
MachinesConfig.EssenceStorage.RADIUS_HORIZONTAL
)
) { it is ExperienceOrb }
for ((ent, _) in entities) {
ent as ExperienceOrb
for (i in 1 .. ent.count) {
experienceStored += ent.value
ent.count--
level!!.playSound(null, ent.x, ent.y, ent.z,
SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.BLOCKS,
0.1F, 0.5F + level!!.random.nextFloat() * 0.25F
)
}
if (ent.count <= 0) {
ent.discard()
}
}
}
}
}
}

View File

@ -219,7 +219,21 @@ object MachinesConfig : AbstractConfig("machines") {
}
}
object EssenceStorage {
init {
builder.push(MNames.ESSENCE_STORAGE)
}
val RADIUS_HORIZONTAL: Double by builder.defineInRange("RADIUS_HORIZONTAL", 5.0, 0.0, Double.MAX_VALUE / 4.0)
val RADIUS_VERTICAL: Double by builder.defineInRange("RADIUS_VERTICAL", 2.0, 0.0, Double.MAX_VALUE / 4.0)
init {
builder.pop()
}
}
init {
Upgrades
EssenceStorage
}
}

View File

@ -163,6 +163,8 @@ public net.minecraft.world.entity.boss.wither.WitherBoss f_31432_ # TARGETING_CO
public-f net.minecraft.world.entity.boss.wither.WitherBoss f_31431_ # LIVING_ENTITY_SELECTOR
public net.minecraft.world.entity.ai.targeting.TargetingConditions f_26879_ # selector
public net.minecraft.world.entity.ExperienceOrb f_147072_ # count
public net.minecraft.advancements.critereon.InventoryChangeTrigger$TriggerInstance f_43179_
public net.minecraft.advancements.critereon.InventoryChangeTrigger$TriggerInstance f_43178_
public net.minecraft.advancements.critereon.InventoryChangeTrigger$TriggerInstance f_43177_