init commit of working things

This commit is contained in:
TheRealM18 2024-07-21 21:14:33 -03:00
commit 06a0ff2060
66 changed files with 1917 additions and 0 deletions

24
.editorconfig Normal file
View file

@ -0,0 +1,24 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
[*.java]
trim_trailing_whitespace = true
max_line_length = 120
ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true
[*.yml]
indent_size = 2
tab_width = 2
[*.properties]
ij_properties_keep_blank_lines = true
[*.json]
indent_size = 2
tab_width = 2

8
.gitattributes vendored Normal file
View file

@ -0,0 +1,8 @@
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf
# Files provided to VM.
src/main/scripts/**/*.lua text eol=lf

38
.gitignore vendored Normal file
View file

@ -0,0 +1,38 @@
#system
.DS_Store
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
# idea
out
*.ipr
*.iws
*.iml
.idea
# gradle
build
.gradle
# other
eclipse
run
runclient
logs
/assets/
# Files from Forge MDK
forge*changelog.txt
/src/generated/
#vscode
.vscode
# Don't ignore bin from scripts
!/src/main/scripts/bin/

29
LICENSE Normal file
View file

@ -0,0 +1,29 @@
MIT License
Copyright (c) 2020-2021 Florian "Sangar" Nücke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-------------------------------------------------------------------------------
All images / textures and localization strings (resources) are put in the
public domain, unless explicitly excluded below. More specifically, see CC0 1.0
Universal:
http://creativecommons.org/publicdomain/zero/1.0/

21
LICENSE-JCODEC Normal file
View file

@ -0,0 +1,21 @@
Copyright 2008-2019 JCodecProject
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. Redistributions in binary form
must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with
the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

38
README.md Normal file
View file

