mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 20:20:30 +00:00
Merge branch 'mc-1.15.x' into mc-1.16.x
This commit is contained in:
commit
7ca261d763
14
build.gradle
14
build.gradle
@ -50,7 +50,7 @@ minecraft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
workingDirectory project.file("run/server-${mc_version}")
|
workingDirectory project.file("run/server")
|
||||||
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
|
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
|
|
||||||
@ -388,14 +388,14 @@ license {
|
|||||||
it.configure {
|
it.configure {
|
||||||
include("**/*.java")
|
include("**/*.java")
|
||||||
exclude("dan200/computercraft/api/**")
|
exclude("dan200/computercraft/api/**")
|
||||||
header rootProject.file('config/license/main.txt')
|
header file('config/license/main.txt')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[licenseTest, licenseFormatTest].forEach {
|
[licenseTest, licenseFormatTest].forEach {
|
||||||
it.configure {
|
it.configure {
|
||||||
include("**/*.java")
|
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 {
|
it.configure {
|
||||||
source = sourceSets.main.java
|
source = sourceSets.main.java
|
||||||
include("dan200/computercraft/api/**")
|
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
|
def ok = true
|
||||||
|
|
||||||
// Check we're targetting the current version
|
// 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") {
|
if (whatsnew[0] != "New features in CC: Tweaked $mod_version") {
|
||||||
ok = false
|
ok = false
|
||||||
project.logger.error("Expected `whatsnew.txt' to target $mod_version.")
|
project.logger.error("Expected `whatsnew.txt' to target $mod_version.")
|
||||||
@ -447,7 +447,7 @@ task checkRelease {
|
|||||||
|
|
||||||
// Check whatsnew and changelog match.
|
// Check whatsnew and changelog match.
|
||||||
def versionChangelog = "# " + whatsnew.join("\n")
|
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)) {
|
if (!changelog.startsWith(versionChangelog)) {
|
||||||
ok = false
|
ok = false
|
||||||
project.logger.error("whatsnew and changelog are not in sync")
|
project.logger.error("whatsnew and changelog are not in sync")
|
||||||
@ -535,7 +535,7 @@ githubRelease {
|
|||||||
tagName "v${mc_version}-${mod_version}"
|
tagName "v${mc_version}-${mod_version}"
|
||||||
releaseName "[${mc_version}] ${mod_version}"
|
releaseName "[${mc_version}] ${mod_version}"
|
||||||
body {
|
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()
|
.readLines()
|
||||||
.takeWhile { it != 'Type "help changelog" to see the full version history.' }
|
.takeWhile { it != 'Type "help changelog" to see the full version history.' }
|
||||||
.join("\n").trim()
|
.join("\n").trim()
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<property name="charset" value="UTF-8" />
|
<property name="charset" value="UTF-8" />
|
||||||
|
|
||||||
<module name="SuppressionFilter">
|
<module name="SuppressionFilter">
|
||||||
<property name="file" value="config/checkstyle/suppressions.xml" />
|
<property name="file" value="${config_loc}/suppressions.xml" />
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<module name="BeforeExecutionExclusionFileFilter">
|
<module name="BeforeExecutionExclusionFileFilter">
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:1118481}"
|
"nbt": "{Color:1118481}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:15905484}"
|
"nbt": "{Color:15905484}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:8375321}"
|
"nbt": "{Color:8375321}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:14605932}"
|
"nbt": "{Color:14605932}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:10072818}"
|
"nbt": "{Color:10072818}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:15040472}"
|
"nbt": "{Color:15040472}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:15905331}"
|
"nbt": "{Color:15905331}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:15790320}"
|
"nbt": "{Color:15790320}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:13388876}"
|
"nbt": "{Color:13388876}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:5744206}"
|
"nbt": "{Color:5744206}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:8349260}"
|
"nbt": "{Color:8349260}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:3368652}"
|
"nbt": "{Color:3368652}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:11691749}"
|
"nbt": "{Color:11691749}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:5020082}"
|
"nbt": "{Color:5020082}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:10066329}"
|
"nbt": "{Color:10066329}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@
|
|||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "computercraft:disk",
|
"item": "computercraft:disk",
|
||||||
"nbt": "{color:5000268}"
|
"nbt": "{Color:5000268}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -471,8 +471,8 @@ public class FSAPI implements ILuaAPI
|
|||||||
/**
|
/**
|
||||||
* Get attributes about a specific file or folder.
|
* 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
|
* The returned attributes table contains information about the size of the file, whether it is a directory,
|
||||||
* when it was created and last modified.
|
* 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
|
* 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.
|
* 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.
|
* @param path The path to get attributes for.
|
||||||
* @return The resulting attributes.
|
* @return The resulting attributes.
|
||||||
* @throws LuaException If the path does not exist.
|
* @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 #getSize If you only care about the file's size.
|
||||||
* @see #isDir If you only care whether a path is a directory or not.
|
* @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( "created", getFileTime( attributes.creationTime() ) );
|
||||||
result.put( "size", attributes.isDirectory() ? 0 : attributes.size() );
|
result.put( "size", attributes.isDirectory() ? 0 : attributes.size() );
|
||||||
result.put( "isDir", attributes.isDirectory() );
|
result.put( "isDir", attributes.isDirectory() );
|
||||||
|
result.put( "isReadOnly", fileSystem.isReadOnly( path ) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch( FileSystemException e )
|
catch( FileSystemException e )
|
||||||
|
@ -10,6 +10,7 @@ import dan200.computercraft.data.Tags.CCTags;
|
|||||||
import dan200.computercraft.shared.PocketUpgrades;
|
import dan200.computercraft.shared.PocketUpgrades;
|
||||||
import dan200.computercraft.shared.Registry;
|
import dan200.computercraft.shared.Registry;
|
||||||
import dan200.computercraft.shared.TurtleUpgrades;
|
import dan200.computercraft.shared.TurtleUpgrades;
|
||||||
|
import dan200.computercraft.shared.common.IColouredItem;
|
||||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||||
import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory;
|
import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory;
|
||||||
import dan200.computercraft.shared.turtle.items.TurtleItemFactory;
|
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() ) )
|
.addCriterion( "has_drive", inventoryChange( Registry.ModBlocks.DISK_DRIVE.get() ) )
|
||||||
.build( RecipeWrapper.wrap(
|
.build( RecipeWrapper.wrap(
|
||||||
ImpostorShapelessRecipe.SERIALIZER, add,
|
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) ) );
|
), new ResourceLocation( ComputerCraft.MOD_ID, "disk_" + (colour.ordinal() + 1) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 )
|
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 )
|
public static <T> RepeatArgumentType<T, List<T>> someFlat( ArgumentType<List<T>> appender, SimpleCommandExceptionType missing )
|
||||||
|
@ -667,8 +667,8 @@ while bRunning do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif param == keys.enter then
|
elseif param == keys.enter or param == keys.numPadEnter then
|
||||||
-- Enter
|
-- Enter/Numpad Enter
|
||||||
if not bMenu and not bReadOnly then
|
if not bMenu and not bReadOnly then
|
||||||
-- Newline
|
-- Newline
|
||||||
local sLine = tLines[y]
|
local sLine = tLines[y]
|
||||||
|
@ -350,7 +350,7 @@ local function accessMenu()
|
|||||||
selection = #mChoices
|
selection = #mChoices
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif key == keys.enter then
|
elseif key == keys.enter or key == keys.numPadEnter then
|
||||||
-- Select an option
|
-- Select an option
|
||||||
return menu_choices[mChoices[selection]]()
|
return menu_choices[mChoices[selection]]()
|
||||||
elseif key == keys.leftCtrl or keys == keys.rightCtrl then
|
elseif key == keys.leftCtrl or keys == keys.rightCtrl then
|
||||||
|
@ -199,8 +199,8 @@ while true do
|
|||||||
drawMenu()
|
drawMenu()
|
||||||
drawFrontend()
|
drawFrontend()
|
||||||
end
|
end
|
||||||
elseif key == keys.enter then
|
elseif key == keys.enter or key == keys.numPadEnter then
|
||||||
-- Enter
|
-- Enter/Numpad Enter
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -546,7 +546,7 @@ local function playGame()
|
|||||||
msgBox("Game Over!")
|
msgBox("Game Over!")
|
||||||
while true do
|
while true do
|
||||||
local _, k = os.pullEvent("key")
|
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
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -627,7 +627,7 @@ local function runMenu()
|
|||||||
elseif key == keys.down or key == keys.s then
|
elseif key == keys.down or key == keys.s then
|
||||||
selected = selected % 2 + 1
|
selected = selected % 2 + 1
|
||||||
drawMenu()
|
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!
|
break --begin play!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -194,7 +194,7 @@ describe("The fs library", function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("returns information about read-only mounts", function()
|
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)
|
end)
|
||||||
|
|
||||||
it("returns information about files", function()
|
it("returns information about files", function()
|
||||||
@ -206,7 +206,7 @@ describe("The fs library", function()
|
|||||||
h.close()
|
h.close()
|
||||||
|
|
||||||
local attributes = fs.attributes("tmp/basic-file")
|
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
|
if attributes.created - now >= 1000 then
|
||||||
fail(("Expected created time (%d) to be within 1000ms of now (%d"):format(attributes.created, now))
|
fail(("Expected created time (%d) to be within 1000ms of now (%d"):format(attributes.created, now))
|
||||||
|
Loading…
Reference in New Issue
Block a user