Merge branch '1.21' into worldgen-placement-providers

This commit is contained in:
DBotThePony 2025-03-05 00:45:13 +07:00
commit 01a6ca27bf
Signed by: DBot
GPG Key ID: DCC23B5715498507
41 changed files with 1043 additions and 42 deletions

View File

@ -188,7 +188,7 @@ dependencies {
compileOnly("curse.maven:resourceful-config-714059:${resourceful_config_id}")
compileOnly("curse.maven:botarium-704113:${botarium_id}")
compileOnly("curse.maven:ad-astra-635042:${ad_astra_id}")
//runtimeOnly("curse.maven:worldedit-225608:${worldedit_id}")
runtimeOnly("curse.maven:worldedit-225608:${worldedit_id}")
runtimeOnly("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}")
implementation("io.wispforest:condensed_creative-neoforge:${condensed_creative_version}")

View File

@ -114,6 +114,17 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.handheld(MItems.CHEST_UPGRADER)
provider.exec {
val path = MItems.CONFIGURATOR.registryName!!.path
val ready = provider.withExistingParent("${path}_ready", MatteryItemModelProvider.HANDHELD)
.texture("layer0", modLocation("item/${path}_ready"))
provider.withExistingParent(path, MatteryItemModelProvider.HANDHELD)
.texture("layer0", modLocation("item/$path"))
.override().predicate(modLocation("has_configuration_saved"), 1f).model(ready).end()
}
provider.generated(MItems.BREAD_MONSTER_SPAWN_EGG, modLocation("item/egg/bread_monster"))
provider.generated(MItems.LOADER_SPAWN_EGG, modLocation("item/egg/loader"))

View File

@ -826,6 +826,7 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.REINFORCED_IRON_PLATE, "desc", "A sturdier and more durable Iron Plate")
add(MItems.ARMOR_ASSEMBLY, "Armor assembly")
add(MItems.CARBON_MESH, "Carbon Mesh")
add(MItems.DISPLAY_SCREEN, "Display Screen")
add(MItems.GRAVITATIONAL_DISRUPTOR, "Spacetime Equalizer")
@ -859,6 +860,12 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ENERGY_SWORD, "desc3", "Always strikes surrounding enemies with full damage if empowered")
add(MItems.ENERGY_SWORD, "desc4", "Does not benefit from Sweeping Edge enchantment")
add(MItems.FALLING_SUN, "◄ Falling Sun ►")
add(MItems.FALLING_SUN, "desc", "Prototype weapon, needs power to operate")
add(MItems.FALLING_SUN, "desc2", "Deals extra damage to androids when empowered")
add(MItems.FALLING_SUN, "desc3", "Always strikes surrounding enemies with full damage if empowered")
add(MItems.FALLING_SUN, "desc4", "Does not benefit from Sweeping Edge enchantment")
add(MItems.PORTABLE_CONDENSATION_DRIVE, "Portable Condensation Drive")
add(MItems.PORTABLE_DENSE_CONDENSATION_DRIVE, "Portable Dense Condensation Drive")
add(MItems.TRITANIUM_ORE_CLUMP, "Raw Tritanium")
@ -918,6 +925,12 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.CHEST_UPGRADER, "desc", "Replaces placed chests and barrels with cargo crates while keeping storage contents")
add(MItems.CHEST_UPGRADER, "desc2", "Hold desired crates in the opposite hand")
add(MItems.CONFIGURATOR, "Configurator")
add(MItems.CONFIGURATOR, "desc", "Copies configuration from one block to another")
add(MItems.CONFIGURATOR, "desc2", "Sneak-use on block to copy, use to paste")
add(MItems.CONFIGURATOR, "desc3", "Use on air while sneaking to clear saved configuration")
add(MItems.CONFIGURATOR, "desc_saved", "Saved configuration for: %s")
add(MItems.BREAD_MONSTER_SPAWN_EGG, "Bread Monster Spawn Egg")
add(MEntityTypes.BREAD_MONSTER, "Bread Monster")
@ -975,6 +988,11 @@ private fun gui(provider: MatteryLanguageProvider) {
gui("flow_direction_set", "Flow direction set to %s")
gui("tick_timer_set", "Timer set to %s ticks")
gui("config_copied", "Copied configuration for %s")
gui("config_pasted", "Applied saved configuration")
gui("config_cleared", "Configuration cleared")
gui("config_missing", "No configuration to apply")
gui("black_hole_generator.help0", "Generates energy using angular momentum of Singularities")
gui("black_hole_generator.help1", "The stronger gravity Singularity has, the more power is generated!")
gui("black_hole_generator.help2", "Using Spacetime Normalizers will reduce gravitation strength of Singularity, which will reduce power output.")

View File

@ -819,6 +819,7 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.REINFORCED_IRON_PLATE, "desc", "Более надёжная и прочная железная пластина")
add(MItems.ARMOR_ASSEMBLY, "Стройка брони")
add(MItems.CARBON_MESH, "Углеродная сетка")
add(MItems.DISPLAY_SCREEN, "Экран дисплея")
add(MItems.GRAVITATIONAL_DISRUPTOR, "Маяк уравнения пространства-времени")
@ -852,6 +853,12 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ENERGY_SWORD, "desc3", "Всегда наносит полный урон по площади если имеет заряд")
add(MItems.ENERGY_SWORD, "desc4", "Зачарование 'Разящий клинок' не имеет никакого эффекта на данном оружии")
add(MItems.FALLING_SUN, "◄ Падающее Солнце ►")
add(MItems.FALLING_SUN, "desc", "Прототип,требует энергию для работы")
add(MItems.FALLING_SUN, "desc2", "Наносит дополнительный урон андроидам если имеет заряд")
add(MItems.FALLING_SUN, "desc3", "Всегда наносит полный урон по площади если имеет заряд")
add(MItems.FALLING_SUN, "desc4", "Зачарование 'Разящий клинок' не имеет никакого эффекта на данном оружии")
add(MItems.PORTABLE_CONDENSATION_DRIVE, "Portable Condensation Drive")
add(MItems.PORTABLE_DENSE_CONDENSATION_DRIVE, "Portable Dense Condensation Drive")
add(MItems.TRITANIUM_ORE_CLUMP, "Рудный тритан")
@ -911,6 +918,12 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.CHEST_UPGRADER, "desc", "Заменяет установленные сундуки и бочки грузовыми ящиками с сохранением содержимого")
add(MItems.CHEST_UPGRADER, "desc2", "Удерживайте необходимые ящики в противоположной руке")
add(MItems.CONFIGURATOR, "Конфигуратор")
add(MItems.CONFIGURATOR, "desc", "Копирует настройки между блоками")
add(MItems.CONFIGURATOR, "desc2", "Использование крадясь на блоке копирует настройки, простое использование применяет")
add(MItems.CONFIGURATOR, "desc3", "Используйте крадясь на воздухе для очистки")
add(MItems.CONFIGURATOR, "desc_saved", "Сохранены настройки для: %s")
add(MItems.BREAD_MONSTER_SPAWN_EGG, "Яйцо призыва хлебного монстра")
add(MEntityTypes.BREAD_MONSTER, "Хлебный монстр")
@ -968,6 +981,11 @@ private fun gui(provider: MatteryLanguageProvider) {
gui("flow_direction_set", "Направление потока установлено на %s")
gui("tick_timer_set", "Таймер установлен на %s тиков")
gui("config_copied", "Скопированы настройки для %s")
gui("config_pasted", "Настройки применены")
gui("config_cleared", "Настройки очищены")
gui("config_missing", "Нет настроек для применения")
gui("black_hole_generator.help0", "Генерирует электричество используя угловое ускорение сингулярностей")
gui("black_hole_generator.help1", "Чем сильнее гравитационное поле сингулярности, тем больше генерация!")
gui("black_hole_generator.help2", "Использование стабилизаторов пространства-времени ослабляет гравитационное поле, снижая генерацию")

View File

@ -100,4 +100,10 @@ fun addComponentRecipes(consumer: RecipeOutput) {
.row(MItemTags.COPPER_WIRES, MItems.MECHANICAL_PARTS, MItemTags.COPPER_WIRES)
.unlockedBy(MItems.ELECTROMAGNET)
.build(consumer)
MatteryRecipe(MItems.DISPLAY_SCREEN, 3)
.row(MItemTags.IRON_PLATES, Tags.Items.DUSTS_GLOWSTONE, Tags.Items.GLASS_PANES_COLORLESS)
.row(MItemTags.IRON_PLATES, Tags.Items.DUSTS_REDSTONE, Tags.Items.GLASS_PANES_COLORLESS)
.row(MItemTags.IRON_PLATES, Tags.Items.DUSTS_GLOWSTONE, Tags.Items.GLASS_PANES_COLORLESS)
.build(consumer)
}

View File

@ -52,8 +52,8 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.save(consumer, modLocation("holo_sign_reset"))
MatteryRecipe(MBlocks.DRIVE_VIEWER[null]!!, category = machinesCategory)
.rowAC(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
.row(Tags.Items.DUSTS_GLOWSTONE, MItems.MACHINE_FRAME, Tags.Items.GLASS_BLOCKS)
.rowBC(MItems.DISPLAY_SCREEN, Tags.Items.GLASS_PANES)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItemTags.BASIC_CIRCUIT, MItems.MATTER_IO_PORT, MItemTags.BASIC_CIRCUIT)
.unlockedBy(MItems.MATTER_IO_PORT)
.build(consumer)
@ -75,9 +75,9 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.build(consumer)
MatteryRecipe(MBlocks.MATTER_PANEL[null]!!, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES, Tags.Items.GLASS_BLOCKS)
.row(MItems.MATTER_CABLE, Tags.Items.DUSTS_GLOWSTONE, Tags.Items.GLASS_BLOCKS)
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, Tags.Items.GLASS_BLOCKS)
.row(MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES, Tags.Items.GLASS_PANES)
.row(MItems.MATTER_CABLE, MItems.DISPLAY_SCREEN, Tags.Items.GLASS_PANES)
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, Tags.Items.GLASS_PANES)
.unlockedBy(Tags.Items.GLASS_BLOCKS)
.build(consumer)
@ -99,7 +99,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
MatteryRecipe(MBlocks.ENERGY_COUNTER[null]!!, category = machinesCategory)
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.BASIC_CIRCUIT, Tags.Items.DUSTS_GLOWSTONE, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
.row(MItemTags.BASIC_CIRCUIT, MItems.DISPLAY_SCREEN, MItemTags.HARDENED_GLASS_PANES)
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.ENERGY_BUS)
.build(consumer)
@ -223,7 +223,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.build(consumer)
MatteryRecipe(MItems.BLACK_HOLE_SCANNER, category = RecipeCategory.TOOLS)
.row(MItemTags.IRON_PLATES, Tags.Items.GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItemTags.IRON_PLATES, MItems.DISPLAY_SCREEN, MItemTags.IRON_PLATES)
.row(MItemTags.GOLD_WIRES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT)
.rowAC(Tags.Items.DUSTS_GLOWSTONE, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
@ -585,4 +585,12 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.unlockedBy(MItems.DILITHIUM_CRYSTAL)
.unlockedBy(MItems.DILITHIUM_CRYSTAL_BLOCK)
.save(consumer, modLocation("dilithium_crystal/from_block"))
MatteryRecipe(MItems.CONFIGURATOR, category = RecipeCategory.TOOLS)
.rowA(MItemTags.IRON_PLATES)
.row(Tags.Items.GLASS_PANES, Tags.Items.DUSTS_REDSTONE, MItems.DISPLAY_SCREEN)
.row(MItemTags.IRON_PLATES, MItemTags.BASIC_CIRCUIT, MItems.DILITHIUM_CRYSTAL)
.unlockedBy(MItems.DILITHIUM_CRYSTAL)
.unlockedBy(MItems.DISPLAY_SCREEN)
.build(consumer)
}