@ -0,0 +1,38 @@
# OpenComputers II: Reimagined
[Searching for an Artist](#artists)
*OpenComputers II: Reimagined* is a Minecraft mod adding virtual computers to the game. It is a fork of the mod originally made by [Sangar (fnuecke)], this fork is maintained North Western Development. These computers run a virtual machine emulating a 64-Bit RISC-V architecture capable of booting Linux. On top of this, a high-level Lua API is provided to communicate with various devices in the game world. This enables adding virtual devices using a simple, Java-friendly API, without having to implement actual kernel drivers.
The original mod was a successor to [OpenComputers]. At least in spirit. While many of the implementation details have changed quite dramatically, the core concepts of customizable hardware, persistence and sand-boxing are shared.
The underlying VM, which is written entirely in Java, is called [Sedna] and was written by [Sangar (fnuecke)] as well.
## Artists
We are looking for artists to assist with models and textures going forward. Artists will be entitled to a negotiated percentage of CurseForge rewards or any other donation platforms that may be employed. Artists will also receive special credits throughout the mod and it's repos.
## Why the Fork?
*OpenComputers II: Reimagined* aims to fix bugs with OC2 while adding new features and attempting to keep up with the latest popular versions of Minecraft. We did attempt to reach [Sangar (fnuecke)] on Twitter but got no response, so we've decided to continue with the fork and release separately on Curse under a new name.
The name change is simply an attempt to ensure it is well known that [Sangar (fnuecke)] is not responsible for this version, so they're not blasted with issues from it. We will be doing everything we can to ensure [Sangar (fnuecke)] does still get the credit they deserve for the mod though.
## Gameplay Documentation
For documentation on how the to get computers up and running, and how to use them, see the [documentation]. It is available as a manual item in the game.
## Development Documentation
The original section that was found here is preserved below, however it should be taken with a grain of salt as the current team has a ways to go in being 100% up to speed with where the device APIs are at the moment. So everything below is subject to change, though it is likely to remain mostly the same.
~~While the mod isn't quite yet ready for release due to some remaining technical and usability issues, the API should be mostly stable at this point. For most people the high level device API will be sufficient, and is much more accessible. It centers around the [`RPCDevice`][RPC Device]. For a sample block implementation, see the [redstone interface]. For a sample item implementation, see the [sound card]. If you wish to dive deeper, and provide emulated hardware that requires a Linux driver, this centers around the [`VMDevice`][VM Device]. For a sample block implementation, see the [disk drive]. For a sample item implementation, see the [network card].~~
[OpenComputers]: https://github.com/MightyPirates/OpenComputers
[RPC Device]: src/main/java/li/cil/oc2r/api/bus/device/rpc/RPCDevice.java
[redstone interface]: src/main/java/li/cil/oc2r/common/blockentity/RedstoneInterfaceBlockEntity.java
[sound card]: src/main/java/li/cil/oc2r/common/bus/device/rpc/item/SoundCardItemDevice.java
[VM Device]: src/main/java/li/cil/oc2r/api/bus/device/vm/VMDevice.java
[disk drive]: src/main/java/li/cil/oc2r/common/blockentity/DiskDriveBlockEntity.java
[network card]: src/main/java/li/cil/oc2r/common/bus/device/vm/item/NetworkInterfaceCardDevice.java
[documentation]: src/main/resources/assets/oc2r/doc/en_us/index.md
[GithubPackagesGradle]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry
[Sangar (fnuecke)]: https://github.com/fnuecke
[Sedna]: https://github.com/fnuecke/sedna

240
build.gradle Normal file
View file

@ -0,0 +1,240 @@
plugins {
id "idea"
id "maven-publish"
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id "com.matthewprenger.cursegradle" version "1.4.0"
id 'org.spongepowered.mixin' version '0.7.+'
}
apply plugin: 'org.spongepowered.mixin'
apply from: "minecraft.gradle"
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "1000"
}
}
}
def getGitRef() {
try {
final def stdout = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--short", "HEAD"
standardOutput = stdout
}
return stdout.toString().trim()
} catch (final Throwable ignored) {
return "unknown"
}
}
version = "${semver}+${getGitRef()}"
group = "li.cil.oc2r"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
tasks.withType(JavaCompile).configureEach {
options.encoding = "utf-8"
}
final def hasGithubPackageCredentials =
(project.hasProperty("gpr.user") && project.hasProperty("gpr.key")) ||
(System.getenv("GITHUB_ACTOR") && System.getenv("GITHUB_TOKEN"))
repositories {
mavenCentral()
maven {
url "https://cursemaven.com"
}
maven {
// location of the maven that hosts JEI files since January 2023
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven { url = "https://proxy-maven.covers1624.net/" }
if (hasGithubPackageCredentials) {
final def GithubPackages = [
["fnuecke/ceres", "li.cil.ceres"],
["fnuecke/sedna", "li.cil.sedna"],
["fnuecke/buildroot", "li.cil.sedna"]
]
GithubPackages.each { final repo, final group ->
maven {
url = uri("https://maven.pkg.github.com/${repo}")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GPR_USER")
password = project.findProperty("gpr.key") ?: System.getenv("GPR_KEY")
}
content { includeGroup group }
}
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
// Specify the libs embedded in the library mod explicitly for local development, where
// we can include these directly (and will have a local library mod using the local
// versions). Can't get these to get properly resolved in the IDE otherwise (doesn't
// pick them up via the library mod due to the embed configuration).
if (hasGithubPackageCredentials) {
compileOnly "li.cil.ceres:ceres:0.0.4"
compileOnly "li.cil.sedna:sedna:2.0.8"
compileOnly "li.cil.sedna:sedna-buildroot:0.0.8"
}
implementation "curse.maven:sedna-511276:3885542"
minecraftLibrary "org.apache.commons:commons-collections4:4.4"
implementation fg.deobf("curse.maven:markdownmanual-502485:4873115")
implementation fg.deobf("curse.maven:architectury-api-419699:5137938")
compileOnly fg.deobf("mezz.jei:jei-1.20.1-common-api:15.3.0.4")
compileOnly fg.deobf("mezz.jei:jei-1.20.1-forge-api:15.3.0.4")
runtimeOnly fg.deobf("mezz.jei:jei-1.20.1-forge:15.3.0.4")
compileOnly fg.deobf("mrtjp:ProjectRed:${minecraft_version}-${pr_version}:api")
runtimeOnly fg.deobf("io.codechicken:CodeChickenLib:${minecraft_version}-${ccl_version}:universal")
runtimeOnly fg.deobf("io.codechicken:CBMultipart:${minecraft_version}-${cbm_version}:universal")
runtimeOnly fg.deobf("mrtjp:ProjectRed:${minecraft_version}-${pr_version}:core")
runtimeOnly fg.deobf("mrtjp:ProjectRed:${minecraft_version}-${pr_version}:transmission")
if (debug_embeddium)
{
runtimeOnly fg.deobf("curse.maven:embeddium-908741:5521846")
}
if (debug_embeddium_plus_plus)
{
runtimeOnly fg.deobf("curse.maven:embeddiumplus-931925:5436746")
}
if (debug_oculus)
{
runtimeOnly fg.deobf("curse.maven:oculus-581495:5299671")
}
testImplementation "org.mockito:mockito-inline:4.3.1"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.2"
implementation fg.deobf("curse.maven:oc2r-1037738:5544316")
}
System.setProperty("line.separator", "\n")
minecraft {
mappings channel: "official", version: minecraft_version
runs {
all {
property "forge.logging.markers", "REGISTRIES"
property "forge.logging.console.level", "debug"
mods {
librecomponents {
source sourceSets.main
}
}
}
client {
workingDirectory project.file("runclient")
property "forge.enabledGameTestNamespaces", "librecomponents"
}
server {
workingDirectory project.file("run")
property "forge.enabledGameTestNamespaces", "librecomponents"
arg "--nogui"
}
gameTestServer {
workingDirectory project.file('run')
property "forge.enabledGameTestNamespaces", "librecomponents"
}
data {
workingDirectory project.file("run")
args "--mod", "librecomponents", "--all", "--output", file("src/generated/resources/"), "--existing", file("src/main/resources")
}
}
}
task copyGeneratedResources(type: Copy) {
from "src/generated"
into "src/main"
exclude "resources/.cache"
}
jar {
finalizedBy "reobfJar"
manifest {
attributes([
"FMLAT" : "accesstransformer.cfg",
"Specification-Title" : "librecomponents",
"Specification-Vendor" : "The Realm 18 Studios",
"Specification-Version" : "1",
"Implementation-Title" : project.name,
"Implementation-Version" : "${semver}",
"Implementation-Vendor" : "The Realm 18 Studios",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs" : "mixins.ld.json",
"ContainedDeps" : "commons-collections4-4.4.jar"
])
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = project.name
version = semver
artifact jar
}
}
repositories {
maven {
name = "GitHubPackages"
url = System.getenv("GITHUB_MAVEN_URL") ?: ""
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
//
//curseforge {
// apiKey = System.getenv("CURSEFORGE_API_KEY") ?: ""
// project {
// id = curse_project_id
// releaseType = System.getenv('CURSEFORGE_RELEASE_TYPE') ?: "alpha"
// changelogType = 'markdown'
// changelog = System.getenv("CHANGELOG") ?: "Changelog not available."
// addGameVersion "Forge"
// addGameVersion minecraft_version
// addGameVersion "Java 17"
// relations {
// requiredDependency "markdownmanual"
// requiredDependency "sedna"
// }
// }
//}
idea {
module {
for (final String exclude in ["assets", "run", "out", "logs", "src/generated"]) {
excludeDirs += file(exclude)
}
}
}
test {
useJUnitPlatform()
}

1
changelog.md Normal file
View file

@ -0,0 +1 @@
* Initial release.

20
gradle.properties Normal file
View file

@ -0,0 +1,20 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
forge_version=47.2.32
semver=1.1.0
# curse_project_id=1037738
pr_version=4.19.0-beta+3
ccl_version=4.4.0.+
cbm_version=3.3.0.+
debug_embeddium=false
debug_embeddium_plus_plus=false
debug_oculus=false

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
gradlew vendored Normal file
View file

@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View file

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

4
minecraft.gradle Normal file
View file

@ -0,0 +1,4 @@
ext {
minecraft_version = '1.20.1'
minecraft_sdk = 'forge'
}

27
settings.gradle Normal file
View file

@ -0,0 +1,27 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url "https://repo.spongepowered.org/repository/maven-public/" }
}
}
apply from: 'minecraft.gradle'
rootProject.name = "librecomponents-${minecraft_version}-${minecraft_sdk}"
def substituteLocal(final directoryName, final libraryName) {
final def path = new File("../${directoryName}");
if (path.exists()) {
println("Found local [${directoryName}] project, substituting...")
includeBuild(path) {
dependencySubstitution {
substitute module(libraryName) using project(':')
}
}
}
}
substituteLocal('sedna-mc', 'curse.maven:sedna-511276')
substituteLocal('ceres', 'li.cil.ceres:ceres')
substituteLocal('sedna', 'li.cil.sedna:sedna')
substituteLocal('buildroot', 'li.cil.sedna:sedna-buildroot')

View file

@ -0,0 +1,21 @@
package com.therealm18studios.lc;
import com.therealm18studios.lc.common.item.ItemGroup;
import com.therealm18studios.lc.common.item.Items;
import li.cil.oc2r.common.ConfigManager;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod("librecomponents")
public final class LibreComponents {
public static String MOD_ID = "librecomponents";
public LibreComponents() {
ConfigManager.initialize();
Items.initialize();
ItemGroup.TAB_REGISTER.register(FMLJavaModLoadingContext.get().getModEventBus());
}
}

View file

@ -0,0 +1,40 @@
package com.therealm18studios.lc.common.item;
import com.therealm18studios.lc.LibreComponents;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
public final class ItemGroup {
public static final DeferredRegister<CreativeModeTab> TAB_REGISTER = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, LibreComponents.MOD_ID);
@SuppressWarnings("unused")
public static final RegistryObject<CreativeModeTab> COMMON_TAB = TAB_REGISTER.register("common", () -> CreativeModeTab.builder()
// Set name of tab to display
.title(Component.translatable("item_group." + LibreComponents.MOD_ID + ".common"))
// Set icon of creative tab
.icon(() -> new ItemStack(li.cil.oc2r.common.item.Items.COMPUTER.get()))
// Add default items to tab
.displayItems((params, output) -> {
// Items
output.accept(Items.MEMORY_SMALL.get());
output.accept(Items.MEMORY_MEDIUM.get());
output.accept(Items.MEMORY_LARGE.get());
output.accept(Items.MEMORY_EXTRA_LARGE.get());
output.accept(Items.HARD_DRIVE_SMALL.get());
output.accept(Items.HARD_DRIVE_MEDIUM.get());
output.accept(Items.HARD_DRIVE_LARGE.get());
output.accept(Items.HARD_DRIVE_EXTRA_LARGE.get());
output.accept(Items.CPU_TIER_1.get());
output.accept(Items.CPU_TIER_2.get());
output.accept(Items.CPU_TIER_3.get());
output.accept(Items.CPU_TIER_4.get());
output.accept(Items.FLOPPY.get());
output.accept(Items.FLOPPY_MODERN.get());
})
.build()
);
}

