mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-10-20 22:42:28 +00:00
Merge branch 'mc-1.20.x' into mc-1.21.x
This commit is contained in:
+2
-1
@@ -18,7 +18,8 @@ plugins {
|
||||
|
||||
val isUnstable = project.properties["isUnstable"] == "true"
|
||||
val modVersion: String by extra
|
||||
val mcVersion: String by extra
|
||||
val mcVersion = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||
.findVersion("minecraft").get().toString()
|
||||
|
||||
githubRelease {
|
||||
token(findProperty("githubApiKey") as String? ?: "")
|
||||
|
||||
@@ -17,8 +17,6 @@ plugins {
|
||||
|
||||
plugins.apply(CCTweakedPlugin::class.java)
|
||||
|
||||
val mcVersion: String by extra
|
||||
|
||||
repositories {
|
||||
maven("https://maven.parchmentmc.org/") {
|
||||
name = "Parchment"
|
||||
@@ -42,7 +40,7 @@ extensions.configure(CCTweakedExtension::class.java) {
|
||||
dependencies {
|
||||
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||
|
||||
minecraft("com.mojang:minecraft:$mcVersion")
|
||||
minecraft("com.mojang:minecraft:${libs.findVersion("minecraft").get()}")
|
||||
mappings(
|
||||
loom.layered {
|
||||
officialMojangMappings()
|
||||
|
||||
@@ -15,8 +15,6 @@ plugins {
|
||||
|
||||
plugins.apply(CCTweakedPlugin::class.java)
|
||||
|
||||
val mcVersion: String by extra
|
||||
|
||||
neoForge {
|
||||
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||
version = libs.findVersion("neoForge").get().toString()
|
||||
|
||||
@@ -22,12 +22,12 @@ plugins {
|
||||
}
|
||||
|
||||
val modVersion: String by extra
|
||||
val mcVersion: String by extra
|
||||
|
||||
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||
|
||||
group = "cc.tweaked"
|
||||
version = modVersion
|
||||
|
||||
base.archivesName.convention("cc-tweaked-$mcVersion-${project.name}")
|
||||
base.archivesName.set("cc-tweaked-${libs.findVersion("minecraft").get()}-${project.name}")
|
||||
|
||||
java {
|
||||
toolchain { languageVersion = CCTweakedPlugin.JDK_VERSION }
|
||||
@@ -63,7 +63,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||
checkstyle(libs.findLibrary("checkstyle").get())
|
||||
|
||||
constraints {
|
||||
|
||||
@@ -21,7 +21,8 @@ val modPublishing = project.extensions.create("modPublishing", ModPublishingExte
|
||||
|
||||
val isUnstable = project.properties["isUnstable"] == "true"
|
||||
val modVersion: String by extra
|
||||
val mcVersion: String by extra
|
||||
val mcVersion = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||
.findVersion("minecraft").get().toString()
|
||||
|
||||
modrinth {
|
||||
token = findProperty("modrinthApiKey") as String? ?: ""
|
||||
|
||||
@@ -15,12 +15,10 @@ plugins {
|
||||
|
||||
plugins.apply(CCTweakedPlugin::class.java)
|
||||
|
||||
val mcVersion: String by extra
|
||||
|
||||
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||
|
||||
minecraft {
|
||||
version(mcVersion)
|
||||
version(libs.findVersion("minecraft").get().toString())
|
||||
|
||||
mappings {
|
||||
parchment(libs.findVersion("parchmentMc").get().toString(), libs.findVersion("parchment").get().toString())
|
||||
|
||||
@@ -12,6 +12,3 @@ kotlin.jvm.target.validation.mode=error
|
||||
modVersion=1.120.2
|
||||
|
||||
isUnstable=true
|
||||
|
||||
# Minecraft properties: We want to configure this here so we can read it in settings.gradle
|
||||
mcVersion=1.21.1
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
[versions]
|
||||
|
||||
# Minecraft
|
||||
# MC version is specified in gradle.properties, as we need that in settings.gradle.
|
||||
# Remember to update corresponding versions in fabric.mod.json/neoforge.mods.toml
|
||||
minecraft = "1.21.1"
|
||||
fabric-api = "0.116.12+1.21.1"
|
||||
fabric-loader = "0.18.4"
|
||||
neoForge = "21.1.9"
|
||||
|
||||
@@ -8,7 +8,8 @@ plugins {
|
||||
id("cc-tweaked.vanilla")
|
||||
}
|
||||
|
||||
val mcVersion: String by extra
|
||||
val mcVersion = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||
.findVersion("minecraft").get().toString()
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
|
||||
@@ -14,6 +14,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
<ul>
|
||||
<li><a href="/mc-1.20.x/javadoc/">Minecraft 1.20.1</a>
|
||||
<li><a href="/mc-1.21.x/javadoc/">Minecraft 1.21.1</a>
|
||||
<li><a href="/mc-26.2/javadoc/">Minecraft 26.2</a>
|
||||
</ul>
|
||||
|
||||
<h1>Quick links</h1>
|
||||
|
||||
+4
-2
@@ -219,8 +219,10 @@ public class TurtlePlaceCommand implements TurtleCommand {
|
||||
}
|
||||
}
|
||||
|
||||
var useOnResult = stack.useOn(new UseOnContext(player, InteractionHand.MAIN_HAND, hit));
|
||||
if (useOnResult != InteractionResult.PASS) return useOnResult;
|
||||
if (canUse.item()) {
|
||||
var useOnResult = stack.useOn(new UseOnContext(player, InteractionHand.MAIN_HAND, hit));
|
||||
if (useOnResult != InteractionResult.PASS) return useOnResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@
|
||||
"item.computercraft.treasure_disk": "Disquette",
|
||||
"itemGroup.computercraft": "ComputerCraft",
|
||||
"tag.item.computercraft.computer": "Ordinateurs",
|
||||
"tag.item.computercraft.disks": "Disques",
|
||||
"tag.item.computercraft.monitor": "Moniteurs",
|
||||
"tag.item.computercraft.turtle": "Tortues",
|
||||
"tag.item.computercraft.wired_modem": "Modems câblés",
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"argument.computercraft.argument_expected": "Ожидается аргумент",
|
||||
"argument.computercraft.computer.distance": "Дистанция до существа",
|
||||
"argument.computercraft.computer.family": "Группа компьютеров",
|
||||
"argument.computercraft.computer.id": "ID компьютера",
|
||||
"argument.computercraft.computer.many_matching": "Несколько компьютеров соответствуют с '%s' (экземпляры %s)",
|
||||
"argument.computercraft.computer.no_matching": "Нет соответствующих компьютеров с '%s'",
|
||||
"argument.computercraft.tracking_field.no_field": "Неизвестное поле '%s'",
|
||||
@@ -11,6 +14,7 @@
|
||||
"block.computercraft.monitor_advanced": "Продвинутый монитор",
|
||||
"block.computercraft.monitor_normal": "Монитор",
|
||||
"block.computercraft.printer": "Принтер",
|
||||
"block.computercraft.redstone_relay": "Редстоуновый релей",
|
||||
"block.computercraft.speaker": "Колонка",
|
||||
"block.computercraft.turtle_advanced": "Продвинутая черепашка",
|
||||
"block.computercraft.turtle_advanced.upgraded": "Продвинутая черепашка: %s",
|
||||
@@ -104,11 +108,13 @@
|
||||
"gui.computercraft.config.http.proxy.type.tooltip": "Тип используемого прокси-сервера.",
|
||||
"gui.computercraft.config.http.rules": "Разрешающие/запрещающие правила",
|
||||
"gui.computercraft.config.http.rules.tooltip": "Список правил, которые контролируют поведение «http» API для определенных доменов или\nIP-адресов. Каждое правило представляет собой элемент с «узлом» для сопоставления и набором\nсвойств. Правила оцениваются по порядку, то есть более ранние правила перевешивают\nболее поздние.\nХост может быть доменным именем (\"pastebin.com\"), wildcard-сертификатом (\"*.pastebin.com\") или\nнотацией CIDR (\"127.0.0.0/8\").\nЕсли правил нет, домен блокируется.",
|
||||
"gui.computercraft.config.http.tooltip": "Контроль HTTP API",
|
||||
"gui.computercraft.config.http.websocket_enabled": "Включить веб-сокеты",
|
||||
"gui.computercraft.config.http.websocket_enabled.tooltip": "Включить использование http веб-сокетов. Для этого необходимо, чтобы параметр «http_enable» был true.",
|
||||
"gui.computercraft.config.log_computer_errors": "Регистрировать ошибки компьютера",
|
||||
"gui.computercraft.config.log_computer_errors.tooltip": "Регистрировать исключения, вызванные периферийными устройствами и другими объектами Lua. Это облегчает\nдля авторам модов устранение проблем, но может привести к спаму в логах, если люди будут использовать\nглючные методы.",
|
||||
"gui.computercraft.config.maximum_open_files": "Максимальное количество файлов, открытых на одном компьютере",
|
||||
"gui.computercraft.config.monitor_renderer": "Рендер монитора",
|
||||
"gui.computercraft.config.peripheral": "Периферия",
|
||||
"gui.computercraft.config.term_sizes": "Размер терминала",
|
||||
"gui.computercraft.config.term_sizes.computer": "Компьютер",
|
||||
@@ -129,6 +135,7 @@
|
||||
"gui.computercraft.config.turtle.normal_fuel_limit": "Лимит топлива Черепашек",
|
||||
"gui.computercraft.config.turtle.normal_fuel_limit.tooltip": "Лимит топлива для Черепашек",
|
||||
"gui.computercraft.config.turtle.tooltip": "Разные настройки, связанные с черепашками.",
|
||||
"gui.computercraft.config.upload_max_size": "Лимит размера загрузки (в байтах)",
|
||||
"gui.computercraft.pocket_computer_overlay": "Карманный компьютер открыт. Чтобы закрыть, нажми ESC.",
|
||||
"gui.computercraft.terminal": "Компьютерный терминал",
|
||||
"gui.computercraft.tooltip.computer_id": "Идентификатор компьютера: %s",
|
||||
@@ -158,6 +165,9 @@
|
||||
"item.computercraft.printed_pages": "Напечатанные страницы",
|
||||
"item.computercraft.treasure_disk": "Дискета",
|
||||
"itemGroup.computercraft": "ComputerCraft",
|
||||
"tag.item.computercraft.computer": "Компьютеры",
|
||||
"tag.item.computercraft.disks": "Диски",
|
||||
"tag.item.computercraft.monitor": "Мониторы",
|
||||
"tracking_field.computercraft.avg": "%s (среднее)",
|
||||
"tracking_field.computercraft.computer_tasks.name": "Задачи",
|
||||
"tracking_field.computercraft.count": "%s (количество)",
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
"block.computercraft.redstone_relay": "红石继电器",
|
||||
"block.computercraft.speaker": "扬声器",
|
||||
"block.computercraft.turtle_advanced": "高级海龟",
|
||||
"block.computercraft.turtle_advanced.upgraded": "高级%s海龟",
|
||||
"block.computercraft.turtle_advanced.upgraded_twice": "高级%s%s海龟",
|
||||
"block.computercraft.turtle_advanced.upgraded": "高级海龟(%s)",
|
||||
"block.computercraft.turtle_advanced.upgraded_twice": "高级海龟(%s)%s",
|
||||
"block.computercraft.turtle_normal": "海龟",
|
||||
"block.computercraft.turtle_normal.upgraded": "%s海龟",
|
||||
"block.computercraft.turtle_normal.upgraded_twice": "%s%s海龟",
|
||||
"block.computercraft.turtle_normal.upgraded": "海龟(%s)",
|
||||
"block.computercraft.turtle_normal.upgraded_twice": "海龟(%s)%s",
|
||||
"block.computercraft.wired_modem": "有线调制解调器",
|
||||
"block.computercraft.wired_modem_full": "有线调制解调器",
|
||||
"block.computercraft.wireless_modem_advanced": "末影调制解调器",
|
||||
|
||||
@@ -628,12 +628,12 @@ settings.define("shell.autocomplete", {
|
||||
settings.define("edit.autocomplete", {
|
||||
default = true,
|
||||
description = "Autocomplete API and function names in the editor.",
|
||||
type = "boolean",
|
||||
type = "boolean",
|
||||
})
|
||||
settings.define("lua.autocomplete", {
|
||||
default = true,
|
||||
description = "Autocomplete API and function names in the Lua REPL.",
|
||||
type = "boolean",
|
||||
type = "boolean",
|
||||
})
|
||||
|
||||
settings.define("edit.default_extension", {
|
||||
|
||||
+16
-10
@@ -127,6 +127,17 @@ local function cullProcess(nProcess)
|
||||
return false
|
||||
end
|
||||
|
||||
--[[- Resume and then cull a process.
|
||||
|
||||
This helps avoid the pattern where one calls
|
||||
`resumeProcess(nCurrentProcess, ...); cullProcess(nCurrentProcess)`, and the
|
||||
current process changes while the code is running.
|
||||
]]
|
||||
local function resumeAndCullProcess(process, ...)
|
||||
resumeProcess(process, ...)
|
||||
return cullProcess(process)
|
||||
end
|
||||
|
||||
local function cullProcesses()
|
||||
local culled = false
|
||||
for n = #tProcesses, 1, -1 do
|
||||
@@ -341,8 +352,7 @@ while #tProcesses > 0 do
|
||||
|
||||
elseif sEvent == "char" or sEvent == "key" or sEvent == "key_up" or sEvent == "paste" or sEvent == "terminate" or sEvent == "file_transfer" then
|
||||
-- Basic input, just passthrough to current process
|
||||
resumeProcess(nCurrentProcess, table.unpack(tEventData, 1, tEventData.n))
|
||||
if cullProcess(nCurrentProcess) then
|
||||
if resumeAndCullProcess(nCurrentProcess, table.unpack(tEventData, 1, tEventData.n)) then
|
||||
setMenuVisible(#tProcesses >= 2)
|
||||
redrawMenu()
|
||||
end
|
||||
@@ -375,8 +385,7 @@ while #tProcesses > 0 do
|
||||
end
|
||||
else
|
||||
-- Passthrough to current process
|
||||
resumeProcess(nCurrentProcess, sEvent, button, x, bShowMenu and y - 1 or y)
|
||||
if cullProcess(nCurrentProcess) then
|
||||
if resumeAndCullProcess(nCurrentProcess, sEvent, button, x, bShowMenu and y - 1 or y) then
|
||||
setMenuVisible(#tProcesses >= 2)
|
||||
redrawMenu()
|
||||
end
|
||||
@@ -395,8 +404,7 @@ while #tProcesses > 0 do
|
||||
end
|
||||
elseif not (bShowMenu and y == 1) then
|
||||
-- Passthrough to current process
|
||||
resumeProcess(nCurrentProcess, sEvent, p1, x, bShowMenu and y - 1 or y)
|
||||
if cullProcess(nCurrentProcess) then
|
||||
if resumeAndCullProcess(nCurrentProcess, sEvent, p1, x, bShowMenu and y - 1 or y) then
|
||||
setMenuVisible(#tProcesses >= 2)
|
||||
redrawMenu()
|
||||
end
|
||||
@@ -405,8 +413,7 @@ while #tProcesses > 0 do
|
||||
else
|
||||
-- Other event
|
||||
-- Passthrough to all processes
|
||||
local nLimit = #tProcesses -- Storing this ensures any new things spawned don't get the event
|
||||
for n = 1, nLimit do
|
||||
for n = 1, #tProcesses do
|
||||
resumeProcess(n, table.unpack(tEventData, 1, tEventData.n))
|
||||
end
|
||||
if cullProcesses() then
|
||||
@@ -417,8 +424,7 @@ while #tProcesses > 0 do
|
||||
|
||||
if bWindowsResized then
|
||||
-- Pass term_resize to all processes
|
||||
local nLimit = #tProcesses -- Storing this ensures any new things spawned don't get the event
|
||||
for n = 1, nLimit do
|
||||
for n = 1, #tProcesses do
|
||||
resumeProcess(n, "term_resize")
|
||||
end
|
||||
bWindowsResized = false
|
||||
|
||||
@@ -31,4 +31,48 @@ describe("The multishell program", function()
|
||||
expect.error(multishell.launch, _ENV, nil):eq("bad argument #2 (string expected, got nil)")
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("the main loop", function()
|
||||
it("culls a process after exiting", function()
|
||||
local function find_local(co, find)
|
||||
for level = 1, 10 do
|
||||
for var = 1, 255 do
|
||||
local name, value = debug.getlocal(co, level, var)
|
||||
if name == nil then break end
|
||||
if find == name then return value end
|
||||
end
|
||||
end
|
||||
|
||||
fail("Cannot find local " .. find)
|
||||
end
|
||||
|
||||
-- We create a very awkward program here which pulls an event (so we can inspect the intermediate state),
|
||||
-- then switches to a different tab before exiting, causing nCurrentProcess to change in the multishell
|
||||
-- loop.
|
||||
io.open("/test-files/a.lua", "w"):write([[os.pullEvent("mouse_click"); multishell.setFocus(1)]]):close()
|
||||
|
||||
local window = window.create(term.current(), 1, 1, 51, 19, false)
|
||||
local co = coroutine.create(function() os.run({ shell = shell }, "rom/programs/advanced/multishell.lua") end)
|
||||
local function resume(...)
|
||||
local old = term.redirect(window)
|
||||
local ok, err = coroutine.resume(co, ...)
|
||||
term.redirect(old)
|
||||
if not ok then fail("Coroutine failed: " .. err) end
|
||||
end
|
||||
|
||||
resume()
|
||||
local multishell = find_local(co, "multishell")
|
||||
expect(multishell.getFocus()):eq(1)
|
||||
expect(multishell.getCount()):eq(1)
|
||||
|
||||
resume("paste", "fg /test-files/a.lua")
|
||||
resume("key", keys.enter, false)
|
||||
expect(multishell.getFocus()):eq(2)
|
||||
expect(multishell.getCount()):eq(2)
|
||||
|
||||
resume("mouse_click", 1, 1, 2)
|
||||
expect(multishell.getFocus()):eq(1)
|
||||
expect(multishell.getCount()):eq(1)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
+1
-2
@@ -30,8 +30,7 @@ plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version("1.0.0")
|
||||
}
|
||||
|
||||
val mcVersion: String by settings
|
||||
rootProject.name = "cc-tweaked-$mcVersion"
|
||||
rootProject.name = "cc-tweaked"
|
||||
|
||||
include(":core-api")
|
||||
include(":core")
|
||||
|
||||
Reference in New Issue
Block a user