Skip to content

Commit

Permalink
Merge pull request #40 from HollowHorizon/1.19.2-s
Browse files Browse the repository at this point in the history
Seats (need fix), translation and scripting update
  • Loading branch information
HollowHorizon authored Jul 31, 2024
2 parents 3a45723 + 22b468f commit 8604ec8
Show file tree
Hide file tree
Showing 77 changed files with 749 additions and 4,144 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.1
1.6.2a
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.time.format.DateTimeFormatter

plugins {
id("com.modrinth.minotaur") version "2.+"
id("net.minecraftforge.gradle") version "6.0.25"
id("net.minecraftforge.gradle") version "[6.0,6.2)"
id("org.parchmentmc.librarian.forgegradle") version "1.+"
id("org.spongepowered.mixin") version "0.7.38"
kotlin("jvm") version "1.9.23"
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ kotlin.incremental=true
bookshelfVersion=16.3.20
stagesVersion=11.1.5
mcVersion=1.19.2
forgeVersion=43.4.2
modVersion=1.6.1
forgeVersion=43.3.7
modVersion=1.6.2a
mappingsVersion=2022.11.27
hcVersion=1.6.3
kffVersion=3.12.0
ksffVersion=1.3
ksffVersion=1.4
Binary file not shown.
Binary file renamed hc/kotlinscript-1.3.jar → hc/kotlinscript-1.4.jar
Binary file not shown.
13 changes: 0 additions & 13 deletions settings.gradle

This file was deleted.

13 changes: 13 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://maven.minecraftforge.net/")
maven("https://maven.parchmentmc.org")
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
}