View file

@ -0,0 +1,91 @@
package com.therealm18studios.lc.common.item;
import com.therealm18studios.lc.LibreComponents;
import li.cil.oc2r.common.item.*;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import java.util.function.Supplier;
public final class Items {
private static final DeferredRegister<Item> ITEMS;
public static final RegistryObject<MemoryItem> MEMORY_SMALL;
public static final RegistryObject<MemoryItem> MEMORY_MEDIUM;
public static final RegistryObject<MemoryItem> MEMORY_LARGE;
public static final RegistryObject<MemoryItem> MEMORY_EXTRA_LARGE;
public static final RegistryObject<HardDriveItem> HARD_DRIVE_SMALL;
public static final RegistryObject<HardDriveItem> HARD_DRIVE_MEDIUM;
public static final RegistryObject<HardDriveItem> HARD_DRIVE_LARGE;
public static final RegistryObject<HardDriveItem> HARD_DRIVE_EXTRA_LARGE;
public static final RegistryObject<CPUItem> CPU_TIER_1;
public static final RegistryObject<CPUItem> CPU_TIER_2;
public static final RegistryObject<CPUItem> CPU_TIER_3;
public static final RegistryObject<CPUItem> CPU_TIER_4;
public static final RegistryObject<FloppyItem> FLOPPY;
public static final RegistryObject<FloppyItem> FLOPPY_MODERN;
public Items() {
}
public static void initialize() {
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
}
private static RegistryObject<Item> register(String name) {
return register(name, ModItem::new);
}
private static <T extends Item> RegistryObject<T> register(String name, Supplier<T> factory) {
return ITEMS.register(name, factory);
}
static {
ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, LibreComponents.MOD_ID);
MEMORY_SMALL = register("memory_small", () -> {
return new MemoryItem(33554432);
});
MEMORY_MEDIUM = register("memory_medium", () -> {
return new MemoryItem(67108864);
});
MEMORY_LARGE = register("memory_large", () -> {
return new MemoryItem(134217728);
});
MEMORY_EXTRA_LARGE = register("memory_extra_large", () -> {
return new MemoryItem(268435456);
});
HARD_DRIVE_SMALL = register("hard_drive_small", () -> {
return new HardDriveItem(33554432, DyeColor.PINK);
});
HARD_DRIVE_MEDIUM = register("hard_drive_medium", () -> {
return new HardDriveItem(67108864, DyeColor.RED);
});
HARD_DRIVE_LARGE = register("hard_drive_large", () -> {
return new HardDriveItem(134217728, DyeColor.BLUE);
});
HARD_DRIVE_EXTRA_LARGE = register("hard_drive_extra_large", () -> {
return new HardDriveItem(268435456, DyeColor.BLACK);
});
CPU_TIER_1 = register("cpu_tier_1", () -> {
return new CPUItem(250000000);
});
CPU_TIER_2 = register("cpu_tier_2", () -> {
return new CPUItem(300000000);
});
CPU_TIER_3 = register("cpu_tier_3", () -> {
return new CPUItem(350000000);
});
CPU_TIER_4 = register("cpu_tier_4", () -> {
return new CPUItem(400000000);
});
FLOPPY = register("floppy", () -> {
return new FloppyItem(2949120);
});
FLOPPY_MODERN = register("floppy_modern", () -> {
return new FloppyItem(5898240);
});
}
}

