1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 12:10:30 +00:00

Merge branch 'mc-1.15.x' into mc-1.16.x

This commit is contained in:
Jonathan Coates 2021-01-09 18:32:40 +00:00
commit 7ca261d763
26 changed files with 40 additions and 38 deletions

View File

@ -50,7 +50,7 @@ minecraft {
}
server {
workingDirectory project.file("run/server-${mc_version}")
workingDirectory project.file("run/server")
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
@ -388,14 +388,14 @@ license {
it.configure {
include("**/*.java")
exclude("dan200/computercraft/api/**")
header rootProject.file('config/license/main.txt')
header file('config/license/main.txt')
}
}
[licenseTest, licenseFormatTest].forEach {
it.configure {
include("**/*.java")
header rootProject.file('config/license/main.txt')
header file('config/license/main.txt')
}
}
@ -412,7 +412,7 @@ task licenseFormatAPI(type: LicenseFormat);
it.configure {
source = sourceSets.main.java
include("dan200/computercraft/api/**")
header rootProject.file('config/license/api.txt')
header file('config/license/api.txt')
}
}
@ -430,7 +430,7 @@ task checkRelease {
def ok = true
// Check we're targetting the current version
def whatsnew = new File("src/main/resources/data/computercraft/lua/rom/help/whatsnew.txt").readLines()
def whatsnew = new File(projectDir, "src/main/resources/data/computercraft/lua/rom/help/whatsnew.txt").readLines()
if (whatsnew[0] != "New features in CC: Tweaked $mod_version") {
ok = false
project.logger.error("Expected `whatsnew.txt' to target $mod_version.")
@ -447,7 +447,7 @@ task checkRelease {
// Check whatsnew and changelog match.
def versionChangelog = "# " + whatsnew.join("\n")
def changelog = new File("src/main/resources/data/computercraft/lua/rom/help/changelog.txt").getText()
def changelog = new File(projectDir, "src/main/resources/data/computercraft/lua/rom/help/changelog.txt").getText()
if (!changelog.startsWith(versionChangelog)) {
ok = false
project.logger.error("whatsnew and changelog are not in sync")
@ -535,7 +535,7 @@ githubRelease {
tagName "v${mc_version}-${mod_version}"
releaseName "[${mc_version}] ${mod_version}"
body {
"## " + new File("src/main/resources/data/computercraft/lua/rom/help/whatsnew.txt")
"## " + new File(projectDir, "src/main/resources/data/computercraft/lua/rom/help/whatsnew.txt")
.readLines()
.takeWhile { it != 'Type "help changelog" to see the full version history.' }
.join("\n").trim()

View File

@ -7,7 +7,7 @@
<property name="charset" value="UTF-8" />
<module name="SuppressionFilter">
<property name="file" value="config/checkstyle/suppressions.xml" />
<property name="file" value="${config_loc}/suppressions.xml" />
</module>
<module name="BeforeExecutionExclusionFileFilter">

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:1118481}"
"nbt": "{Color:1118481}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:15905484}"
"nbt": "{Color:15905484}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:8375321}"
"nbt": "{Color:8375321}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:14605932}"
"nbt": "{Color:14605932}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:10072818}"
"nbt": "{Color:10072818}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:15040472}"
"nbt": "{Color:15040472}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:15905331}"
"nbt": "{Color:15905331}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:15790320}"
"nbt": "{Color:15790320}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:13388876}"
"nbt": "{Color:13388876}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:5744206}"
"nbt": "{Color:5744206}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:8349260}"
"nbt": "{Color:8349260}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:3368652}"
"nbt": "{Color:3368652}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:11691749}"
"nbt": "{Color:11691749}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:5020082}"
"nbt": "{Color:5020082}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:10066329}"
"nbt": "{Color:10066329}"
}
}

View File

@ -14,6 +14,6 @@
],
"result": {
"item": "computercraft:disk",
"nbt": "{color:5000268}"
"nbt": "{Color:5000268}"
}
}

View File

@ -471,8 +471,8 @@ public class FSAPI implements ILuaAPI
/**
* Get attributes about a specific file or folder.
*
* The returned attributes table contains information about the size of the file, whether it is a directory, and
* when it was created and last modified.
* The returned attributes table contains information about the size of the file, whether it is a directory,
* when it was created and last modified, and whether it is read only.
*
* The creation and modification times are given as the number of milliseconds since the UNIX epoch. This may be
* given to {@link OSAPI#date} in order to convert it to more usable form.
@ -480,7 +480,7 @@ public class FSAPI implements ILuaAPI
* @param path The path to get attributes for.
* @return The resulting attributes.
* @throws LuaException If the path does not exist.
* @cc.treturn { size = number, isDir = boolean, created = number, modified = number } The resulting attributes.
* @cc.treturn { size = number, isDir = boolean, isReadOnly = boolean, created = number, modified = number } The resulting attributes.
* @see #getSize If you only care about the file's size.
* @see #isDir If you only care whether a path is a directory or not.
*/
@ -496,6 +496,7 @@ public class FSAPI implements ILuaAPI
result.put( "created", getFileTime( attributes.creationTime() ) );
result.put( "size", attributes.isDirectory() ? 0 : attributes.size() );
result.put( "isDir", attributes.isDirectory() );
result.put( "isReadOnly", fileSystem.isReadOnly( path ) );
return result;
}
catch( FileSystemException e )