rootProject.name = "HollowEngine"
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ import ru.hollowhorizon.hc.client.utils.get
import ru.hollowhorizon.hc.client.utils.mcTranslate
import ru.hollowhorizon.hc.client.utils.open
import ru.hollowhorizon.hollowengine.HollowEngine
import ru.hollowhorizon.hollowengine.HollowEngine.Companion.MODID
import ru.hollowhorizon.hollowengine.client.gui.height
import ru.hollowhorizon.hollowengine.client.gui.scripting.CodeEditor
import ru.hollowhorizon.hollowengine.client.gui.scripting.CodeEditorGui
import ru.hollowhorizon.hollowengine.client.gui.width
import ru.hollowhorizon.hollowengine.client.render.PlayerRenderer
Expand All @@ -70,13 +72,12 @@ object ClientEvents {
var ignoreOptifine = false
private val customTooltips = HashMap<Item, MutableList<Component>>()

private fun keyBindName(name: String) = "key.${HollowEngine.MODID}.$name"
private fun keyBindName(name: String) = "key.$MODID.$name"

fun addTooltip(item: Item, tooltip: Component) {
customTooltips.computeIfAbsent(item) { ArrayList() }.add(tooltip)
}


fun resetClientScripting() {
customTooltips.clear()
}
Expand All @@ -88,17 +89,17 @@ object ClientEvents {
ImGui.getBackgroundDrawList()
.addRectFilled(0f, 0f, width, height, ImGui.colorConvertFloat4ToU32(0f, 0f, 0f, 1f))
ImGui.begin(
"Предупреждение",
"codeEditor.$MODID.warning".translate,
ImGuiWindowFlags.NoMove or ImGuiWindowFlags.NoCollapse or ImGuiWindowFlags.AlwaysAutoResize
)
ImGui.setWindowPos(width / 2 - ImGui.getWindowSizeX() / 2, height / 2 - ImGui.getWindowSizeY() / 2)
ImGui.textWrapped("Внимание, HollowEngine не совместим с OptiFine, рекомендуем использовать вместо него моды Embeddium и Oculus!")
if (ImGui.button("Мне и с OptiFine норм")) {
ImGui.textWrapped("codeEditor.$MODID.optifine.warning".translate)
if (ImGui.button("codeEditor.$MODID.optifine.continue".translate)) {
ignoreOptifine = true
Minecraft.getInstance().screen?.onClose()
}
ImGui.sameLine()
if (ImGui.button("Ладно, сейчас установлю")) Minecraft.getInstance().stop()
if (ImGui.button("codeEditor.$MODID.optifine.close".translate)) Minecraft.getInstance().stop()
ImGui.end()
}
}
Expand Down Expand Up @@ -148,7 +149,6 @@ object ClientEvents {
CodeEditorGui().open()
}


if (TOGGLE_RECORDING.isActiveAndMatches(key) && event.action == 0) {
val player = Minecraft.getInstance().player ?: return
if (!player.hasPermissions(2)) player.sendSystemMessage("hollowengine.no_permissions".mcTranslate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import kotlin.math.sin
import kotlin.math.sqrt
import kotlin.math.tan


const val URL = "https://github.com/CedricGuillemet/ImGuizmo/tree/f7bbbe"

private const val CAM_DISTANCE = 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ import ru.hollowhorizon.hc.client.utils.get
import ru.hollowhorizon.hc.client.utils.open
import ru.hollowhorizon.hc.client.utils.rl
import ru.hollowhorizon.hc.client.utils.toTexture
import ru.hollowhorizon.hollowengine.HollowEngine.Companion.MODID
import ru.hollowhorizon.hollowengine.client.gui.npcs.ScriptNodeEditor
import ru.hollowhorizon.hollowengine.client.translate
import ru.hollowhorizon.hollowengine.common.entities.NPCEntity
import ru.hollowhorizon.hollowengine.common.npcs.NPCCapability

Expand All @@ -45,7 +47,7 @@ class NPCToolGui(val npc: NPCEntity) : HollowScreen() {
val window = Minecraft.getInstance().window
ImGui.setNextWindowSize(window.width * 0.9f, window.height * 0.9f)
centredWindow {
if (imageButton("wrench", "Настройка персонажа")) {
if (imageButton("wrench", "npctool.$MODID.npc.setting".translate)) {
NPCCreatorGui(npc, npc.id).open()
}
//sameLine()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import imgui.type.ImInt
import net.minecraft.locale.Language
import net.minecraft.resources.ResourceLocation
import ru.hollowhorizon.hc.client.imgui.FontAwesomeIcons
import ru.hollowhorizon.hollowengine.HollowEngine.Companion.MODID
import ru.hollowhorizon.hollowengine.client.translate
import ru.hollowhorizon.hollowengine.common.npcs.CURRENT_GRAPH
import ru.hollowhorizon.hollowengine.common.npcs.ScriptGraph
import ru.hollowhorizon.hollowengine.common.npcs.connections.Connection
Expand Down Expand Up @@ -142,7 +144,7 @@ object NodeEditor {
if (ImGui.isItemHovered()) {
ImGui.beginTooltip()
val pattern = "nodes.${node.type.namespace}.${node.type.path.replace('/', '.')}.desc"
val desc = if (languageManager.has(pattern)) languageManager.getOrDefault(pattern) else "Описания нет."
val desc = if (languageManager.has(pattern)) languageManager.getOrDefault(pattern) else "nodes.$MODID.no_desc".translate + "."
ImGui.textColored(ImGui.colorConvertFloat4ToU32(1f, 0.84313726f, 0f, 1f), desc)
ImGui.endTooltip()
}
Expand Down Expand Up @@ -213,7 +215,7 @@ object NodeEditor {
val node = nodeMap.entries.find { it.value == targetNode }?.key
if (node != null && ImGui.beginPopup("node_context")) {
if (ImGui.button(
"Удалить ($targetNode) " + languageManager.getOrDefault(
"${"codeEditor.hollowengine.delete".translate} ($targetNode) " + languageManager.getOrDefault(
"nodes.${node.type.namespace}.${
node.type.path.replace(
'/',
Expand Down Expand Up @@ -241,7 +243,7 @@ object NodeEditor {
val targetLink = ImGui.getStateStorage().getInt(ImGui.getID("delete_link_id"))
val node = nodeMap.entries.find { it.value == targetLink }?.key
if (node != null && ImGui.beginPopup("link_context")) {
if (ImGui.button("Удалить соединение")) {
if (ImGui.button("nodes.$MODID.unlink")) {
graph.connections.removeAt(targetLink - 1)
ImGui.closeCurrentPopup()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import imgui.extension.nodeditor.flag.NodeEditorPinKind
import imgui.type.ImLong
import net.minecraft.locale.Language
import ru.hollowhorizon.hc.client.imgui.FontAwesomeIcons
import ru.hollowhorizon.hollowengine.HollowEngine.Companion.MODID
import ru.hollowhorizon.hollowengine.client.translate
import ru.hollowhorizon.hollowengine.common.npcs.CURRENT_GRAPH
import ru.hollowhorizon.hollowengine.common.npcs.ScriptGraph
import ru.hollowhorizon.hollowengine.common.npcs.connections.Connection
Expand All @@ -41,7 +43,6 @@ import ru.hollowhorizon.hollowengine.common.npcs.nodes.pins.isConnected
import ru.hollowhorizon.hollowengine.common.registry.NodesRegistry
import kotlin.math.max


object NodeEditorV2 {
val config = NodeEditorConfig().apply {
settingsFile = "hollowengine/nodes.json"
Expand Down Expand Up @@ -71,7 +72,7 @@ object NodeEditorV2 {
if (ImGui.isItemHovered()) tooltip = {
ImGui.beginTooltip()
val pattern = "nodes.${node.type.namespace}.${node.type.path.replace('/', '.')}.desc"
val desc = if (languageManager.has(pattern)) languageManager.getOrDefault(pattern) else "Описания нет."
val desc = if (languageManager.has(pattern)) languageManager.getOrDefault(pattern) else "nodes.$MODID.no_desc". translate + "."
ImGui.textColored(ImGui.colorConvertFloat4ToU32(1f, 0.84313726f, 0f, 1f), desc)
ImGui.endTooltip()
}
Expand Down Expand Up @@ -209,7 +210,7 @@ object NodeEditorV2 {
val targetLink = ImGui.getStateStorage().getInt(ImGui.getID("delete_link_id"))
val node = nodeMap.entries.find { it.value == targetLink }?.key
if (node != null && ImGui.beginPopup("link_context")) {
if (ImGui.button("Удалить соединение")) {
if (ImGui.button("nodes.$MODID.unlink")) {
graph.connections.removeAt(targetLink - 1)
ImGui.closeCurrentPopup()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.resources.sounds.SimpleSoundInstance
import net.minecraft.client.resources.sounds.SoundInstance
import net.minecraft.resources.ResourceLocation
import net.minecraft.sounds.SoundEvents
import net.minecraft.sounds.SoundSource
import net.minecraft.world.entity.LivingEntity
import ru.hollowhorizon.hc.client.imgui.ImGuiMethods
Expand Down Expand Up @@ -152,7 +151,7 @@ object SonharDialogueGui : HollowScreen() {
): Boolean {
ImGui.pushStyleVar(ImGuiStyleVar.ItemSpacing, 0f, 0f)

val cursorPos = ImGui.getCursorScreenPos()
val cursorPos = ImGui.getCursorPos()

var height = if (label.length > 30) height * 1.5f else height
var image =
Expand All @@ -162,11 +161,12 @@ object SonharDialogueGui : HollowScreen() {
image =
if (label.length > 60) "${image.namespace}:${image.path.substringBeforeLast("_medium.png")}_large.png".rl else image


ImGui.invisibleButton("##$label", width, height)
val hovered = ImGui.isItemHovered()
val pressed = ImGui.isItemClicked()

ImGui.setCursorScreenPos(cursorPos.x, cursorPos.y)
ImGui.setCursorPos(cursorPos.x, cursorPos.y)
if (horizontal) {
ImGuiMethods.image(
image, width, height, width * 2, height,
Expand All @@ -181,34 +181,18 @@ object SonharDialogueGui : HollowScreen() {
)
}
val textSize = ImGui.calcTextSize(label, false, 140f * scale)
if (label.length > 30) textSize.set(width - 40, textSize.y)
ImGui.setCursorPos(cursorPos.x + width / 2 - textSize.x / 2, cursorPos.y + 8f)

if (label.isNotEmpty()) {
ImGui.getWindowDrawList()
.addText(
ImGui.getFont(),
ImGui.getFontSize().toFloat(),
cursorPos.x + width / 2 - textSize.x / 2,
cursorPos.y + 8f,
ImGui.colorConvertFloat4ToU32(0f, 0f, 0f, 1f),
label,
150* scale
)
val old = ImGui.getStyle().getColor(ImGuiCol.Text)
ImGui.getStyle().setColor(ImGuiCol.Text, 0f, 0f, 0f, 1f)
ImGui.textWrapped(label)
ImGui.getStyle().setColor(ImGuiCol.Text, old.x, old.y, old.z, old.w)
}
ImGui.popStyleVar()

if(pressed) {
Minecraft.getInstance().soundManager.play(
SimpleSoundInstance(
SoundEvents.UI_BUTTON_CLICK,
SoundSource.MASTER,
1.0f,
1.0f,
Minecraft.getInstance().player!!.random,
Minecraft.getInstance().player!!.blockPosition()
)
)
}
ImGui.setCursorPos(cursorPos.x, cursorPos.y + height)

ImGui.popStyleVar()

return pressed
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ import imgui.flag.ImGuiStyleVar
import imgui.flag.ImGuiWindowFlags
import kotlinx.serialization.Serializable
import net.minecraft.client.Minecraft
import net.minecraft.commands.Commands
import net.minecraft.nbt.CompoundTag
import net.minecraft.world.entity.player.Player
import ru.hollowhorizon.hc.client.imgui.ImGuiMethods.centredWindow
import ru.hollowhorizon.hc.client.imgui.ImguiHandler
import ru.hollowhorizon.hc.client.screens.HollowScreen
import ru.hollowhorizon.hc.client.utils.get
import ru.hollowhorizon.hc.client.utils.mcText
import ru.hollowhorizon.hc.client.utils.mcTranslate
import ru.hollowhorizon.hc.client.utils.nbt.ForCompoundNBT
import ru.hollowhorizon.hc.common.network.HollowPacketV2
import ru.hollowhorizon.hc.common.network.HollowPacketV3
import ru.hollowhorizon.hollowengine.HollowEngine.Companion.MODID
import ru.hollowhorizon.hollowengine.client.gui.NodeEditor
import ru.hollowhorizon.hollowengine.client.gui.NodeEditorV2
import ru.hollowhorizon.hollowengine.common.entities.NPCEntity
Expand Down Expand Up @@ -82,8 +84,8 @@ class ScriptNodeEditor(val npc: NPCEntity) : HollowScreen() {
class SaveNodesPacket(val graph: @Serializable(ForCompoundNBT::class) CompoundTag, val npcId: Int) :
HollowPacketV3<SaveNodesPacket> {
override fun handle(player: Player, data: SaveNodesPacket) {
if (!player.hasPermissions(2)) {
player.sendSystemMessage("У вас нет прав на редактирование скриптов!".mcText)
if (!player.hasPermissions(Commands.LEVEL_GAMEMASTERS)) {
player.sendSystemMessage("error.$MODID.no_permission".mcTranslate)
}
val npc = player.level.getEntity(npcId) as? NPCEntity ?: return
val graph = ScriptGraph()
Expand Down
Loading

0 comments on commit 8604ec8

Please sign in to comment.