View file

@ -0,0 +1,33 @@
package com.therealm18studios.lc.data;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DataProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public final class DataGenerators {
@SubscribeEvent
public static void gatherData(final GatherDataEvent event) {
final DataGenerator generator = event.getGenerator();
final ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
// generator.addProvider(
// event.includeServer(),
// (DataProvider.Factory<LootTableProvider>) output -> new LootTableProvider(
// output,
// Set.of(),
// Collections.singletonList(
// new LootTableProvider.SubProviderEntry(
// ModLootTableProvider.ModBlockLootTables::new,
// LootContextParamSets.BLOCK
// )
// )
// )
// );
generator.addProvider(event.includeServer(), (DataProvider.Factory<ModRecipesProvider>) ModRecipesProvider::new);
generator.addProvider(event.includeClient(), new ModItemModelProvider(generator.getPackOutput(), existingFileHelper));
}
}

View file

@ -0,0 +1,55 @@
package com.therealm18studios.lc.data;
import com.therealm18studios.lc.LibreComponents;
import li.cil.oc2r.common.entity.Entities;
import com.therealm18studios.lc.common.item.Items;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraftforge.client.model.generators.ItemModelBuilder;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.RegistryObject;
public final class ModItemModelProvider extends ItemModelProvider {
public ModItemModelProvider(final PackOutput output, final ExistingFileHelper existingFileHelper) {
super(output, LibreComponents.MOD_ID, existingFileHelper);
}
@Override
protected void registerModels() {
simple(Items.MEMORY_SMALL);
simple(Items.MEMORY_MEDIUM);
simple(Items.MEMORY_LARGE);
simple(Items.MEMORY_EXTRA_LARGE);
simple(Items.CPU_TIER_1);
simple(Items.CPU_TIER_2);
simple(Items.CPU_TIER_3);
simple(Items.CPU_TIER_4);
simple(Items.HARD_DRIVE_SMALL, "item/hard_drive_base")
.texture("layer1", "item/hard_drive_tint");
simple(Items.HARD_DRIVE_MEDIUM, "item/hard_drive_base")
.texture("layer1", "item/hard_drive_tint");
simple(Items.HARD_DRIVE_LARGE, "item/hard_drive_base")
.texture("layer1", "item/hard_drive_tint");
simple(Items.HARD_DRIVE_EXTRA_LARGE, "item/hard_drive_base")
.texture("layer1", "item/hard_drive_tint");
simple(Items.FLOPPY, "item/floppy_base")
.texture("layer1", "item/floppy_tint");
simple(Items.FLOPPY_MODERN, "item/floppy_base")
.texture("layer1", "item/floppy_tint");
withExistingParent(Entities.ROBOT.getId().getPath(), "template_shulker_box");
}
private <T extends Item> void simple(final RegistryObject<T> item) {
simple(item, "item/" + item.getId().getPath());
}
private <T extends Item> ItemModelBuilder simple(final RegistryObject<T> item, final String texturePath) {
return singleTexture(item.getId().getPath(),
new ResourceLocation("item/generated"),
"layer0",
new ResourceLocation(LibreComponents.MOD_ID, texturePath));
}
}