View File

@ -433,11 +433,11 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
for ((color, item) in MRegistry.COMPUTER_TERMINAL.allItems) {
val builder = MatteryRecipe(item, category = RecipeCategory.DECORATIONS)
builder.row(MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
if (color != null) {
builder.rowB(color.tag)
}
builder.row(MItemTags.TRITANIUM_PLATES, MItems.DISPLAY_SCREEN, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
builder.rowB(MItemTags.BASIC_CIRCUIT)
builder.build(consumer)
}

View File

@ -96,6 +96,11 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
*/
protected val savetablesLevel = Savetables()
/**
* Savetables for things configured from user input
*/
protected val savetablesConfig = Savetables()
/**
* "shortcut" for getting [BlockRotation]
*
@ -269,6 +274,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
*/
open fun saveShared(nbt: CompoundTag, registry: Provider) {
savetables.serializeNBT(nbt, registry)
saveConfiguration(nbt, registry)
}
/**
@ -282,6 +288,15 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
super.loadAdditional(nbt, registry)
savetables.deserializeNBT(registry, nbt)
savetablesLevel.deserializeNBT(registry, nbt)
loadConfiguration(nbt, registry)
}
fun saveConfiguration(nbt: CompoundTag, registry: Provider) {
savetablesConfig.serializeNBT(nbt, registry)
}
fun loadConfiguration(nbt: CompoundTag, registry: Provider) {
savetablesConfig.deserializeNBT(registry, nbt)
}
@Suppress("OVERRIDE_DEPRECATION")

View File

@ -56,7 +56,7 @@ abstract class MatteryDeviceBlockEntity(blockEntityType: BlockEntityType<*>, blo
}
init {
savetables.stateful(::redstoneControl, REDSTONE_CONTROL_KEY)
savetablesConfig.stateful(::redstoneControl, REDSTONE_CONTROL_KEY)
}
protected open val defaultDisplayName: Component
@ -146,9 +146,9 @@ abstract class MatteryDeviceBlockEntity(blockEntityType: BlockEntityType<*>, blo
init {
// https://tenor.com/view/simp-metal-gear-liquid-snake-running-gif-16717852
savetables.enum(::flow, "fluid_${side}_flow", FlowDirection::valueOf)
savetables.bool(::automatePull, "fluid_${side}_pull")
savetables.bool(::automatePush, "fluid_${side}_push")
savetablesConfig.enum(::flow, "fluid_${side}_flow", FlowDirection::valueOf)
savetablesConfig.bool(::automatePull, "fluid_${side}_pull")
savetablesConfig.bool(::automatePush, "fluid_${side}_push")
}
var flow by syncher.enum(possibleModes, setter = { access, value ->
@ -375,9 +375,9 @@ abstract class MatteryDeviceBlockEntity(blockEntityType: BlockEntityType<*>, blo
}
init {
savetables.enum(::energyFlow, "energy_${side}_flow", FlowDirection::valueOf)
savetables.bool(::automatePull, "energy_${side}_pull")
savetables.bool(::automatePush, "energy_${side}_push")
savetablesConfig.enum(::energyFlow, "energy_${side}_flow", FlowDirection::valueOf)
savetablesConfig.bool(::automatePull, "energy_${side}_pull")
savetablesConfig.bool(::automatePush, "energy_${side}_push")
dirtyListeners.addListener(Runnable {
updateTickerState()
@ -626,9 +626,9 @@ abstract class MatteryDeviceBlockEntity(blockEntityType: BlockEntityType<*>, blo
}
init {
savetables.bool(::automatePull, "itemhandler_${side}_automatePull")
savetables.bool(::automatePush, "itemhandler_${side}_automatePush")
savetables.enum(::mode, "itemhandler_${side}_mode", ItemHandlerMode::valueOf)
savetablesConfig.bool(::automatePull, "itemhandler_${side}_automatePull")
savetablesConfig.bool(::automatePush, "itemhandler_${side}_automatePush")
savetablesConfig.enum(::mode, "itemhandler_${side}_mode", ItemHandlerMode::valueOf)
waitForServerLevel {
redstoneControl.addListener(::updateTickerState)

View File

@ -73,7 +73,7 @@ abstract class MatteryWorkerBlockEntity<JobType : IJob>(
var balanceInputs = false
init {
savetables.bool(::balanceInputs)
savetablesConfig.bool(::balanceInputs)
}
protected open fun jobUpdated(new: JobType?, old: JobType?, id: Int) {}

View File

@ -118,9 +118,9 @@ class BlackHoleGeneratorBlockEntity(blockPos: BlockPos, blockState: BlockState)
exposeSideless(MatteryCapability.BLOCK_ENERGY, energy)
exposeSideless(Capabilities.EnergyStorage.BLOCK, energy)
savetables.enum(::mode, map = Mode::valueOf)
savetables.decimal(::injectionRate)
savetables.decimal(::targetMass)
savetablesConfig.enum(::mode, map = Mode::valueOf)
savetablesConfig.decimal(::injectionRate)
savetablesConfig.decimal(::targetMass)
}
private fun findBlackHoleRange(): Int {

View File

@ -64,16 +64,16 @@ class HoloSignBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryB
var isLocked = false
init {
savetables.string(::signText)
savetablesConfig.string(::signText)
savetablesLevel.bool(::isLocked)
savetables.stateful(::redstoneControl)
savetablesConfig.stateful(::redstoneControl)
savetables.float(::textRed)
savetables.float(::textGreen)
savetables.float(::textBlue)
savetables.float(::textAlpha)
savetablesConfig.float(::textRed)
savetablesConfig.float(::textGreen)
savetablesConfig.float(::textBlue)
savetablesConfig.float(::textAlpha)
savetables.bool(::textAutoScale)
savetablesConfig.bool(::textAutoScale)
}
override fun createMenu(p_39954_: Int, p_39955_: Inventory, p_39956_: Player): AbstractContainerMenu {

View File

@ -82,7 +82,7 @@ class PainterBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryDe
init {
addDroppableContainer(dyeInput)
savetables.stateful(dyeInput, INVENTORY_KEY)
savetables.bool(::isBulk)
savetablesConfig.bool(::isBulk)
exposeGlobally(Capabilities.FluidHandler.BLOCK, this)
}

View File

@ -112,8 +112,8 @@ class MatterBottlerBlockEntity(blockPos: BlockPos, blockState: BlockState) :
exposeGlobally(MatteryCapability.MATTER_BLOCK, matter)
exposeGlobally(MatteryCapability.MATTER_NODE, matterNode)
savetables.bool(::isBottling)
savetables.bool(::spitItemsWhenCantWork)
savetablesConfig.bool(::isBottling)
savetablesConfig.bool(::spitItemsWhenCantWork)
savetables.stateful(::energy, ENERGY_KEY)
savetables.stateful(::matter, MATTER_STORAGE_KEY)
savetables.stateful(::bottling)

View File

@ -84,7 +84,7 @@ class MatterPanelBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
exposeGlobally(MatteryCapability.MATTER_NODE, matterNode)
exposeGlobally(MatteryCapability.REPLICATION_TASK, this)
savetables.bool(::isProvidingTasks)
savetablesConfig.bool(::isProvidingTasks)
}
override fun setLevel(level: Level) {

View File

@ -63,9 +63,9 @@ class DriveRackBlockEntity(blockPos: BlockPos, blockState: BlockState) : Mattery
savetables.stateful(::energy, ENERGY_KEY)
savetables.stateful(::container, INVENTORY_KEY)
exposeGlobally(MatteryCapability.STORAGE_NODE, cell)
savetables.int(::insertPriority)
savetables.int(::extractPriority)
savetables.enum(::mode, map = FlowDirection::valueOf)
savetablesConfig.int(::insertPriority)
savetablesConfig.int(::extractPriority)
savetablesConfig.enum(::mode, map = FlowDirection::valueOf)
redstoneControl.addListener(Consumer {
cell.isDetached = it

View File

@ -131,7 +131,7 @@ class StorageBusBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matter
}
init {
savetables.codec(::filter, ItemFilter.CODEC, FILTER_KEY, Supplier { ItemFilter(MAX_FILTERS) })
savetablesConfig.codec(::filter, ItemFilter.CODEC, FILTER_KEY, Supplier { ItemFilter(MAX_FILTERS) })
}
override fun setLevel(level: Level) {

View File

@ -112,7 +112,7 @@ abstract class AbstractStorageImportExport(
}
init {
savetables.codec(::filter, ItemFilter.CODEC, FILTER_KEY, Supplier { ItemFilter(MAX_FILTERS) })
savetablesConfig.codec(::filter, ItemFilter.CODEC, FILTER_KEY, Supplier { ItemFilter(MAX_FILTERS) })
}
companion object {

View File

@ -78,7 +78,7 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat
}
init {
savetables.int(::displayChartOnBlock)
savetablesConfig.int(::displayChartOnBlock)
savetables.stateful(::history5s)
savetables.stateful(::history15s)
savetables.stateful(::history1m)

View File

@ -1,12 +1,14 @@
package ru.dbotthepony.mc.otm.config
import ru.dbotthepony.mc.otm.item.weapon.EnergySwordItem
import ru.dbotthepony.mc.otm.item.weapon.FallingSunItem
object ToolsConfig : AbstractConfig("tools") {
val AXES_BREAK_LEAVES_INSTANTLY: Boolean by builder.define("AXES_BREAK_LEAVES_INSTANTLY", true)
init {
EnergySwordItem.registerConfig(builder)
FallingSunItem.registerConfig(builder)
}
object ExplosiveHammer {

View File

@ -109,7 +109,7 @@ class CMWCRandom(seed: Long = System.nanoTime()) : RandomGenerator, RandomSource
}
companion object {
const val CMWC_STATE_SIZE = 256 // 4096
const val CMWC_STATE_SIZE = 32 // 4096
const val CMWC_CARRY_MAX = 809430660
}
}

View File

@ -0,0 +1,111 @@
package ru.dbotthepony.mc.otm.item
import net.minecraft.nbt.CompoundTag
import net.minecraft.network.chat.Component
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResult
import net.minecraft.world.InteractionResultHolder
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.TooltipFlag
import net.minecraft.world.item.context.UseOnContext
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Blocks
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
import ru.dbotthepony.mc.otm.core.TextComponent
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.registry.game.MDataComponentTypes
import ru.dbotthepony.mc.otm.server.sendActionBarMessage
class ConfiguratorItem : MatteryItem(Properties().stacksTo(1)) {
init {
addSimpleDescription()
addSimpleDescription("2")
addSimpleDescription("3")
}
override fun appendHoverText(
stack: ItemStack,
context: TooltipContext,
components: MutableList<Component>,
tooltipType: TooltipFlag
) {
super.appendHoverText(stack, context, components, tooltipType)
val tag = getConfiguration(stack)
val block = stack.getOrDefault(MDataComponentTypes.Configurator.BLOCK, Blocks.AIR.defaultBlockState())
if (!tag.isEmpty && !block.isAir) {
components.add(TranslatableComponent("$descriptionId.desc_saved", block.block.name))
}
}
override fun use(level: Level, player: Player, hand: InteractionHand): InteractionResultHolder<ItemStack?> {
if (player is ServerPlayer && player.isCrouching) {
val stack = player.getItemInHand(hand)
setConfiguration(stack, CompoundTag())
stack.set(MDataComponentTypes.Configurator.BLOCK, Blocks.AIR.defaultBlockState())
player.sendActionBarMessage(TranslatableComponent("otm.gui.config_cleared"))
return InteractionResultHolder.success(stack)
}
return super.use(level, player, hand)
}
override fun onItemUseFirst(stack: ItemStack, context: UseOnContext): InteractionResult {
val player = context.player
if (player == null) return super.useOn(context)
val level = context.level
val tile = level.getBlockEntity(context.clickedPos)
if (tile == null || tile !is MatteryBlockEntity) return super.useOn(context)
if (player.isCrouching == true) {
if (player is ServerPlayer) {
val tag = CompoundTag()
tile.saveConfiguration(tag, level.registryAccess())
if (tag.isEmpty) return super.onItemUseFirst(stack, context)
setConfiguration(stack, tag)
val block = level.getBlockState(context.clickedPos)
stack.set(MDataComponentTypes.Configurator.BLOCK, block)
player.sendActionBarMessage(TranslatableComponent("otm.gui.config_copied", block.block.name))
}
return InteractionResult.SUCCESS
}
val tag = getConfiguration(stack)
if (!tag.isEmpty) {
if (player is ServerPlayer) {
tile.loadConfiguration(tag, level.registryAccess())
player.sendActionBarMessage(TranslatableComponent("otm.gui.config_pasted"))
}
return InteractionResult.SUCCESS
} else {
if (player is ServerPlayer) {
player.sendActionBarMessage(TranslatableComponent("otm.gui.config_missing"))
}
return InteractionResult.FAIL
}
return super.useOn(context)
}
fun getConfiguration(stack: ItemStack): CompoundTag {
return stack.getOrDefault(MDataComponentTypes.Configurator.CONFIGURATION, CompoundTag())
}
fun setConfiguration(stack: ItemStack, tag: CompoundTag) {
stack.set(MDataComponentTypes.Configurator.CONFIGURATION, tag)
}
}

View File

@ -0,0 +1,232 @@
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
import net.minecraft.world.entity.ai.attributes.AttributeModifier
import net.minecraft.world.entity.ai.attributes.Attributes
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Rarity
import net.minecraft.world.item.component.ItemAttributeModifiers
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.state.BlockState
import net.neoforged.neoforge.capabilities.Capabilities
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent
import net.neoforged.neoforge.common.ItemAbilities
import net.neoforged.neoforge.common.ItemAbility
import net.neoforged.neoforge.common.ModConfigSpec
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.energy.EnergyConsumerItem
import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact
import ru.dbotthepony.mc.otm.capability.energy.getBarColor
import ru.dbotthepony.mc.otm.capability.energy.getBarWidth
import ru.dbotthepony.mc.otm.capability.matteryEnergy
import ru.dbotthepony.mc.otm.capability.matteryPlayer
import ru.dbotthepony.mc.otm.core.ResourceLocation
import ru.dbotthepony.mc.otm.core.damageType
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
import ru.dbotthepony.mc.otm.registry.CapabilitiesRegisterListener
import ru.dbotthepony.mc.otm.registry.MDamageTypes
import ru.dbotthepony.mc.otm.registry.MatteryDamageSource
class FallingSunItem : MatteryItem(Properties().stacksTo(1).rarity(Rarity.EPIC)), CapabilitiesRegisterListener {
private val chargedAttributes: ItemAttributeModifiers
private val dischargedAttributes: ItemAttributeModifiers
init {
var builder = ItemAttributeModifiers.builder()
builder.add(Attributes.ATTACK_DAMAGE, AttributeModifier(BASE_ATTACK_DAMAGE_ID, 13.0, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND)
builder.add(Attributes.ATTACK_SPEED, AttributeModifier(BASE_ATTACK_SPEED_ID, -3.2, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND)
builder.add(Attributes.SWEEPING_DAMAGE_RATIO, AttributeModifier(ResourceLocation(OverdriveThatMatters.MOD_ID, "energy_sword_sweeping_edge"), 1.0, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND)
chargedAttributes = builder.build()
builder = ItemAttributeModifiers.builder()
builder.add(Attributes.ATTACK_DAMAGE, AttributeModifier(BASE_ATTACK_DAMAGE_ID, 5.5, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND)
builder.add(Attributes.ATTACK_SPEED, AttributeModifier(BASE_ATTACK_SPEED_ID, -3.2, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND)
dischargedAttributes = builder.build()
}
override fun isEnchantable(p_41456_: ItemStack): Boolean {
return p_41456_.count == 1
}
override fun getEnchantmentValue(stack: ItemStack): Int {
return 12
}
override fun getDestroySpeed(itemStack: ItemStack, blockState: BlockState): Float {
val energy = itemStack.getCapability(MatteryCapability.ITEM_ENERGY) ?: return 1f
if (blockState.`is`(Blocks.COBWEB)) {
return if (energy.batteryLevel < COBWEB_POWER_COST) 2f else 25f
} else if (blockState.`is`(BlockTags.SWORD_EFFICIENT)) {
return if (energy.batteryLevel < PLANT_POWER_COST) 1.5f else 8f
} else {
return 1f
}
}
override fun canAttackBlock(p_41441_: BlockState, p_41442_: Level, p_41443_: BlockPos, p_41444_: Player): Boolean {
return !p_41444_.isCreative
}
override fun hurtEnemy(itemStack: ItemStack, victim: LivingEntity, attacker: LivingEntity): Boolean {
if (attacker is Player && attacker.isCreative) {
victim.matteryPlayer?.let {
if (it.isAndroid) {
victim.invulnerableTime = 0
victim.hurt(MatteryDamageSource(attacker.level().registryAccess().damageType(MDamageTypes.EMP), attacker, itemStack), 8f)
}
}
return true
}
itemStack.getCapability(MatteryCapability.ITEM_ENERGY)?.let {
if (it.extractEnergyExact(ENERGY_PER_SWING, 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().otmRandom.nextVariance(ENERGY_ZAP_VARIANCE), false)
victim.hurt(MatteryDamageSource(attacker.level().registryAccess().damageType(MDamageTypes.EMP), attacker, itemStack), 8f)
}
}
}
}
return true
}
override fun isBarVisible(p_150899_: ItemStack): Boolean {
return p_150899_.matteryEnergy != null
}
override fun getBarWidth(p_150900_: ItemStack): Int {
return p_150900_.matteryEnergy?.getBarWidth() ?: super.getBarWidth(p_150900_)
}
override fun getBarColor(p_150901_: ItemStack): Int {
return p_150901_.matteryEnergy?.getBarColor() ?: super.getBarColor(p_150901_)
}
init {
tooltips.itemEnergy()
addSimpleDescription()
addSimpleDescription("2")
addSimpleDescription("3")
addSimpleDescription("4")
}
override fun mineBlock(
itemStack: ItemStack,
p_41417_: Level,
blockState: BlockState,
p_41419_: BlockPos,
user: LivingEntity
): Boolean {
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().otmRandom.nextVariance(PLANT_POWER_COST_VARIANCE), false)
}
if (blockState.`is`(Blocks.COBWEB)) {
if (energy?.extractEnergyExact(COBWEB_POWER_COST, false) == true)
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) {
event.registerItem(MatteryCapability.ITEM_ENERGY, { o, _ -> cap(o) }, this)
event.registerItem(Capabilities.EnergyStorage.ITEM, { o, _ -> cap(o) }, this)
}
override fun getDefaultAttributeModifiers(stack: ItemStack): ItemAttributeModifiers {
val energy = cap(stack)
if (energy.batteryLevel >= ENERGY_PER_SWING) {
return chargedAttributes
}
return dischargedAttributes
}
override fun canPerformAction(stack: ItemStack, toolAction: ItemAbility): Boolean {
if (cap(stack).extractEnergyExact(ENERGY_PER_SWING, true)) {
return ItemAbilities.DEFAULT_SWORD_ACTIONS.contains(toolAction)
}
return false
}
companion object {
val MAX_ENERGY get() = _MAX_ENERGY.get()
val ENERGY_ZAP get() = _ENERGY_ZAP.get()
val ENERGY_ZAP_VARIANCE get() = _ENERGY_ZAP_VARIANCE.get()
val ENERGY_PER_SWING get() = _ENERGY_PER_SWING.get()
val ENERGY_PER_SWING_VARIANCE get() = _ENERGY_PER_SWING_VARIANCE.get()
val COBWEB_POWER_COST get() = _COBWEB_POWER_COST.get()
val COBWEB_POWER_COST_VARIANCE get() = _COBWEB_POWER_COST_VARIANCE.get()
val PLANT_POWER_COST get() = _PLANT_POWER_COST.get()
val PLANT_POWER_COST_VARIANCE get() = _PLANT_POWER_COST_VARIANCE.get()
private var _MAX_ENERGY: DecimalConfigValue by WriteOnce()
private var _ENERGY_ZAP: DecimalConfigValue by WriteOnce()
private var _ENERGY_ZAP_VARIANCE: DecimalConfigValue by WriteOnce()
private var _ENERGY_PER_SWING: DecimalConfigValue by WriteOnce()
private var _ENERGY_PER_SWING_VARIANCE: DecimalConfigValue by WriteOnce()
private var _COBWEB_POWER_COST: DecimalConfigValue by WriteOnce()
private var _COBWEB_POWER_COST_VARIANCE: DecimalConfigValue by WriteOnce()
private var _PLANT_POWER_COST: DecimalConfigValue by WriteOnce()
private var _PLANT_POWER_COST_VARIANCE: DecimalConfigValue by WriteOnce()
fun registerConfig(builder: ModConfigSpec.Builder) {
builder.comment("Falling Sun values").push("FallingSun")
_MAX_ENERGY = builder.defineDecimal("MAX_ENERGY", Decimal(3_500_000), Decimal.ZERO)
_ENERGY_ZAP = builder.comment("Extra energy required when hitting androids").defineDecimal("ENERGY_ZAP", Decimal(4_000), Decimal.ZERO)
_ENERGY_ZAP_VARIANCE = builder.comment("Random deviation from ENERGY_ZAP").defineDecimal("ENERGY_ZAP_VARIANCE", Decimal(1200), Decimal.ZERO)
_ENERGY_PER_SWING = builder.defineDecimal("ENERGY_PER_SWING", Decimal(3_000), Decimal.ZERO)
_ENERGY_PER_SWING_VARIANCE = builder.comment("Random deviation from ENERGY_PER_SWING").defineDecimal("ENERGY_PER_SWING_VARIANCE", Decimal(600), Decimal.ZERO)
_COBWEB_POWER_COST = builder.defineDecimal("COBWEB_POWER_COST", Decimal(2_500), Decimal.ZERO)
_COBWEB_POWER_COST_VARIANCE = builder.comment("Random deviation from COBWEB_POWER_COST").defineDecimal("COBWEB_POWER_COST_VARIANCE", Decimal(500), Decimal.ZERO)
_PLANT_POWER_COST = builder.defineDecimal("PLANT_POWER_COST", Decimal(500), Decimal.ZERO)
_PLANT_POWER_COST_VARIANCE = builder.comment("Random deviation from PLANT_POWER_COST").defineDecimal("PLANT_POWER_COST_VARIANCE", Decimal(100), Decimal.ZERO)
builder.pop()
}
}
}

View File

@ -194,10 +194,12 @@ object MNames {
const val TRITANIUM_SHIELD = "tritanium_shield"
const val ENERGY_SWORD = "energy_sword"
const val FALLING_SUN = "falling_sun"
const val PLASMA_RIFLE = "plasma_rifle"
const val CHEST_UPGRADER = "chest_upgrader"
const val CONFIGURATOR = "configurator"
const val WITHERED_STEEL_SWORD = "withered_steel_sword"
@ -230,6 +232,7 @@ object MNames {
const val MIRROR_COMPOUND = "mirror_compound"
const val MIRROR = "mirror"
const val BLANK_MACHINE_UPGRADE = "blank_machine_upgrade"
const val DISPLAY_SCREEN = "display_screen"
const val ENERGY_BUS = "energy_bus"

View File

@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos
import net.minecraft.core.cauldron.CauldronInteraction
import net.minecraft.core.component.DataComponents
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.nbt.CompoundTag
import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item
@ -42,6 +43,8 @@ import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.isClient
import ru.dbotthepony.mc.otm.item.armor.TritaniumArmorItem
import ru.dbotthepony.mc.otm.item.weapon.EnergySwordItem
import ru.dbotthepony.mc.otm.item.weapon.FallingSunItem
import ru.dbotthepony.mc.otm.registry.game.MDataComponentTypes
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.game.MStats
import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock
@ -284,6 +287,14 @@ object MRegistry : IBlockItemRegistryAcceptor {
}
}
ItemProperties.register(MItems.FALLING_SUN, ResourceLocation(OverdriveThatMatters.MOD_ID, "is_powered")) { stack, _, _, _ ->
if ((stack.matteryEnergy?.batteryLevel ?: Decimal.ZERO) >= FallingSunItem.ENERGY_PER_SWING) {
1f
} else {
0f
}
}
ItemProperties.register(MItems.EXPLOSIVE_HAMMER, ResourceLocation(OverdriveThatMatters.MOD_ID, "is_primed")) { stack, level, entity, _ ->
if (MItems.EXPLOSIVE_HAMMER.isPrimed(stack) || entity == null) {
1f
@ -307,6 +318,11 @@ object MRegistry : IBlockItemRegistryAcceptor {
}
}
}
ItemProperties.register(MItems.CONFIGURATOR, ResourceLocation(OverdriveThatMatters.MOD_ID, "has_configuration_saved")) { stack, _, _, _ ->
val tag = stack.getOrDefault(MDataComponentTypes.Configurator.CONFIGURATION, CompoundTag())
if (tag.isEmpty) 0f else 1f
}
}
}

View File

@ -263,6 +263,7 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
accept(MItems.GRAVITATIONAL_DISRUPTOR)
accept(MItems.CHEST_UPGRADER)
accept(MItems.CONFIGURATOR)
accept(MItems.ESSENCE_SERVO)

View File

@ -5,9 +5,11 @@ import com.mojang.serialization.Codec
import net.minecraft.core.UUIDUtil
import net.minecraft.core.component.DataComponentType
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.nbt.CompoundTag
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.network.codec.StreamCodec
import net.minecraft.util.StringRepresentable
import net.minecraft.world.level.block.state.BlockState
import net.neoforged.bus.api.IEventBus
import net.neoforged.neoforge.fluids.SimpleFluidContent
import ru.dbotthepony.mc.otm.capability.FlowDirection
@ -17,6 +19,7 @@ import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.data.codec.DecimalCodec
import ru.dbotthepony.mc.otm.item.tool.RedstoneInteractorItem
import ru.dbotthepony.mc.otm.network.StreamCodecs
import ru.dbotthepony.mc.otm.network.streamCodec
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
import java.util.UUID
@ -34,6 +37,16 @@ object MDataComponentTypes {
}
}
private class CompoundTagComponent : DataComponentType<CompoundTag> {
override fun codec(): Codec<CompoundTag> {
return CompoundTag.CODEC
}
override fun streamCodec(): StreamCodec<in RegistryFriendlyByteBuf, CompoundTag> {
return CompoundTag.CODEC.streamCodec()
}
}
val FLUID_STACK by registry.register("fluid_stack") {
object : DataComponentType<SimpleFluidContent> {
override fun codec(): Codec<SimpleFluidContent> {
@ -81,6 +94,26 @@ object MDataComponentTypes {
}
}
object Configurator {
val BLOCK: DataComponentType<BlockState> by registry.register("configurator_block") {
object : DataComponentType<BlockState> {
override fun codec(): Codec<BlockState?>? {
return BlockState.CODEC
}
override fun streamCodec(): StreamCodec<in RegistryFriendlyByteBuf, BlockState?> {
return BlockState.CODEC.streamCodec()
}
}
}
val CONFIGURATION: DataComponentType<CompoundTag> by registry.register("configurator_configuration") { CompoundTagComponent() }
}
init {
Configurator
}
fun register(bus: IEventBus) {
registry.register(bus)
}

View File

@ -43,6 +43,7 @@ import ru.dbotthepony.mc.otm.core.collect.SupplierMap
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.ConfiguratorItem
import ru.dbotthepony.mc.otm.item.CrudeBatteryItem
import ru.dbotthepony.mc.otm.item.EssenceServoItem
import ru.dbotthepony.mc.otm.item.FluidCapsuleItem
@ -72,6 +73,7 @@ import ru.dbotthepony.mc.otm.item.tool.ExplosiveHammerItem
import ru.dbotthepony.mc.otm.item.tool.MatteryAxeItem
import ru.dbotthepony.mc.otm.item.tool.RedstoneInteractorItem
import ru.dbotthepony.mc.otm.item.weapon.EnergySwordItem
import ru.dbotthepony.mc.otm.item.weapon.FallingSunItem
import ru.dbotthepony.mc.otm.item.weapon.WitheredSteelSwordItem
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
import ru.dbotthepony.mc.otm.registry.MItemTags
@ -407,6 +409,7 @@ object MItems {
val EXPLOSIVE_HAMMER: ExplosiveHammerItem by registry.register("explosive_hammer") { ExplosiveHammerItem() }
val ENERGY_SWORD: Item by registry.register(MNames.ENERGY_SWORD) { EnergySwordItem() }
val FALLING_SUN: Item by registry.register(MNames.FALLING_SUN) { FallingSunItem() }
val WITHERED_STEEL_SWORD: Item by registry.register(MNames.WITHERED_STEEL_SWORD) { WitheredSteelSwordItem(Item.Properties().durability(420)) }
@ -557,6 +560,7 @@ object MItems {
val ELECTROMOTOR: Item by registry.register(MNames.ELECTROMOTOR) { Item(DEFAULT_PROPERTIES) }
val MIRROR_COMPOUND: Item by registry.register(MNames.MIRROR_COMPOUND) { Item(DEFAULT_PROPERTIES) }
val MIRROR: Item by registry.register(MNames.MIRROR) { MatteryItem(DEFAULT_PROPERTIES).addSimpleDescription() }
val DISPLAY_SCREEN: Item by registry.register(MNames.DISPLAY_SCREEN) { Item(DEFAULT_PROPERTIES) }
/**
* List of components for everything else
@ -586,6 +590,7 @@ object MItems {
MItems::ELECTROMOTOR,
MItems::MIRROR_COMPOUND,
MItems::MIRROR,
MItems::DISPLAY_SCREEN,
MItems::CARBON_MESH,
MItems::ARMOR_ASSEMBLY,
@ -621,6 +626,7 @@ object MItems {
MItems::ELECTROMOTOR,
MItems::MIRROR_COMPOUND,
MItems::MIRROR,
MItems::DISPLAY_SCREEN,
MItems::CARBON_MESH,
MItems::ARMOR_ASSEMBLY,
@ -672,6 +678,8 @@ object MItems {
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) }
val CONFIGURATOR: Item by registry.register(MNames.CONFIGURATOR) { ConfiguratorItem() }
init {
MRegistry.registerItems(registry)
}

View File

@ -0,0 +1,9 @@
package ru.dbotthepony.mc.otm.server
import net.minecraft.network.chat.Component
import net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket
import net.minecraft.server.level.ServerPlayer
fun ServerPlayer.sendActionBarMessage(component: Component) {
this.connection.send(ClientboundSetActionBarTextPacket(component))
}

View File

@ -0,0 +1,22 @@
{
"loader": "neoforge:separate_transforms",
"gui_light": "front",
"base":
{
"parent": "overdrive_that_matters:item/falling_sun_unpowered"
},
"perspectives": {
"gui": {
"parent": "overdrive_that_matters:item/falling_sun_inventory"
},
"fixed": {
"parent": "overdrive_that_matters:item/falling_sun_inventory"
},
"ground": {
"parent": "overdrive_that_matters:item/falling_sun_inventory"
}
},
"overrides": [
{ "predicate": { "overdrive_that_matters:is_powered": 1.0 }, "model": "overdrive_that_matters:item/falling_sun_powered" }
]
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "overdrive_that_matters:item/falling_sun_icon"
}
}

View File

@ -0,0 +1,241 @@
{
"loader": "neoforge:separate_transforms",
"gui_light": "front",
"base":
{
"texture_size": [32, 32],
"textures": {
"0": "overdrive_that_matters:item/falling_sun",
"1": "overdrive_that_matters:item/falling_sun_charge",
"particle": "overdrive_that_matters:item/falling_sun"
},
"elements": [
{
"name": "frame",
"from": [7.999, 8, 9.6],
"to": [8.002, 22, 11.6],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 11, 10.6]},
"faces": {
"east": {"uv": [11.5, 0, 10.5, 7], "texture": "#0"},
"west": {"uv": [10.5, 0, 11.5, 7], "texture": "#0"}
}
},
{
"name": "frame",
"from": [8, 22, 9.6],
"to": [8, 29, 11.6],
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 22, 9.6]},
"faces": {
"east": {"uv": [12.5, 0, 11.5, 3.5], "texture": "#0"},
"west": {"uv": [11.5, 0, 12.5, 3.5], "texture": "#0"}
}
},
{
"name": "cap",
"from": [7.4, 6, 7.6],
"to": [8.6, 11, 9.6],
"rotation": {"angle": 0, "axis": "y", "origin": [6.5, 7, 7.6]},
"faces": {
"north": {"uv": [7.5, 4, 8, 6.5], "texture": "#0"},
"east": {"uv": [9, 4, 8, 6.5], "texture": "#0"},
"south": {"uv": [9, 4, 9.5, 6.5], "texture": "#0"},
"west": {"uv": [8, 4, 9, 6.5], "texture": "#0"},
"up": {"uv": [8, 3.5, 9, 4], "rotation": 90, "texture": "#0"}
}
},
{
"name": "handle",
"from": [7, -5, 4],
"to": [9, -4, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7, -5, 7]},
"faces": {
"north": {"uv": [8, 10, 9, 10.5], "texture": "#0"},
"east": {"uv": [7.5, 7, 8, 10], "rotation": 270, "texture": "#0"},
"south": {"uv": [8, 6.5, 9, 7], "texture": "#0"},
"west": {"uv": [7.5, 7, 8, 10], "rotation": 90, "texture": "#0"},
"up": {"uv": [8, 7, 9, 10], "rotation": 180, "texture": "#0"},
"down": {"uv": [9, 7, 10, 10], "texture": "#0"}
}
},
{
"name": "handle",
"from": [8, -4, 4.6],
"to": [8, 3, 7.6],
"rotation": {"angle": 0, "axis": "y", "origin": [6, -3, 5.6]},
"faces": {
"east": {"uv": [9, 0, 10.5, 3.5], "texture": "#0"},
"west": {"uv": [10.5, 0, 9, 3.5], "texture": "#0"}
}
},
{
"name": "handle",
"from": [7.5, -4, 7.2],
"to": [8.5, 3, 9.2],
"rotation": {"angle": 0, "axis": "y", "origin": [6.5, -3, 7.2]},
"faces": {
"north": {"uv": [7, 0, 7.5, 3.5], "texture": "#0"},
"east": {"uv": [8.5, 0, 7.5, 3.5], "texture": "#0"},
"south": {"uv": [8.5, 0, 9, 3.5], "texture": "#0"},
"west": {"uv": [7.5, 0, 8.5, 3.5], "texture": "#0"}
}
},
{
"name": "guard",
"from": [6.5, 5, 4],
"to": [9.5, 6, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7.5, 5, 7]},
"faces": {
"north": {"uv": [4, 8, 5.5, 8.5], "texture": "#0"},
"east": {"uv": [3.5, 5, 4, 8], "rotation": 270, "texture": "#0"},
"south": {"uv": [4, 4.5, 5.5, 5], "rotation": 180, "texture": "#0"},
"west": {"uv": [5.5, 5, 6, 8], "rotation": 90, "texture": "#0"},
"up": {"uv": [4, 5, 5.5, 8], "rotation": 180, "texture": "#0"},
"down": {"uv": [6, 5, 7.5, 8], "texture": "#0"}
}
},
{
"name": "guard",
"from": [6.5, 3, 4],
"to": [9.5, 4, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7.5, 3, 7]},
"faces": {
"north": {"uv": [4, 8, 5.5, 8.5], "texture": "#0"},
"east": {"uv": [3.5, 5, 4, 8], "rotation": 270, "texture": "#0"},
"south": {"uv": [4, 4.5, 5.5, 5], "rotation": 180, "texture": "#0"},
"west": {"uv": [5.5, 5, 6, 8], "rotation": 90, "texture": "#0"},
"up": {"uv": [4, 5, 5.5, 8], "rotation": 180, "texture": "#0"},
"down": {"uv": [6, 5, 7.5, 8], "texture": "#0"}
}
},
{
"name": "blade",
"from": [7.5, 4, 4.5],
"to": [8.5, 22, 9.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7.5, 6, 5.5]},
"faces": {
"north": {"uv": [0, 0.5, 0.5, 9.5], "texture": "#0"},
"east": {"uv": [3, 0.5, 0.5, 9.5], "texture": "#0"},
"south": {"uv": [3, 0.5, 3.5, 9.5], "texture": "#0"},
"west": {"uv": [0.5, 0.5, 3, 9.5], "texture": "#0"},
"up": {"uv": [0.5, 0, 3, 0.5], "rotation": 90, "texture": "#0"}
}
},
{
"name": "blade",
"from": [7.501, 22.001, 4.501],
"to": [8.499, 29.999, 9.499],
"rotation": {"angle": 22.5, "axis": "x", "origin": [7.5, 22, 4.5]},
"faces": {
"north": {"uv": [3.5, 0.5, 4, 4.5], "texture": "#0"},
"east": {"uv": [6.5, 0.5, 4, 4.5], "texture": "#0"},
"south": {"uv": [6.5, 0.5, 7, 4.5], "texture": "#0"},
"west": {"uv": [4, 0.5, 6.5, 4.5], "texture": "#0"},
"up": {"uv": [4, 0, 6.5, 0.5], "rotation": 90, "texture": "#0"}
}
},
{
"from": [7.501, 26.801, 8.601],
"to": [8.499, 25.799, 9.699],
"rotation": {"angle": 22.5, "axis": "x", "origin": [7.5, 26.8, 8.6]},
"faces": {
"north": {"uv": [4.5, 1.5, 5, 2], "texture": "#0"},
"south": {"uv": [5.5, 1.5, 6, 2], "texture": "#0"},
"up": {"uv": [5, 2, 5.5, 2.5], "rotation": 90, "texture": "#0"},
"down": {"uv": [5, 1, 5.5, 1.5], "texture": "#0"}
}
},
{
"name": "charge",
"from": [7.6, 6, 3.8],
"to": [8.4, 22, 10.2],
"rotation": {"angle": 0, "axis": "y", "origin": [6.5, 12, 4]},
"faces": {
"north": {"uv": [4, 4, 4.5, 12], "texture": "#1"},
"east": {"uv": [1, 4, 4, 12], "texture": "#1"},
"south": {"uv": [7.5, 4, 8, 12], "texture": "#1"},
"west": {"uv": [4.5, 4, 7.5, 12], "texture": "#1"}
}
},
{
"name": "charge",
"from": [7.6, 21.9, 3.8],
"to": [8.4, 30.8, 10.2],
"rotation": {"angle": 22.5, "axis": "x", "origin": [6.5, 22, 4]},
"faces": {
"north": {"uv": [4, 2.5, 4.5, 5], "texture": "#1"},
"east": {"uv": [1, 2.5, 4, 5], "texture": "#1"},
"south": {"uv": [7.5, 2.5, 8, 5], "texture": "#1"},
"west": {"uv": [4.5, 2.5, 7.5, 5], "texture": "#1"},
"up": {"uv": [3.5, 0.5, 6, 1], "rotation": 90, "texture": "#1"}
}
},
{
"name": "battery",
"from": [7.5, 7, 9.6],
"to": [8.5, 8, 11.6],
"rotation": {"angle": -22.5, "axis": "x", "origin": [7.5, 7, 9.6]},
"faces": {
"east": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 270, "texture": "#0"},
"south": {"uv": [12.5, 0, 13, 0.5], "texture": "#0"},
"west": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 90, "texture": "#0"},
"up": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 180, "texture": "#0"},
"down": {"uv": [12.5, 0.5, 13, 1.5], "texture": "#0"}
}
},
{
"name": "battery",
"from": [7.5, 9, 9.6],
"to": [8.5, 10, 11.6],
"rotation": {"angle": -22.5, "axis": "x", "origin": [7.5, 9, 9.6]},
"faces": {
"east": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 270, "texture": "#0"},
"south": {"uv": [12.5, 0, 13, 0.5], "texture": "#0"},
"west": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 90, "texture": "#0"},
"up": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 180, "texture": "#0"},
"down": {"uv": [12.5, 0.5, 13, 1.5], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [0, 5.75, 1.25]
},
"thirdperson_lefthand": {
"translation": [0, 5.75, 1.25]
},
"firstperson_righthand": {
"rotation": [-35, 0, 0],
"translation": [1.5, 1.5, -3.5]
},
"firstperson_lefthand": {
"rotation": [-35, 0, 0],
"translation": [1.5, 0, -3.5]
},
"ground": {
"rotation": [-60, 0, 0],
"translation": [0, 2, 0],
"scale": [0.5, 0.5, 0.5]
},
"gui": {
"rotation": [0, 90, 0],
"translation": [0, -1.5, 0],
"scale": [0.5, 0.5, 0.5]
},
"head": {
"rotation": [-127, 0, 0],
"translation": [0, 12.25, 0]
}
}
},
"perspectives": {
"gui": {
"parent": "overdrive_that_matters:item/falling_sun_inventory"
},
"fixed": {
"parent": "overdrive_that_matters:item/falling_sun_inventory"
},
"ground": {
"parent": "overdrive_that_matters:item/falling_sun_inventory"
}
}
}

View File

@ -0,0 +1,200 @@
{
"credit": "Made with Blockbench",
"texture_size": [32, 32],
"textures": {
"0": "overdrive_that_matters:item/falling_sun",
"particle": "overdrive_that_matters:item/falling_sun"
},
"elements": [
{
"name": "frame",
"from": [7.999, 8, 9.6],
"to": [8.002, 22, 11.6],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 11, 10.6]},
"faces": {
"east": {"uv": [11.5, 0, 10.5, 7], "texture": "#0"},
"west": {"uv": [10.5, 0, 11.5, 7], "texture": "#0"}
}
},
{
"name": "frame",
"from": [8, 22, 9.6],
"to": [8, 29, 11.6],
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 22, 9.6]},
"faces": {
"east": {"uv": [12.5, 0, 11.5, 3.5], "texture": "#0"},
"west": {"uv": [11.5, 0, 12.5, 3.5], "texture": "#0"}
}
},
{
"name": "cap",
"from": [7.4, 6, 7.6],
"to": [8.6, 11, 9.6],
"rotation": {"angle": 0, "axis": "y", "origin": [6.5, 7, 7.6]},
"faces": {
"north": {"uv": [7.5, 4, 8, 6.5], "texture": "#0"},
"east": {"uv": [9, 4, 8, 6.5], "texture": "#0"},
"south": {"uv": [9, 4, 9.5, 6.5], "texture": "#0"},
"west": {"uv": [8, 4, 9, 6.5], "texture": "#0"},
"up": {"uv": [8, 3.5, 9, 4], "rotation": 90, "texture": "#0"}
}
},
{
"name": "handle",
"from": [7, -5, 4],
"to": [9, -4, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7, -5, 7]},
"faces": {
"north": {"uv": [8, 10, 9, 10.5], "texture": "#0"},
"east": {"uv": [7.5, 7, 8, 10], "rotation": 270, "texture": "#0"},
"south": {"uv": [8, 6.5, 9, 7], "texture": "#0"},
"west": {"uv": [7.5, 7, 8, 10], "rotation": 90, "texture": "#0"},
"up": {"uv": [8, 7, 9, 10], "rotation": 180, "texture": "#0"},
"down": {"uv": [9, 7, 10, 10], "texture": "#0"}
}
},
{
"name": "handle",
"from": [8, -4, 4.6],
"to": [8, 3, 7.6],
"rotation": {"angle": 0, "axis": "y", "origin": [6, -3, 5.6]},
"faces": {
"east": {"uv": [9, 0, 10.5, 3.5], "texture": "#0"},
"west": {"uv": [10.5, 0, 9, 3.5], "texture": "#0"}
}
},
{
"name": "handle",
"from": [7.5, -4, 7.2],
"to": [8.5, 3, 9.2],
"rotation": {"angle": 0, "axis": "y", "origin": [6.5, -3, 7.2]},
"faces": {
"north": {"uv": [7, 0, 7.5, 3.5], "texture": "#0"},
"east": {"uv": [8.5, 0, 7.5, 3.5], "texture": "#0"},
"south": {"uv": [8.5, 0, 9, 3.5], "texture": "#0"},
"west": {"uv": [7.5, 0, 8.5, 3.5], "texture": "#0"}
}
},
{
"name": "guard",
"from": [6.5, 5, 4],
"to": [9.5, 6, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7.5, 5, 7]},
"faces": {
"north": {"uv": [4, 8, 5.5, 8.5], "texture": "#0"},
"east": {"uv": [3.5, 5, 4, 8], "rotation": 270, "texture": "#0"},
"south": {"uv": [4, 4.5, 5.5, 5], "rotation": 180, "texture": "#0"},
"west": {"uv": [5.5, 5, 6, 8], "rotation": 90, "texture": "#0"},
"up": {"uv": [4, 5, 5.5, 8], "rotation": 180, "texture": "#0"},
"down": {"uv": [6, 5, 7.5, 8], "texture": "#0"}
}
},
{
"name": "guard",
"from": [6.5, 3, 4],
"to": [9.5, 4, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7.5, 3, 7]},
"faces": {
"north": {"uv": [4, 8, 5.5, 8.5], "texture": "#0"},
"east": {"uv": [3.5, 5, 4, 8], "rotation": 270, "texture": "#0"},
"south": {"uv": [4, 4.5, 5.5, 5], "rotation": 180, "texture": "#0"},
"west": {"uv": [5.5, 5, 6, 8], "rotation": 90, "texture": "#0"},
"up": {"uv": [4, 5, 5.5, 8], "rotation": 180, "texture": "#0"},
"down": {"uv": [6, 5, 7.5, 8], "texture": "#0"}
}
},
{
"name": "blade",
"from": [7.5, 4, 4.5],
"to": [8.5, 22, 9.5],
"rotation": {"angle": 0, "axis": "y", "origin": [7.5, 6, 5.5]},
"faces": {
"north": {"uv": [0, 0.5, 0.5, 9.5], "texture": "#0"},
"east": {"uv": [3, 0.5, 0.5, 9.5], "texture": "#0"},
"south": {"uv": [3, 0.5, 3.5, 9.5], "texture": "#0"},
"west": {"uv": [0.5, 0.5, 3, 9.5], "texture": "#0"},
"up": {"uv": [0.5, 0, 3, 0.5], "rotation": 90, "texture": "#0"}
}
},
{
"name": "blade",
"from": [7.501, 22.001, 4.501],
"to": [8.499, 29.999, 9.499],
"rotation": {"angle": 22.5, "axis": "x", "origin": [7.5, 22, 4.5]},
"faces": {
"north": {"uv": [3.5, 0.5, 4, 4.5], "texture": "#0"},
"east": {"uv": [6.5, 0.5, 4, 4.5], "texture": "#0"},
"south": {"uv": [6.5, 0.5, 7, 4.5], "texture": "#0"},
"west": {"uv": [4, 0.5, 6.5, 4.5], "texture": "#0"},
"up": {"uv": [4, 0, 6.5, 0.5], "rotation": 90, "texture": "#0"}
}
},
{
"from": [7.501, 26.801, 8.601],
"to": [8.499, 25.799, 9.699],
"rotation": {"angle": 22.5, "axis": "x", "origin": [7.5, 26.8, 8.6]},
"faces": {
"north": {"uv": [4.5, 1.5, 5, 2], "texture": "#0"},
"south": {"uv": [5.5, 1.5, 6, 2], "texture": "#0"},
"up": {"uv": [5, 2, 5.5, 2.5], "rotation": 90, "texture": "#0"},
"down": {"uv": [5, 1, 5.5, 1.5], "texture": "#0"}
}
},
{
"name": "battery",
"from": [7.5, 6.5, 8.6],
"to": [8.5, 7.5, 10.6],
"rotation": {"angle": -22.5, "axis": "x", "origin": [7.5, 6.5, 8.6]},
"faces": {
"east": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 270, "texture": "#0"},
"south": {"uv": [12.5, 0, 13, 0.5], "texture": "#0"},
"west": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 90, "texture": "#0"},
"up": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 180, "texture": "#0"},
"down": {"uv": [12.5, 0.5, 13, 1.5], "texture": "#0"}
}
},
{
"name": "battery",
"from": [7.5, 8.5, 8.6],
"to": [8.5, 9.5, 10.6],
"rotation": {"angle": -22.5, "axis": "x", "origin": [7.5, 8.5, 8.6]},
"faces": {
"east": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 270, "texture": "#0"},
"south": {"uv": [12.5, 0, 13, 0.5], "texture": "#0"},
"west": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 90, "texture": "#0"},
"up": {"uv": [12.5, 0.5, 13, 1.5], "rotation": 180, "texture": "#0"},
"down": {"uv": [12.5, 0.5, 13, 1.5], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [0, 5.75, 1.25]
},
"thirdperson_lefthand": {
"translation": [0, 5.75, 1.25]
},
"firstperson_righthand": {
"rotation": [-35, 0, 0],
"translation": [1.5, 1.5, -3.5]
},
"firstperson_lefthand": {
"rotation": [-35, 0, 0],
"translation": [1.5, 0, -3.5]
},
"ground": {
"rotation": [-60, 0, 0],
"translation": [0, 2, 0],
"scale": [0.5, 0.5, 0.5]
},
"gui": {
"rotation": [0, 90, 0],
"translation": [0, -1.5, 0],
"scale": [0.5, 0.5, 0.5]
},
"head": {
"rotation": [-127, 0, 0],
"translation": [0, 12.25, 0]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1 @@
{ "animation": { "frametime": 1 } }

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

View File

@ -0,0 +1,40 @@
{
"attributes": {
"range_bonus": 0.25,
"two_handed": true,
"pose": "bettercombat:pose_two_handed_katana",
"category": "claymore",
"attacks": [
{
"hitbox": "HORIZONTAL_PLANE",
"damage_multiplier": 0.75,
"angle": 120,
"upswing": 0.5,
"animation": "bettercombat:two_handed_slash_horizontal_right",
"swing_sound": {
"id": "bettercombat:scythe_slash"
}
},
{
"hitbox": "HORIZONTAL_PLANE",
"damage_multiplier": 0.75,
"angle": 120,
"upswing": 0.5,
"animation": "bettercombat:two_handed_slash_horizontal_left",
"swing_sound": {
"id": "bettercombat:scythe_slash"
}
},
{
"hitbox": "VERTICAL_PLANE",
"damage_multiplier": 1,
"angle": 120,
"upswing": 0.8,
"animation": "bettercombat:two_handed_slash_vertical_right",
"swing_sound": {
"id": "bettercombat:scythe_slash"
}
}
]
}
}