View File

@ -10,6 +10,7 @@ import dan200.computercraft.data.Tags.CCTags;
import dan200.computercraft.shared.PocketUpgrades;
import dan200.computercraft.shared.Registry;
import dan200.computercraft.shared.TurtleUpgrades;
import dan200.computercraft.shared.common.IColouredItem;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory;
import dan200.computercraft.shared.turtle.items.TurtleItemFactory;
@ -64,7 +65,7 @@ public class Recipes extends RecipeProvider
.addCriterion( "has_drive", inventoryChange( Registry.ModBlocks.DISK_DRIVE.get() ) )
.build( RecipeWrapper.wrap(
ImpostorShapelessRecipe.SERIALIZER, add,
x -> x.putInt( "color", colour.getHex() )
x -> x.putInt( IColouredItem.NBT_COLOUR, colour.getHex() )
), new ResourceLocation( ComputerCraft.MOD_ID, "disk_" + (colour.ordinal() + 1) ) );
}
}

View File

@ -56,7 +56,7 @@ public final class RepeatArgumentType<T, U> implements ArgumentType<List<T>>
public static <T> RepeatArgumentType<T, T> some( ArgumentType<T> appender, SimpleCommandExceptionType missing )
{
return new RepeatArgumentType<>( appender, List::add, true, missing );
return new RepeatArgumentType<>( appender, List::add, false, missing );
}
public static <T> RepeatArgumentType<T, List<T>> someFlat( ArgumentType<List<T>> appender, SimpleCommandExceptionType missing )

View File

@ -667,8 +667,8 @@ while bRunning do
end
end
elseif param == keys.enter then
-- Enter
elseif param == keys.enter or param == keys.numPadEnter then
-- Enter/Numpad Enter
if not bMenu and not bReadOnly then
-- Newline
local sLine = tLines[y]

View File

@ -350,7 +350,7 @@ local function accessMenu()
selection = #mChoices
end
elseif key == keys.enter then
elseif key == keys.enter or key == keys.numPadEnter then
-- Select an option
return menu_choices[mChoices[selection]]()
elseif key == keys.leftCtrl or keys == keys.rightCtrl then

View File

@ -199,8 +199,8 @@ while true do
drawMenu()
drawFrontend()
end
elseif key == keys.enter then
-- Enter
elseif key == keys.enter or key == keys.numPadEnter then
-- Enter/Numpad Enter
break
end
end

View File

@ -546,7 +546,7 @@ local function playGame()
msgBox("Game Over!")
while true do
local _, k = os.pullEvent("key")
if k == keys.space or k == keys.enter then
if k == keys.space or k == keys.enter or k == keys.numPadEnter then
break
end
end
@ -627,7 +627,7 @@ local function runMenu()
elseif key == keys.down or key == keys.s then
selected = selected % 2 + 1
drawMenu()
elseif key == keys.enter or key == keys.space then
elseif key == keys.enter or key == keys.numPadEnter or key == keys.space then
break --begin play!
end
end

View File

@ -194,7 +194,7 @@ describe("The fs library", function()
end)
it("returns information about read-only mounts", function()
expect(fs.attributes("rom")):matches { isDir = true, size = 0 }
expect(fs.attributes("rom")):matches { isDir = true, size = 0, isReadOnly = true }
end)
it("returns information about files", function()
@ -206,7 +206,7 @@ describe("The fs library", function()
h.close()
local attributes = fs.attributes("tmp/basic-file")
expect(attributes):matches { isDir = false, size = 25 }
expect(attributes):matches { isDir = false, size = 25, isReadOnly = false }
if attributes.created - now >= 1000 then
fail(("Expected created time (%d) to be within 1000ms of now (%d"):format(attributes.created, now))