View file

@ -0,0 +1,441 @@
package com.therealm18studios.lc.data;
import com.therealm18studios.lc.common.item.Items;
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.*;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.common.Tags;
import java.util.function.Consumer;
public final class ModRecipesProvider extends RecipeProvider {
public ModRecipesProvider(final PackOutput output) {
super(output);
}
@Override
protected void buildRecipes(final Consumer<FinishedRecipe> consumer) {
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.COMPUTER.get())
// .pattern("ICI")
// .pattern("XTX")
// .pattern("IBI")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('C', Tags.Items.CHESTS_WOODEN)
// .define('X', Items.BUS_INTERFACE.get())
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
// .unlockedBy("has_circuit_board", inventoryChange(Items.CIRCUIT_BOARD.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.BUS_CABLE.get(), 16)
// .pattern("III")
// .pattern("GTG")
// .pattern("III")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('G', Tags.Items.INGOTS_GOLD)
// .define('T', Items.TRANSISTOR.get())
// .unlockedBy("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
// .save(consumer);
//
// ShapelessRecipeBuilder
// .shapeless(RecipeCategory.MISC, Items.BUS_INTERFACE.get())
// .requires(Items.TRANSISTOR.get())
// .requires(Items.BUS_CABLE.get())
// .unlockedBy("has_bus_cable", inventoryChange(Items.BUS_CABLE.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.NETWORK_CONNECTOR.get(), 4)
// .pattern("IGI")
// .pattern("ITI")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('G', Tags.Items.GLASS)
// .define('T', Items.TRANSISTOR.get())
// .unlockedBy("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.NETWORK_HUB.get())
// .pattern("ICI")
// .pattern("XTX")
// .pattern("IBI")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('C', Items.NETWORK_CONNECTOR.get())
// .define('X', Items.BUS_INTERFACE.get())
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_network_connector", inventoryChange(Items.NETWORK_CONNECTOR.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.REDSTONE_INTERFACE.get())
// .pattern("ICI")
// .pattern("XTX")
// .pattern("IBI")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('C', net.minecraft.world.item.Items.COMPARATOR)
// .define('T', Items.TRANSISTOR.get())
// .define('X', Items.BUS_INTERFACE.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.DISK_DRIVE.get())
// .pattern("IUI")
// .pattern("XTD")
// .pattern("IBI")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('U', ItemTags.BUTTONS)
// .define('T', Items.TRANSISTOR.get())
// .define('X', Items.BUS_INTERFACE.get())
// .define('D', net.minecraft.world.item.Items.DISPENSER)
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.KEYBOARD.get())
// .pattern("UUU")
// .pattern("XTU")
// .pattern("IBI")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('U', ItemTags.BUTTONS)
// .define('T', Items.TRANSISTOR.get())
// .define('X', Items.BUS_INTERFACE.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.CHARGER.get())
// .pattern("IPI")
// .pattern("XTX")
// .pattern("IRI")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('P', net.minecraft.world.item.Items.LIGHT_WEIGHTED_PRESSURE_PLATE)
// .define('T', Items.TRANSISTOR.get())
// .define('X', Items.BUS_INTERFACE.get())
// .define('R', Tags.Items.STORAGE_BLOCKS_REDSTONE)
// .unlockedBy("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.PROJECTOR.get())
// .pattern("GLG")
// .pattern("XTD")
// .pattern("GBG")
// .define('G', Tags.Items.INGOTS_GOLD)
// .define('L', net.minecraft.world.item.Items.REDSTONE_LAMP)
// .define('D', Tags.Items.GEMS_DIAMOND)
// .define('T', Items.TRANSISTOR.get())
// .define('X', Items.BUS_INTERFACE.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
// .save(consumer);
//
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.WRENCH.get())
// .pattern("I I")
// .pattern(" T ")
// .pattern(" I ")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .unlockedBy("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
// .save(consumer);
//
// WrenchRecipeBuilder
// .wrenchRecipe(Items.MANUAL.get())
// .requires(net.minecraft.world.item.Items.BOOK)
// .unlockedBy("has_book", inventoryChange(net.minecraft.world.item.Items.BOOK))
// .unlockedBy("has_wrench", inventoryChange(Items.WRENCH.get()))
// .save(consumer);
//
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.NETWORK_CABLE.get(), 8)
// .pattern("SSS")
// .pattern("GTG")
// .pattern("SSS")
// .define('S', Tags.Items.STRING)
// .define('G', Tags.Items.GLASS)
// .define('T', Items.TRANSISTOR.get())
// .unlockedBy("has_network_connector", inventoryChange(Items.NETWORK_CONNECTOR.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.ROBOT.get())
// .pattern("ICI")
// .pattern("PTP")
// .pattern("IBI")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('C', Tags.Items.CHESTS_WOODEN)
// .define('P', net.minecraft.world.item.Items.PISTON)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
// .unlockedBy("has_circuit_board", inventoryChange(Items.CIRCUIT_BOARD.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.MEMORY_SMALL.get(), 2)
// .pattern("ITI")
// .pattern(" B ")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.MEMORY_MEDIUM.get(), 2)
// .pattern("GTG")
// .pattern(" B ")
// .define('G', Tags.Items.INGOTS_GOLD)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.MEMORY_LARGE.get(), 2)
// .pattern("DTD")
// .pattern(" B ")
// .define('D', Tags.Items.GEMS_DIAMOND)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.MEMORY_EXTRA_LARGE.get(), 2)
// .pattern("DTD")
// .pattern("EBE")
// .pattern("DTD")
// .define('D', Tags.Items.GEMS_DIAMOND)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .define('E', Tags.Items.GEMS_EMERALD)
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.HARD_DRIVE_SMALL.get())
// .pattern("ITI")
// .pattern("EBE")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .define('E', Tags.Items.GEMS_EMERALD)
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.HARD_DRIVE_MEDIUM.get())
// .pattern("GTG")
// .pattern("EBE")
// .define('G', Tags.Items.INGOTS_GOLD)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .define('E', Tags.Items.GEMS_EMERALD)
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.HARD_DRIVE_LARGE.get())
// .pattern("DTD")
// .pattern("EBE")
// .define('D', Tags.Items.GEMS_DIAMOND)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .define('E', Tags.Items.GEMS_EMERALD)
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.HARD_DRIVE_EXTRA_LARGE.get())
// .pattern("ETE")
// .pattern("DBD")
// .pattern("EBE")
// .define('D', Tags.Items.GEMS_DIAMOND)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .define('E', Tags.Items.GEMS_EMERALD)
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// WrenchRecipeBuilder
// .wrenchRecipe(Items.HARD_DRIVE_CUSTOM.get())
// .requires(Items.HARD_DRIVE_LARGE.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.FLASH_MEMORY.get())
// .pattern("ITI")
// .pattern("RBR")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('R', Tags.Items.DUSTS_REDSTONE)
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// WrenchRecipeBuilder
// .wrenchRecipe(Items.FLASH_MEMORY_CUSTOM.get())
// .requires(Items.FLASH_MEMORY.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.REDSTONE_INTERFACE_CARD.get())
// .pattern("IRT")
// .pattern(" B ")
// .define('R', net.minecraft.world.item.Items.REDSTONE_TORCH)
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.NETWORK_INTERFACE_CARD.get())
// .pattern("IGT")
// .pattern(" B ")
// .define('G', Tags.Items.GLASS)
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.NETWORK_TUNNEL_CARD.get())
// .pattern("IET")
// .pattern(" B ")
// .define('E', Tags.Items.ENDER_PEARLS)
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.FILE_IMPORT_EXPORT_CARD.get())
// .pattern("IET")
// .pattern(" B ")
// .define('E', net.minecraft.world.item.Items.PAPER)
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.SOUND_CARD.get())
// .pattern("IST")
// .pattern(" B ")
// .define('S', net.minecraft.world.item.Items.NOTE_BLOCK)
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.FLOPPY.get())
// .pattern("ITI")
// .pattern("QBQ")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('Q', Tags.Items.GEMS_QUARTZ)
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_disk_drive", inventoryChange(Items.DISK_DRIVE.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.FLOPPY_MODERN.get())
// .pattern("ITI")
// .pattern("QBQ")
// .pattern("QBQ")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('T', Items.TRANSISTOR.get())
// .define('Q', Tags.Items.GEMS_QUARTZ)
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_disk_drive", inventoryChange(Items.DISK_DRIVE.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.INVENTORY_OPERATIONS_MODULE.get())
// .pattern("TCG")
// .pattern(" B ")
// .define('T', Items.TRANSISTOR.get())
// .define('C', Tags.Items.CHESTS_WOODEN)
// .define('G', Tags.Items.INGOTS_GOLD)
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.BLOCK_OPERATIONS_MODULE.get())
// .pattern("TPG")
// .pattern(" B ")
// .define('T', Items.TRANSISTOR.get())
// .define('P', net.minecraft.world.item.Items.DIAMOND_PICKAXE)
// .define('G', Tags.Items.INGOTS_GOLD)
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.NETWORK_TUNNEL_MODULE.get())
// .pattern("TEG")
// .pattern(" B ")
// .define('T', Items.TRANSISTOR.get())
// .define('E', Tags.Items.ENDER_PEARLS)
// .define('G', Tags.Items.INGOTS_GOLD)
// .define('B', Items.CIRCUIT_BOARD.get())
// .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
// .save(consumer);
//
//
// ShapedRecipeBuilder
// .shaped(RecipeCategory.MISC, Items.TRANSISTOR.get(), 12)
// .pattern("RCR")
// .pattern("III")
// .define('I', Tags.Items.INGOTS_IRON)
// .define('R', Tags.Items.DUSTS_REDSTONE)
// .define('C', net.minecraft.world.item.Items.COMPARATOR)
// .unlockedBy("has_gold", inventoryChange(net.minecraft.world.item.Items.GOLD_INGOT))
// .save(consumer);
//
// ShapelessRecipeBuilder
// .shapeless(RecipeCategory.MISC, Items.CIRCUIT_BOARD.get(), 6)
// .requires(Tags.Items.INGOTS_GOLD)
// .requires(net.minecraft.world.item.Items.CLAY_BALL)
// .requires(Items.TRANSISTOR.get())
// .unlockedBy("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
// .save(consumer);
}
private static InventoryChangeTrigger.TriggerInstance inventoryChange(final ItemLike item) {
return InventoryChangeTrigger.TriggerInstance.hasItems(item);
}
}

View file

@ -0,0 +1,38 @@
modLoader = "javafml"
loaderVersion = "[47,)"
issueTrackerURL = "https://github.com/fnuecke/oc2r/issues"
license = "MIT"
[[mods]]
modId = "librecomponents"
version = "${file.jarVersion}"
displayName = "Libre Components"
authors = "The Realm 18 Studios"
description = '''
Libre Drives all the extra components you need.
'''
[[dependencies.librecomponents]]
modId = "forge"
mandatory = true
versionRange = "[40.1.68,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.librecomponents]]
modId = "minecraft"
mandatory = true
versionRange = "1.20.1"
ordering = "NONE"
side = "BOTH"
[[dependencies.librecomponents]]
modId = "oc2r"
mandatory = false
versionRange = "[1.1.0,)"
side = "BOTH"
ordering = "AFTER"
[[dependencies.librecomponents]]
modId = "libracomputing"
mandatory = false
versionRange = "[0,)"
side = "BOTH"
ordering = "AFTER"

View file

@ -0,0 +1,16 @@
{
"item_group.librecomponents.common": "Libre Components",
"item.librecomponents.cpu_tier_1": "CPU Tier 5",
"item.librecomponents.cpu_tier_1.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_2": "CPU Tier 6",
"item.librecomponents.cpu_tier_2.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_3": "CPU Tier 7",
"item.librecomponents.cpu_tier_3.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_4": "CPU Tier 8",
"item.librecomponents.cpu_tier_4.desc": "Processes computer instructions.",
"item.librecomponents.floppy": "Floppy Disk",
"item.librecomponents.floppy.desc": "Portable storage used to transfer data between Computers.",
"item.librecomponents.floppy_modern": "Modern Floppy Disk",
"item.librecomponents.floppy_modern.desc": "Newer version of portable storage used to transfer data between Computers."
}

View file

@ -0,0 +1,20 @@
{
"item_group.librecomponents.common": "Libre Components",
"item.librecomponents.cpu_tier_1": "CPU уровень 5",
"item.librecomponents.cpu_tier_1.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_2": "CPU уровень 6",
"item.librecomponents.cpu_tier_2.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_3": "CPU уровень 7",
"item.librecomponents.cpu_tier_3.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_4": "CPU уровень 8",
"item.librecomponents.cpu_tier_4.desc": "Processes computer instructions.",
"item.librecomponents.floppy": "Дискета",
"item.librecomponents.floppy.desc": "Съемный накопитель для переноса данных между компьютерами.",
"item.librecomponents.floppy_modern": "Современная дискета",
"item.librecomponents.floppy_modern.desc": "Новая версия портативного хранилища, используемого для передачи данных между компьютерами.",
"item.librecomponents.hard_drive": "Жесткий диск",
"item.librecomponents.hard_drive.desc": "Накопитель для операционных систем и данных.",
"item.librecomponents.memory": "Память",
"item.librecomponents.memory.desc": "Оперативное Запоминающее Устройство (ОЗУ). Используется в компьютерах и роботах."
}

View file

@ -0,0 +1,20 @@
{
"item_group.librecomponents.common": "Libre Components",
"item.librecomponents.cpu_tier_1": "CPU Tier 5",
"item.librecomponents.cpu_tier_1.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_2": "CPU Tier 6",
"item.librecomponents.cpu_tier_2.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_3": "CPU Tier 7",
"item.librecomponents.cpu_tier_3.desc": "Processes computer instructions.",
"item.librecomponents.cpu_tier_4": "CPU Tier 8",
"item.librecomponents.cpu_tier_4.desc": "Processes computer instructions.",
"item.librecomponents.floppy": "软盘",
"item.librecomponents.floppy.desc": "Portable storage used to transfer data between Computers.",
"item.librecomponents.floppy_modern": "现代软盘",
"item.librecomponents.floppy_modern.desc": "用于在计算机之间传输数据的较新版本的便携式存储。",
"item.librecomponents.hard_drive": "硬盘",
"item.librecomponents.hard_drive.desc": "Mass storage for operating systems and data.",
"item.librecomponents.memory": "内存条",
"item.librecomponents.memory.desc": "Random Access Memory (RAM) used in Computers and Robots."
}

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "librecomponents:item/floppy_base",
"layer1": "librecomponents:item/floppy_tint"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "librecomponents:item/floppy_base",
"layer1": "librecomponents:item/floppy_tint"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "librecomponents:item/hard_drive_base",
"layer1": "librecomponents:item/hard_drive_tint"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "librecomponents:item/hard_drive_base",
"layer1": "librecomponents:item/hard_drive_tint"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "librecomponents:item/hard_drive_base",
"layer1": "librecomponents:item/hard_drive_tint"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "librecomponents:item/hard_drive_base",
"layer1": "librecomponents:item/hard_drive_tint"
}
}

View file

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

View file

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

View file

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

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -0,0 +1,17 @@
{
"replace": false,
"values": [
"librecomponents:hard_drive_small",
"librecomponents:hard_drive_medium",
"librecomponents:hard_drive_large",
"librecomponents:hard_drive_extra_large",
"librecomponents:memory_small",
"librecomponents:memory_medium",
"librecomponents:memory_large",
"librecomponents:memory_extra_large",
"librecomponents:cpu_tier_1",
"librecomponents:cpu_tier_2",
"librecomponents:cpu_tier_3",
"librecomponents:cpu_tier_4"
]
}

View file

@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"librecomponents:cpu_tier_1",
"librecomponents:cpu_tier_2",
"librecomponents:cpu_tier_3",
"librecomponents:cpu_tier_4"
]
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"librecomponents:floppy",
"librecomponents:floppy_modern"
]
}

View file

@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"librecomponents:hard_drive_small",
"librecomponents:hard_drive_medium",
"librecomponents:hard_drive_large",
"librecomponents:hard_drive_extra_large"
]
}

View file

@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"librecomponents:memory_small",
"librecomponents:memory_medium",
"librecomponents:memory_large",
"librecomponents:memory_extra_large"
]
}

View file

@ -0,0 +1,14 @@
{
"minVersion": "0.8.5",
"compatibilityLevel": "JAVA_17",
"required": true,
"package": "",
"refmap": "",
"mixins": [
],
"client": [
],
"injectors": {
"defaultRequire": 5
}
}

View file

@ -0,0 +1,6 @@
{
"pack": {
"description": "Resources",
"pack_format": 15
}
}

View file

@ -0,0 +1,45 @@
---
name: Bug report
about: Report an issue of the mod crashing or behaving in an unexpected way
title: ''
labels: bug
assignees: ''
---
---
name: Bug report
about: Report an issue of the mod crashing or behaving in an unexpected way
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Singleplayer or multiplayer?
2. Place block '....'
3. Interact with '....'
4. See error '...'
**Log files**
Please post your log files (client and server) to gist and link them here.
If it's a crash report, please also upload the crash report to gist and link it here.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Versions (please complete the following information):**
- Minecraft: [e.g. 1.18.2]
- Forge: [e.g. 40.0.40]
- oc2r: [e.g. 0.1.7]
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -0,0 +1,37 @@
name: build
on:
pull_request:
push:
branches: [ '**' ]
jobs:
build:
strategy:
matrix:
java: [ 17 ]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew build
env:
GPR_USER: ${{ secrets.GPR_USER }}
GPR_KEY: ${{ secrets.GPR_KEY }}

View file

@ -0,0 +1,101 @@
name: publish
on:
release:
types: [published]
jobs:
publish-github:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract Version from Tag
uses: rishabhgupta/split-by@v1
id: split_tag
with:
string: ${{ github.event.release.tag_name }}
split-by: '/'
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ubuntu-latest-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ubuntu-latest-gradle-
- name: Build with Gradle
run: ./gradlew -Psemver='${{ steps.split_tag.outputs._1 }}' build
env:
GPR_USER: ${{ secrets.GPR_USER }}
GPR_KEY: ${{ secrets.GPR_KEY }}
- name: Add Artifacts to Github Release
uses: alexellis/upload-assets@0.3.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["./build/libs/*.jar"]'
- name: Publish to Github Packages
run: gradle -Psemver='${{ steps.split_tag.outputs._1 }}' publish
env:
GPR_USER: ${{ secrets.GPR_USER }}
GPR_KEY: ${{ secrets.GPR_KEY }}
GITHUB_MAVEN_URL: 'https://maven.pkg.github.com/${{ github.repository }}'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-curse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract Version from Tag
uses: rishabhgupta/split-by@v1
id: split_tag
with:
string: ${{ github.event.release.tag_name }}
split-by: '/'
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ubuntu-latest-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ubuntu-latest-gradle-
# Set Curseforge release type based on pre-release flag.
- name: Set release type to 'release'
run: |
echo "CURSEFORGE_RELEASE_TYPE=release" >> $GITHUB_ENV
if: github.event.release.prerelease == false
- name: Set release type to 'alpha'
run: |
echo "CURSEFORGE_RELEASE_TYPE=alpha" >> $GITHUB_ENV
if: github.event.release.prerelease == true
- name: Publish to Curseforge
run: ./gradlew -Psemver='${{ steps.split_tag.outputs._1 }}' curseforge
env:
GPR_USER: ${{ secrets.GPR_USER }}
GPR_KEY: ${{ secrets.GPR_KEY }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
CURSEFORGE_RELEASE_TYPE: ${{ env.CURSEFORGE_RELEASE_TYPE }}
CHANGELOG: ${{ github.event.release.body }}