Compare commits

..
28 Commits
Author SHA1 Message Date
Glease 33d377cea7 pull in buildscript changes 2022-03-02 00:32:50 +08:00
Glease da98b476b0 fix off by one overflow 2022-03-01 23:56:04 +08:00
Martin Robertz 9dd145bc67 Merge pull request #4 from iouter/master
Update zh_CN.lang
2022-02-07 18:13:46 +01:00
iouter 83b7c35ed1 Update zh_CN.lang 2022-02-05 00:06:12 +08:00
Glease bb0bebf3a2 add debug log on multi passing check 2022-01-19 18:47:13 +08:00
Jason Mitchell a49ed1996b maven publish buildscript update 2022-01-17 23:58:46 -08:00
Martin Robertz 6d5d31f5ab Merge pull request #3 from GTNewHorizons/GTNH-Colen-patch-1
QoL fix for item description
2022-01-02 12:32:48 +01:00
GTNH-Colen 3eafe426ba QoL fix for item description
This item will now show in NEI when schematic is searched, in line with old TT schematic. The description is also more grammatically correct (removed extra caps).
2022-01-02 08:58:49 +00:00
Glease eea5227fe3 Pull my onlyIf from GT++ 2021-12-22 21:20:27 +08:00
Glease 1f520cfd73 Add localization stuff I forgot 2021-12-22 21:17:47 +08:00
Martin Robertz 8357fdc826 ignore bat files 2021-12-02 23:44:16 +01:00
Johann Bernhardt 27bb7b2ad9 Update build script and CI 2021-11-30 17:58:54 +08:00
Johann Bernhardt b9af0ef491 Migrated to unified build script (#1) 2021-11-24 19:02:27 +08:00
Glease 7f19399ba3 Bump version 2021-09-08 22:08:59 +08:00
Glease 4982bb780d Add a debug check to sniff out errors like typos 2021-09-08 22:07:50 +08:00
DreamMasterXXL a069612e04 bump version 2021-08-16 14:11:01 +02:00
iouter ab09b791bd Update zh_CN.lang (#2)
* Add zh_CN.lang

* Update zh_CN.lang
2021-08-11 17:32:17 +08:00
Glease b086a65828 Fix typo in ofBlockUnlocalizedName
also added standard way of toggling debug mode pogrammatically
2021-08-01 03:07:51 +08:00
Glease f1f6dae00f Add generalized GT5's ofCoil 2021-07-22 12:08:24 +08:00
Glease 68c5436496 Add option to related to hologram projection
Also made clear what's public api and what's not.
2021-07-21 17:26:28 +08:00
iouter c4eb372cfb Add zh_CN.lang 2021-07-21 15:57:16 +08:00
Glease 2446ad2db7 attempt to fix buildscript 2021-07-21 14:10:05 +08:00
Glease 906961b6c8 differentiate between TecTech items and our items 2021-07-19 19:30:49 +08:00
Glease 393045d4f2 Add utility method for lazy initialized structure elements 2021-07-19 17:45:18 +08:00
Glease 74baa66f52 Fix invisible hint particles 2021-07-19 14:48:33 +08:00
Glease 24928454fd Pull utility methods up from gregtech 2021-07-19 14:48:33 +08:00
Glease 34ceda8ccc Create gradle.yml 2021-06-29 02:12:56 +08:00
Glease c78c61f45e Add missing texture
forgot to check in the texture...
2021-06-25 15:03:04 +08:00
43 changed files with 2108 additions and 206 deletions

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
# This is the universal Text Editor Configuration
# for all GTNewHorizons projects
# See: https://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{bat,ini}]
end_of_line = crlf
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
indent_size = 2
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# bashsupport disable=BP5006 # Global environment variables
RUNDIR="run" \
CRASH="crash-reports" \
SERVERLOG="server.log"
# enable nullglob to get 0 results when no match rather than the pattern
shopt -s nullglob
# store matches in array
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
# if array not empty there are crash_reports
if [ "${#crash_reports[@]}" -gt 0 ]; then
# get the latest crash_report from array
latest_crash_report="${crash_reports[-1]}"
{
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
cat "$latest_crash_report"
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
{
printf 'Fatal errors detected:\n'
cat server.log
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
"$SERVERLOG"; then
{
printf 'Server force stopped:'
cat server.log
} >&2
exit 1
fi
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
{
printf 'Server did not finish startup:'
cat server.log
} >&2
exit 1
fi
printf 'No crash reports detected'
exit 0
+45
View File
@@ -0,0 +1,45 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Run server for 1.5 minutes
run: |
mkdir run
echo "eula=true" > run/eula.txt
timeout 90 ./gradlew runServer 2>&1 | tee -a server.log || true
- name: Test no errors reported during server run
run: |
chmod +x .github/scripts/test_no_error_reports
.github/scripts/test_no_error_reports
+51
View File
@@ -0,0 +1,51 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release tagged build
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Release under current tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "${{ env.RELEASE_VERSION }}"
files: build/libs/*.jar
- name: Publish to Maven
run: ./gradlew publish
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
+28 -19
View File
@@ -1,20 +1,29 @@
*.class
*.log
*.ctxt
.mtj.tmp/
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
hs_err_pid*
.gradle
**/build/
!src/**/build/
gradle-app.setting
!gradle-wrapper.jar
.gradletasknamecache
.idea/
run/
.settings
/.idea/
/run/
/build/
/eclipse/
.classpath
.project
/bin/
/config/
/crash-reports/
/logs/
options.txt
/saves/
usernamecache.json
banned-ips.json
banned-players.json
eula.txt
ops.json
server.properties
servers.dat
usercache.json
whitelist.json
/out/
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
*.bat
+3
View File
@@ -0,0 +1,3 @@
# Any Github changes require admin approval
/.github/** @GTNewHorizons/admin
+714 -33
View File
@@ -1,65 +1,746 @@
//version: 1644894948
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory
import java.util.concurrent.TimeUnit
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
name 'forge'
url 'https://maven.minecraftforge.net'
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}
maven {
name 'jitpack'
url 'https://jitpack.io'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.1'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
}
}
plugins {
id 'java-library'
id 'idea'
id 'eclipse'
id 'scala'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
id 'org.ajoberstar.grgit' version '4.1.1'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'com.palantir.git-version' version '0.13.0' apply false
id 'de.undercouch.download' version '5.0.1'
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
}
if (project.file('.git/HEAD').isFile()) {
apply plugin: 'com.palantir.git-version'
}
def out = services.get(StyledTextOutputFactory).create('an-output')
apply plugin: 'forge'
version = modVersion
group= modGroup
archivesBaseName = modBaseName
def projectJavaVersion = JavaLanguageVersion.of(8)
sourceCompatibility = 1.8
targetCompatibility = 1.8
minecraft {
version = project.forgeVersion
replaceIn "StructureLib.java"
replace '${version}', project.version
runDir = "run"
java {
toolchain {
languageVersion.set(projectJavaVersion)
}
}
processResources
{
idea {
module {
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
checkPropertyExists("modName")
checkPropertyExists("modId")
checkPropertyExists("modGroup")
checkPropertyExists("autoUpdateBuildScript")
checkPropertyExists("minecraftVersion")
checkPropertyExists("forgeVersion")
checkPropertyExists("replaceGradleTokenInFile")
checkPropertyExists("gradleTokenModId")
checkPropertyExists("gradleTokenModName")
checkPropertyExists("gradleTokenVersion")
checkPropertyExists("gradleTokenGroupName")
checkPropertyExists("apiPackage")
checkPropertyExists("accessTransformersFile")
checkPropertyExists("usesMixins")
checkPropertyExists("mixinPlugin")
checkPropertyExists("mixinsPackage")
checkPropertyExists("coreModClass")
checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/"
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
if(apiPackage) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
}
if(accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if(!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
}
if(usesMixins.toBoolean()) {
if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
}
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
}
}
if(coreModClass) {
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
}
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
// Make sure GregTech build won't time out
System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
}
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
try {
'git config core.fileMode false'.execute()
}
catch (Exception ignored) {
out.style(Style.Failure).println("git isn't installed at all")
}
// Pulls version first from the VERSION env and then git tag
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
}
catch (Exception ignored) {
out.style(Style.Failure).text(
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
)
versionOverride = 'NO-GIT-TAG-SET'
identifiedVersion = versionOverride
}
version = minecraftVersion + '-' + identifiedVersion
ext {
modVersion = identifiedVersion
}
if(identifiedVersion == versionOverride) {
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
}
group = modGroup
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName
}
else {
archivesBaseName = modId
}
def arguments = []
def jvmArguments = []
if (usesMixins.toBoolean()) {
arguments += [
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
if (!project.hasProperty(usesMixinDebug) || usesMixinDebug.toBoolean()) {
jvmArguments += [
"-Dmixin.debug.countInjections=true",
"-Dmixin.debug.verbose=true",
"-Dmixin.debug.export=true"
]
}
}
minecraft {
version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion
runDir = 'run'
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
if(gradleTokenModId) {
replace gradleTokenModId, modId
}
if(gradleTokenModName) {
replace gradleTokenModName, modName
}
if(gradleTokenVersion) {
replace gradleTokenVersion, modVersion
}
if(gradleTokenGroupName) {
replace gradleTokenGroupName, modGroup
}
}
clientIntellijRun {
args(arguments)
jvmArgs(jvmArguments)
if(developmentEnvironmentUserName) {
args("--username", developmentEnvironmentUserName)
}
}
serverIntellijRun {
args(arguments)
jvmArgs(jvmArguments)
}
}
if(file('addon.gradle').exists()) {
apply from: 'addon.gradle'
}
apply from: 'repositories.gradle'
configurations {
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
}
repositories {
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
if(usesMixins.toBoolean()) {
maven {
name 'sponge'
url 'https://repo.spongepowered.org/repository/maven-public'
}
maven {
url 'https://jitpack.io'
}
}
}
dependencies {
if(usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT')
// using 0.8 to workaround a issue in 0.7 which fails mixin application
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
compile('com.github.GTNewHorizons:SpongeMixins:1.5.0')
}
}
apply from: 'dependencies.gradle'
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
task generateAssets {
if (usesMixins.toBoolean()) {
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
if (!mixinConfigFile.exists()) {
mixinConfigFile.text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
"plugin": "${modGroup}.${mixinPlugin}",
"refmap": "${mixingConfigRefMap}",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8",
"mixins": [],
"client": [],
"server": []
}
"""
}
}
}
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
}
shadowJar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
dependsOn(relocateShadowJar)
}
jar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(shadowJar)
enabled = false
}
}
reobf {
if(usesMixins.toBoolean()) {
addExtraSrgFile mixinSrg
}
}
afterEvaluate {
if(usesMixins.toBoolean()) {
tasks.compileJava {
options.compilerArgs += [
"-AreobfSrgFile=${tasks.reobf.srg}",
"-AoutSrgFile=${mixinSrg}",
"-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl",
"-XDignore.symbol.file"
]
}
}
}
runClient {
if(developmentEnvironmentUserName) {
arguments += [
"--username",
developmentEnvironmentUserName
]
}
args(arguments)
jvmArgs(jvmArguments)
}
runServer {
args(arguments)
jvmArgs(jvmArguments)
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion = projectJavaVersion
}
)
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': project.minecraft.version
// replace modVersion and minecraftVersion
expand "minecraftVersion": project.minecraft.version,
"modVersion": modVersion,
"modId": modId,
"modName": modName
}
if(usesMixins.toBoolean()) {
from refMap
}
// copy everything else that's not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
task deobfJar(type: Jar) {
def getManifestAttributes() {
def manifestAttributes = [:]
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if(usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) {
from (sourceSets.main.allSource)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
task shadowDevJar(type: ShadowJar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
classifier = 'deobf'
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
target = tasks.shadowDevJar
prefix = modGroup + ".shadow"
}
task circularResolverJar(type: Jar) {
dependsOn(relocateShadowDevJar)
dependsOn(shadowDevJar)
enabled = false
}
task devJar(type: Jar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(circularResolverJar)
enabled = false
}
}
task apiJar(type: Jar) {
from (sourceSets.main.allSource) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.output) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.resources.srcDirs) {
include("LICENSE")
}
getArchiveClassifier().set('api')
}
artifacts {
archives deobfJar
archives jar
}
idea {
module {
inheritOutputDirs = false
outputDir = new File(compileJava.destinationDir.parentFile.parentFile, "idea")
testOutputDir = new File(compileTestJava.destinationDir.parentFile.parentFile, "ideaTest")
if(!noPublishedSources) {
archives sourcesJar
}
archives devJar
if(apiPackage) {
archives apiJar
}
}
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
// and isn't strictly needed with the POM so just disable it.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
// workaround variable hiding in pom processing
def projectConfigs = project.configurations
publishing {
publications {
maven(MavenPublication) {
from components.java
if(usesShadowedDependencies.toBoolean()) {
artifact source: shadowJar, classifier: ""
}
if(!noPublishedSources) {
artifact source: sourcesJar, classifier: "src"
}
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
// remove extra garbage from minecraft and minecraftDeps configuration
pom.withXml {
def badArtifacts = [:].withDefault {[] as Set<String>}
for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) {
for (dependency in configuration.allDependencies) {
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
}
}
// example for specifying extra stuff to ignore
// badArtifacts["org.example.group"] += "artifactName"
Node pomNode = asNode()
pomNode.dependencies.'*'.findAll() {
badArtifacts[it.groupId.text()].contains(it.artifactId.text())
}.each() {
it.parent().remove(it)
}
}
}
}
repositories {
maven {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
}
// Updating
task updateBuildScript {
doLast {
if (performBuildScriptUpdate(projectDir.toString())) return
print("Build script already up-to-date!")
}
}
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
}
}
static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
}
boolean performBuildScriptUpdate(String projectDir) {
if (isNewBuildScriptVersionAvailable(projectDir)) {
def buildscriptFile = getFile("build.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
return true
}
return false
}
boolean isNewBuildScriptVersionAvailable(String projectDir) {
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript)
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
}
static String getVersionHash(String buildScriptContent) {
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
if(versionLine != null) {
return versionLine.split(": ").last()
}
return ""
}
configure(updateBuildScript) {
group = 'forgegradle'
description = 'Updates the build script to the latest version'
}
// Deobfuscation
def deobf(String sourceURL) {
try {
URL url = new URL(sourceURL)
String fileName = url.getFile()
//get rid of directories:
int lastSlash = fileName.lastIndexOf("/")
if(lastSlash > 0) {
fileName = fileName.substring(lastSlash + 1)
}
//get rid of extension:
if(fileName.endsWith(".jar")) {
fileName = fileName.substring(0, fileName.lastIndexOf("."))
}
String hostName = url.getHost()
if(hostName.startsWith("www.")) {
hostName = hostName.substring(4)
}
List parts = Arrays.asList(hostName.split("\\."))
Collections.reverse(parts)
hostName = String.join(".", parts)
return deobf(sourceURL, hostName + "/" + fileName)
} catch(Exception e) {
return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode()))
}
}
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
def deobf(String sourceURL, String fileName) {
String cacheDir = System.getProperty("user.home") + "/.gradle/caches/"
String bon2Dir = cacheDir + "forge_gradle/deobf"
String bon2File = bon2Dir + "/BON2-2.5.0.jar"
String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar"
String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar"
if(file(deobfFile).exists()) {
return files(deobfFile)
}
download.run {
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar'
dest bon2File
quiet true
overwrite false
}
download.run {
src sourceURL
dest obfFile
quiet true
overwrite false
}
exec {
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
workingDir bon2Dir
standardOutput = new ByteArrayOutputStream()
}
return files(deobfFile)
}
// Helper methods
def checkPropertyExists(String propertyName) {
if (!project.hasProperty(propertyName)) {
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
def getFile(String relativePath) {
return new File(projectDir, relativePath)
}
+5
View File
@@ -0,0 +1,5 @@
// Add your dependencies here
dependencies {
}
+59 -4
View File
@@ -1,5 +1,60 @@
modGroup = com.gtnewhorizon
modVersion = 1.0.3
modBaseName = StructureLib
modName = StructureLib
forgeVersion = 1.7.10-10.13.4.1614-1.7.10
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = structurelib
modGroup = com.gtnewhorizon.structurelib
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = "Developer"
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = StructureLib.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatability only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
Binary file not shown.
+1 -2
View File
@@ -1,6 +1,5 @@
#Sat Jan 04 01:52:14 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
Vendored
+77 -53
View File
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
#
# Copyright 2015 the original author or 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.
#
##############################################################################
##
@@ -6,47 +22,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@@ -61,9 +36,49 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$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 "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# 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
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -90,7 +105,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -110,10 +125,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -154,11 +170,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
+20 -10
View File
@@ -1,3 +1,19 @@
@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
@@ -8,14 +24,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@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=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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
@@ -46,10 +62,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
+5
View File
@@ -0,0 +1,5 @@
// Add any additional repositiroes for your dependencies here
repositories {
}
@@ -0,0 +1,68 @@
package com.gtnewhorizon.structurelib;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import java.io.File;
import java.util.Map;
public enum ConfigurationHandler {
INSTANCE;
private Configuration config;
private int maxCoexistingHologram;
private boolean removeCollidingHologram;
ConfigurationHandler() {
FMLCommonHandler.instance().bus().register(this);
}
void init(File f) {
config = new Configuration(f, ConfigurationVersion.latest().getVersionMarker());
ConfigurationVersion.migrateToLatest(config);
loadConfig();
setLanguageKeys();
}
private void setLanguageKeys() {
for (String categoryName : config.getCategoryNames()) {
ConfigCategory category = config.getCategory(categoryName);
category.setLanguageKey("structurelib.config." + categoryName);
for (Map.Entry<String, Property> entry : category.entrySet()) {
entry.getValue().setLanguageKey(String.format("%s.%s", category.getLanguagekey(), entry.getKey()));
}
}
}
private void loadConfig() {
maxCoexistingHologram = config.getInt("maxCoexisting", "client.hologram", 1, 1, 100, "An attempt will be made to prune old holograms when a new hologram is about to be projected");
removeCollidingHologram = config.getBoolean("removeColliding", "client.hologram", true, "An attempt will be made to remove an existing hologram if it collides with a new hologram.");
if (config.hasChanged()) {
config.save();
}
}
@SubscribeEvent
public void onConfigChange(ConfigChangedEvent.PostConfigChangedEvent e) {
if (e.modID.equals(StructureLibAPI.MOD_ID)) {
loadConfig();
}
}
public int getMaxCoexistingHologram() {
return maxCoexistingHologram;
}
public boolean isRemoveCollidingHologram() {
return removeCollidingHologram;
}
Configuration getConfig() {
return config;
}
}
@@ -0,0 +1,44 @@
package com.gtnewhorizon.structurelib;
import net.minecraftforge.common.config.Configuration;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Objects;
enum ConfigurationVersion {
V1 {
@Override
protected void step(Configuration c) {
}
};
private static final ConfigurationVersion[] VALUES = values();
private final String versionMarker;
ConfigurationVersion() {
this.versionMarker = name();
}
public static void migrateToLatest(Configuration c) {
for (int i = identify(c).ordinal() + 1; i < VALUES.length; i++) {
VALUES[i].step(c);
}
}
public static ConfigurationVersion latest() {
return VALUES[VALUES.length - 1];
}
public static ConfigurationVersion identify(Configuration c) {
return Arrays.stream(VALUES).filter(v -> Objects.equals(c.getLoadedConfigVersion(), v.getVersionMarker())).findFirst().orElse(V1);
}
@Nullable
public String getVersionMarker() {
return versionMarker;
}
protected abstract void step(Configuration c);
}
@@ -0,0 +1,28 @@
package com.gtnewhorizon.structurelib;
import cpw.mods.fml.client.IModGuiFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import java.util.Set;
public class GuiFactory implements IModGuiFactory {
@Override
public void initialize(Minecraft minecraftInstance) {
}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return GuiModConfig.class;
}
@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
}
@@ -0,0 +1,25 @@
package com.gtnewhorizon.structurelib;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import java.util.List;
import java.util.stream.Collectors;
public class GuiModConfig extends GuiConfig {
public GuiModConfig(GuiScreen guiScreen) {
super(guiScreen, getConfigElements(), StructureLibAPI.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.INSTANCE.getConfig().toString()));
}
@SuppressWarnings("rawtypes")
private static List<IConfigElement> getConfigElements() {
final Configuration config = ConfigurationHandler.INSTANCE.getConfig();
return config.getCategoryNames().stream()
.filter(name -> name.indexOf('.') == -1)
.map(name -> new ConfigElement(config.getCategory(name)))
.collect(Collectors.toList());
}
}
@@ -1,6 +1,6 @@
package com.gtnewhorizon.structurelib;
import com.gtnewhorizon.structurelib.alignment.AlignmentMessage;
import com.gtnewhorizon.structurelib.net.AlignmentMessage;
import com.gtnewhorizon.structurelib.block.BlockHint;
import com.gtnewhorizon.structurelib.item.ItemBlockHint;
import com.gtnewhorizon.structurelib.item.ItemConstructableTrigger;
@@ -26,15 +26,14 @@ import org.apache.logging.log4j.Logger;
/**
* This class does not contain a stable API. Refrain from using this class.
*/
@Mod(modid = StructureLib.MOD_ID, name = "StructureLib", version = "${version}", acceptableRemoteVersions = "*")
@Mod(modid = StructureLibAPI.MOD_ID, name = "StructureLib", version = "GRADLETOKEN_VERSION", acceptableRemoteVersions = "*", guiFactory = "com.gtnewhorizon.structurelib.GuiFactory")
public class StructureLib {
public static boolean DEBUG_MODE = true;
public static boolean DEBUG_MODE = Boolean.getBoolean("structurelib.debug");
public static Logger LOGGER = LogManager.getLogger("StructureLib");
public static final String MOD_ID = "structurelib";
@SidedProxy(serverSide = "com.gtnewhorizon.structurelib.proxy.CommonProxy", clientSide = "com.gtnewhorizon.structurelib.proxy.ClientProxy")
static CommonProxy proxy;
static SimpleNetworkWrapper net = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
static SimpleNetworkWrapper net = NetworkRegistry.INSTANCE.newSimpleChannel(StructureLibAPI.MOD_ID);
static {
net.registerMessage(AlignmentMessage.ServerHandler.class, AlignmentMessage.AlignmentQuery.class, 0, Side.SERVER);
@@ -57,10 +56,12 @@ public class StructureLib {
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {
ConfigurationHandler.INSTANCE.init(e.getSuggestedConfigurationFile());
GameRegistry.registerBlock(blockHint = new BlockHint(), ItemBlockHint.class, "blockhint");
itemBlockHint = ItemBlock.getItemFromBlock(StructureLibAPI.getBlockHint());
GameRegistry.registerItem(itemFrontRotationTool = new ItemFrontRotationTool(), itemFrontRotationTool.getUnlocalizedName());
GameRegistry.registerItem(itemConstructableTrigger = new ItemConstructableTrigger(), itemConstructableTrigger.getUnlocalizedName());
proxy.preInit(e);
}
public static void addClientSideChatMessages(String... messages) {
@@ -1,17 +1,24 @@
package com.gtnewhorizon.structurelib;
import com.gtnewhorizon.structurelib.alignment.AlignmentMessage;
import com.gtnewhorizon.structurelib.net.AlignmentMessage;
import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import static com.gtnewhorizon.structurelib.StructureLib.proxy;
/**
* A stable interface into the structure lib's internals. Backwards compatibility is maintained to the maximum extend possible.
*/
public class StructureLibAPI {
public static final String MOD_ID = "structurelib";
public static final int HINT_BLOCK_META_GENERIC_0 = 0;
public static final int HINT_BLOCK_META_GENERIC_1 = 1;
public static final int HINT_BLOCK_META_GENERIC_2 = 2;
@@ -28,6 +35,25 @@ public class StructureLibAPI {
public static final int HINT_BLOCK_META_AIR = 13;
public static final int HINT_BLOCK_META_NOT_AIR = 14;
public static final int HINT_BLOCK_META_ERROR = 15;
/**
* Start a batch of hinting. All hints particles generated during one batch will be considered to belong to one hologram.
*
* You don't need to call this unless your constructable tool didn't call {@link com.gtnewhorizon.structurelib.alignment.constructable.ConstructableUtility#handle(ItemStack, EntityPlayer, World, int, int, int, int)}
*/
public static void startHinting(World w) {
proxy.startHinting(w);
}
/**
* Start current batch of hinting. All hints particles generated during one batch will be considered to belong to one hologram.
*
* You don't need to call this unless your constructable tool didn't call {@link com.gtnewhorizon.structurelib.alignment.constructable.ConstructableUtility#handle(ItemStack, EntityPlayer, World, int, int, int, int)}
*/
public static void endHinting(World w) {
proxy.endHinting(w);
}
public static void hintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) {
proxy.hintParticleTinted(w, x, y, z, icons, RGBa);
}
@@ -44,22 +70,45 @@ public class StructureLibAPI {
proxy.hintParticle(w, x, y, z, block, meta);
}
/**
* Query the ExtendedFacing of this tile entity.
* The ExtendedFacing will later be set onto given tile entity via {@link com.gtnewhorizon.structurelib.alignment.IAlignment#setExtendedFacing(ExtendedFacing)}
* upon arrival of server reply.
* @throws IllegalArgumentException if is not tile entity or provided a null alignment
*/
public static void queryAlignment(IAlignmentProvider provider) {
StructureLib.net.sendToServer(new AlignmentMessage.AlignmentQuery(provider));
}
/**
* Send the ExtendedFacing of this Tile Entity to all players. Can be called on server side only.
* @throws IllegalArgumentException if is not tile entity or provided a null alignment
*/
public static void sendAlignment(IAlignmentProvider provider) {
StructureLib.net.sendToAll(new AlignmentMessage.AlignmentData(provider));
}
/**
* Send the ExtendedFacing of this Tile Entity to given player. Can be called on server side only.
* @throws IllegalArgumentException if is not tile entity or provided a null alignment
*/
public static void sendAlignment(IAlignmentProvider provider, EntityPlayerMP player) {
StructureLib.net.sendTo(new AlignmentMessage.AlignmentData(provider), player);
}
/**
* Send the ExtendedFacing of this Tile Entity to all players around target point. Can be called on server side only.
* @throws IllegalArgumentException if is not tile entity or provided a null alignment
*/
public static void sendAlignment(IAlignmentProvider provider, NetworkRegistry.TargetPoint targetPoint) {
StructureLib.net.sendToAllAround(new AlignmentMessage.AlignmentData(provider), targetPoint);
}
/**
* Send the ExtendedFacing of this Tile Entity to all players in that dimension. Can be called on server side only.
* @throws IllegalArgumentException if is not tile entity or provided a null alignment
*/
public static void sendAlignment(IAlignmentProvider provider, World dimension) {
StructureLib.net.sendToDimension(new AlignmentMessage.AlignmentData(provider), dimension.provider.dimensionId);
}
@@ -71,4 +120,12 @@ public class StructureLibAPI {
public static Item getItemBlockHint() {
return StructureLib.itemBlockHint;
}
public static boolean isDebugEnabled() {
return StructureLib.DEBUG_MODE;
}
public static void setDebugEnabled(boolean enabled) {
StructureLib.DEBUG_MODE = enabled;
}
}
@@ -14,6 +14,10 @@ public interface IAlignment extends IAlignmentLimits,IAlignmentProvider {
ExtendedFacing getExtendedFacing();
/**
* Set the facing without additional checks.
* Tools altering facing should use {@link #toolSetExtendedFacing(ExtendedFacing)} instead.
*/
void setExtendedFacing(ExtendedFacing alignment);
IAlignmentLimits getAlignmentLimits();
@@ -1,6 +1,7 @@
package com.gtnewhorizon.structurelib.alignment.constructable;
import com.gtnewhorizon.structurelib.StructureLib;
import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.alignment.IAlignment;
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import net.minecraft.entity.player.EntityPlayer;
@@ -17,6 +18,13 @@ public class ConstructableUtility {
}
public static boolean handle(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide) {
StructureLibAPI.startHinting(aWorld);
boolean ret = handle0(aStack, aPlayer, aWorld, aX, aY, aZ, aSide);
StructureLibAPI.endHinting(aWorld);
return ret;
}
private static boolean handle0(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null || aPlayer instanceof FakePlayer) {
return aPlayer instanceof EntityPlayerMP;
@@ -14,6 +14,10 @@ import java.util.HashMap;
public interface IMultiblockInfoContainer<T> {
HashMap<String, IMultiblockInfoContainer<?>> MULTIBLOCK_MAP = new HashMap<>();
/**
* There is no specific loading phase restriction, but you should generally not call it before the tile entity is
* properly registered.
*/
static <T extends TileEntity> void registerTileClass(Class<T> clazz, IMultiblockInfoContainer<?> info) {
MULTIBLOCK_MAP.put(clazz.getCanonicalName(), info);
}
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableSet;
import com.gtnewhorizon.structurelib.alignment.IAlignment;
import com.gtnewhorizon.structurelib.alignment.IntegerAxisSwap;
import com.gtnewhorizon.structurelib.util.Vec3Impl;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
@@ -276,6 +277,10 @@ public enum ExtendedFacing {
return this.name;
}
public String getLocalizedName() {
return StatCollector.translateToLocal("structurelib.facing." + getIndex());
}
public static ExtendedFacing byName(String name) {
return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT));
}
@@ -0,0 +1,5 @@
/**
* All public stuff in this package and its subpackages are considered part of the public API.
* Backwards compatibility is maintained to the maximum extend possible.
*/
package com.gtnewhorizon.structurelib.alignment;
@@ -1,6 +1,7 @@
package com.gtnewhorizon.structurelib.block;
import com.gtnewhorizon.structurelib.StructureLib;
import com.gtnewhorizon.structurelib.StructureLibAPI;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -26,22 +27,22 @@ public class BlockHint extends Block {
@Override
public void registerBlockIcons(IIconRegister aIconRegister) {
//super.registerBlockIcons(aIconRegister);
hint[0] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_0");
hint[1] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_1");
hint[2] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_2");
hint[3] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_3");
hint[4] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_4");
hint[5] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_5");
hint[6] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_6");
hint[7] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_7");
hint[8] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_8");
hint[9] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_9");
hint[10] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_10");
hint[11] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_11");
hint[12] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_DEFAULT");
hint[13] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_AIR");
hint[14] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_NOAIR");
hint[15] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_ERROR");
hint[0] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_0");
hint[1] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_1");
hint[2] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_2");
hint[3] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_3");
hint[4] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_4");
hint[5] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_5");
hint[6] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_6");
hint[7] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_7");
hint[8] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_8");
hint[9] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_9");
hint[10] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_10");
hint[11] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_11");
hint[12] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_DEFAULT");
hint[13] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_AIR");
hint[14] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_NOAIR");
hint[15] = aIconRegister.registerIcon(StructureLibAPI.MOD_ID + ":iconsets/HINT_ERROR");
}
@Override
@@ -1,6 +1,7 @@
package com.gtnewhorizon.structurelib.entity.fx;
import com.gtnewhorizon.structurelib.StructureLib;
import com.gtnewhorizon.structurelib.proxy.ClientProxy;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -12,11 +13,11 @@ import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class BlockHint extends EntityFX {
public class EntityFXBlockHint extends EntityFX {
private IIcon[] icons;
private short[] mRGBa = {255,255,255,0};
public BlockHint(World world){
public EntityFXBlockHint(World world){
this(world,0,0,0, Blocks.stone,0);
}
@@ -28,7 +29,7 @@ public class BlockHint extends EntityFX {
* @param z
* @param icons DOWN, UP, NORTH, SOUTH, WEST, EAST
*/
public BlockHint(World world, int x, int y, int z, IIcon[] icons) {
public EntityFXBlockHint(World world, int x, int y, int z, IIcon[] icons) {
super(world, x + .25, y + .5, z + .25);
particleGravity = 0;
prevPosX = posX;
@@ -39,7 +40,7 @@ public class BlockHint extends EntityFX {
this.icons=icons;
}
public BlockHint(World world, int x, int y, int z, Block block, int meta) {
public EntityFXBlockHint(World world, int x, int y, int z, Block block, int meta) {
super(world, x+.25, y+.5, z+.25);
particleGravity = 0;
prevPosX = posX;
@@ -53,7 +54,7 @@ public class BlockHint extends EntityFX {
}
}
public BlockHint withColorTint(short[] coloure){
public EntityFXBlockHint withColorTint(short[] coloure){
this.mRGBa =coloure;
return this;
}
@@ -130,4 +131,10 @@ public class BlockHint extends EntityFX {
public boolean shouldRenderInPass(int pass) {
return pass==2;
}
@Override
public void setDead() {
super.setDead();
ClientProxy.onHintDead(this);
}
}
@@ -9,7 +9,7 @@ import net.minecraft.world.World;
import java.util.List;
import static com.gtnewhorizon.structurelib.StructureLib.MOD_ID;
import static com.gtnewhorizon.structurelib.StructureLibAPI.MOD_ID;
import static net.minecraft.util.EnumChatFormatting.BLUE;
import static net.minecraft.util.StatCollector.translateToLocal;
@@ -12,7 +12,7 @@ import net.minecraft.world.World;
import java.util.List;
import static com.gtnewhorizon.structurelib.StructureLib.MOD_ID;
import static com.gtnewhorizon.structurelib.StructureLibAPI.MOD_ID;
import static net.minecraft.util.StatCollector.translateToLocal;
public class ItemFrontRotationTool extends Item {
@@ -1,6 +1,8 @@
package com.gtnewhorizon.structurelib.alignment;
package com.gtnewhorizon.structurelib.net;
import com.gtnewhorizon.structurelib.StructureLib;
import com.gtnewhorizon.structurelib.alignment.IAlignment;
import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
@@ -1,7 +1,12 @@
package com.gtnewhorizon.structurelib.proxy;
import com.gtnewhorizon.structurelib.entity.fx.BlockHint;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.gtnewhorizon.structurelib.ConfigurationHandler;
import com.gtnewhorizon.structurelib.entity.fx.EntityFXBlockHint;
import com.gtnewhorizon.structurelib.entity.fx.WeightlessParticleFX;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiNewChat;
@@ -10,57 +15,173 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import static com.gtnewhorizon.structurelib.StructureLib.RANDOM;
public class ClientProxy extends CommonProxy {
@Override
public void hintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) {
Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w, x, y, z, icons).withColorTint(RGBa));
@Override
public void hintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) {
EntityFXBlockHint hint = new EntityFXBlockHint(w, x, y, z, icons).withColorTint(RGBa);
Minecraft.getMinecraft().effectRenderer.addEffect(hint);
ensureHinting();
if (ConfigurationHandler.INSTANCE.isRemoveCollidingHologram()) {
HintParticleInfo info = new HintParticleInfo(x, y, z, currentHints);
EntityFXBlockHint dupe = allHints.inverse().get(info);
if (dupe != null) {
List<EntityFXBlockHint> owner = allHints.get(dupe).owner;
// in case someone forget to call endHinting
if (owner != currentHints) {
hintOwners.remove(owner);
owner.forEach(EntityFXBlockHint::setDead);
owner.clear();
}
}
allHints.forcePut(hint, info);
}
currentHints.add(hint);
EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0);
particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f);
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
}
EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0);
particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f);
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
}
@Override
public void hintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) {
hintParticleTinted(w, x, y, z, createIIconFromBlock(block, meta), RGBa);
}
@Override
public void hintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) {
hintParticleTinted(w, x, y, z, createIIconFromBlock(block, meta), RGBa);
}
@Override
public void hintParticle(World w, int x, int y, int z, IIcon[] icons) {
hintParticleTinted(w, x, y, z, icons, new short[]{255, 255, 255, 0});
}
@Override
public void hintParticle(World w, int x, int y, int z, IIcon[] icons) {
hintParticleTinted(w, x, y, z, icons, new short[]{255, 255, 255, 0});
}
@Override
public void hintParticle(World w, int x, int y, int z, Block block, int meta) {
hintParticleTinted(w, x, y, z, createIIconFromBlock(block, meta), new short[]{255, 255, 255, 0});
}
@Override
public void hintParticle(World w, int x, int y, int z, Block block, int meta) {
hintParticleTinted(w, x, y, z, createIIconFromBlock(block, meta), new short[]{255, 255, 255, 0});
}
private static IIcon[] createIIconFromBlock(Block block, int meta) {
IIcon[] ret = new IIcon[6];
for (int i = 0; i < 6; i++) {
block.getIcon(i, meta);
}
return ret;
}
private static IIcon[] createIIconFromBlock(Block block, int meta) {
IIcon[] ret = new IIcon[6];
for (int i = 0; i < 6; i++) {
ret[i] = block.getIcon(i, meta);
}
return ret;
}
@Override
public void addClientSideChatMessages(String... messages) {
GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
for (String s : messages) {
chat.printChatMessage(new ChatComponentText(s));
}
}
@Override
public void addClientSideChatMessages(String... messages) {
GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
for (String s : messages) {
chat.printChatMessage(new ChatComponentText(s));
}
}
@Override
public EntityPlayer getCurrentPlayer() {
return Minecraft.getMinecraft().thePlayer;
}
@Override
public EntityPlayer getCurrentPlayer() {
return Minecraft.getMinecraft().thePlayer;
}
@Override
public boolean isCurrentPlayer(EntityPlayer player) {
return player == Minecraft.getMinecraft().thePlayer;
}
@Override
public boolean isCurrentPlayer(EntityPlayer player) {
return player == Minecraft.getMinecraft().thePlayer;
}
private static final BiMap<EntityFXBlockHint, HintParticleInfo> allHints = HashBiMap.create();
private static final List<List<EntityFXBlockHint>> hintOwners = new ArrayList<>();
private static List<EntityFXBlockHint> currentHints;
public static void onHintDead(EntityFXBlockHint fx) {
if (ConfigurationHandler.INSTANCE.isRemoveCollidingHologram())
allHints.remove(fx);
for (Iterator<List<EntityFXBlockHint>> iterator = hintOwners.iterator(); iterator.hasNext(); ) {
List<EntityFXBlockHint> list = iterator.next();
if (list.remove(fx)) {
if (list.isEmpty())
iterator.remove();
break;
}
}
}
@Override
public void startHinting(World w) {
if (!w.isRemote)
return;
if (currentHints != null)
hintOwners.add(currentHints);
currentHints = new LinkedList<>();
}
private void ensureHinting() {
if (currentHints == null)
currentHints = new LinkedList<>();
}
@Override
public void endHinting(World w) {
if (!w.isRemote)
return;
while (!hintOwners.isEmpty() && hintOwners.size() >= ConfigurationHandler.INSTANCE.getMaxCoexistingHologram()) {
List<EntityFXBlockHint> list = hintOwners.remove(0);
list.forEach(EntityFXBlockHint::setDead);
list.clear();
}
if (!currentHints.isEmpty())
hintOwners.add(currentHints);
currentHints = null;
}
@Override
public void preInit(FMLPreInitializationEvent e) {
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
}
private static class HintParticleInfo {
private final int x, y, z;
private final List<EntityFXBlockHint> owner;
public HintParticleInfo(int x, int y, int z, List<EntityFXBlockHint> owner) {
this.x = x;
this.y = y;
this.z = z;
this.owner = owner;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HintParticleInfo that = (HintParticleInfo) o;
if (x != that.x) return false;
if (y != that.y) return false;
return z == that.z;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
result = 31 * result + z;
return result;
}
}
public static class ForgeEventHandler {
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load e) {
if (e.world.isRemote) {
allHints.clear();
hintOwners.clear();
}
}
}
}
@@ -1,5 +1,6 @@
package com.gtnewhorizon.structurelib.proxy;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IIcon;
@@ -18,4 +19,8 @@ public class CommonProxy {
}
public void addClientSideChatMessages(String... messages){
}
public void startHinting(World w) {}
public void endHinting(World w) {}
public void preInit(FMLPreInitializationEvent e) {}
}
@@ -13,8 +13,11 @@ public interface IStructureDefinition<T> {
/**
* Used internally
*
* Might, but is not required, to throw {@link java.util.NoSuchElementException} if the given structure piece is not found.
*
* @param name same name as for other methods here
* @return the array of elements to process
* @throws java.util.NoSuchElementException if the given structure piece is not found and the moon phase perfectly matches
*/
IStructureElement<T>[] getStructureFor(String name);
@@ -125,6 +128,9 @@ public interface IStructureDefinition<T> {
}
}
}
if (DEBUG_MODE) {
StructureLib.LOGGER.info("Multi [" + basePositionX + ", " + basePositionY + ", " + basePositionZ + "] pass");
}
} else {
if (hintsOnly) {
for (IStructureElement<T> element : elements) {
@@ -165,4 +171,8 @@ public interface IStructureDefinition<T> {
}
return true;
}
static <T> StructureDefinition.Builder<T> builder() {
return StructureDefinition.builder();
}
}
@@ -0,0 +1,12 @@
package com.gtnewhorizon.structurelib.structure;
import net.minecraft.block.Block;
/**
* a function to extract tier info from a block.
* @param <TIER>
*/
@FunctionalInterface
public interface ITierConverter<TIER> {
TIER convert(Block block, int meta);
}
@@ -0,0 +1,38 @@
package com.gtnewhorizon.structurelib.structure;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.function.Function;
class LazyStructureElement<T> implements IStructureElementDeferred<T> {
private Function<T, IStructureElement<T>> to;
private IStructureElement<T> elem;
public LazyStructureElement(Function<T, IStructureElement<T>> to) {
this.to = to;
}
private IStructureElement<T> get(T t) {
if (to != null) {
elem = to.apply(t);
to = null;
}
return elem;
}
@Override
public boolean check(T t, World world, int x, int y, int z) {
return get(t).check(t, world, x, y, z);
}
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
return get(t).placeBlock(t, world, x, y, z, trigger);
}
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
return get(t).spawnHint(t, world, x, y, z, trigger);
}
}
@@ -193,6 +193,9 @@ public class StructureDefinition<T> implements IStructureDefinition<T> {
@Override
public IStructureElement<T>[] getStructureFor(String name) {
return structures.get(name);
IStructureElement<T>[] elements = structures.get(name);
if (elements == null)
throw new NoSuchElementException(name);
return elements;
}
}
@@ -5,14 +5,28 @@ import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import com.gtnewhorizon.structurelib.structure.adders.IBlockAdder;
import com.gtnewhorizon.structurelib.structure.adders.ITileAdder;
import com.gtnewhorizon.structurelib.util.Vec3Impl;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import java.util.*;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.function.*;
import static java.lang.Integer.MIN_VALUE;
@@ -172,6 +186,173 @@ public class StructureUtility {
//region block
/**
* A more primitive variant of {@link #ofBlocksTiered(ITierConverter, List, Object, BiConsumer, Function)}
* Main difference is this one is check only.
* @see #ofBlocksTiered(ITierConverter, Object, BiConsumer, Function)
*/
public static <T, TIER> IStructureElementCheckOnly<T> ofBlocksTiered(ITierConverter<TIER> tierExtractor, @Nullable TIER notSet, BiConsumer<T, TIER> setter, Function<T, TIER> getter) {
if (tierExtractor == null) throw new IllegalArgumentException();
if (setter == null) throw new IllegalArgumentException();
if (getter == null) throw new IllegalArgumentException();
return (t, world, x, y, z) -> {
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
TIER tier = tierExtractor.convert(block, meta);
TIER current = getter.apply(t);
if (Objects.equals(notSet, current)) {
setter.accept(t, tier);
return true;
}
return Objects.equals(current, tier);
};
}
/**
* Element representing a component with different tiers. Player can use more blueprint to get hints denoting more
* advanced components.
*
* There is yet no TileEntity counter part of this utility. Feel free to submit a PR to add it.
* @param allKnownTiers All known tiers as of calling. Can be empty or null. No hint will be spawned if empty or null. Cannot have null elements.
* First element denotes the most primitive tier. Last element denotes the most advanced tier.
* If not all tiers are available at definition construction time, use {@link #lazy(Supplier)} or its overloads to delay a little bit.
* @param notSet The value returned from {@code getter} when there were no tier info found in T yet. Can be null.
* @param getter a function to retrieve the current tier from T
* @param setter a function to set the current tier into T
* @param tierExtractor a function to extract tier info from a block.
*/
public static <T, TIER> IStructureElement<T> ofBlocksTiered(ITierConverter<TIER> tierExtractor, @Nullable List<Pair<Block, Integer>> allKnownTiers, @Nullable TIER notSet, BiConsumer<T, TIER> setter, Function<T, TIER> getter) {
List<Pair<Block, Integer>> hints = allKnownTiers == null ? Collections.emptyList() : allKnownTiers;
if (hints.stream().anyMatch(Objects::isNull)) throw new IllegalArgumentException();
IStructureElementCheckOnly<T> check = ofBlocksTiered(tierExtractor, notSet, setter, getter);
return new IStructureElement<T>() {
@Override
public boolean check(T t, World world, int x, int y, int z) {
return check.check(t, world, x, y, z);
}
private Pair<Block, Integer> getHint(ItemStack trigger) {
return hints.get(Math.min(Math.max(trigger.stackSize, 1), hints.size()) - 1);
}
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
Pair<Block, Integer> hint = getHint(trigger);
if (hint == null)
return false;
StructureLibAPI.hintParticle(world, x, y, z, hint.getKey(), hint.getValue());
return true;
}
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
Pair<Block, Integer> hint = getHint(trigger);
if (hint == null)
return false;
if (hint.getKey() instanceof ICustomBlockSetting) {
ICustomBlockSetting block = (ICustomBlockSetting) hint.getKey();
block.setBlock(world, x, y, z, hint.getValue());
} else {
world.setBlock(x, y, z, hint.getKey(), hint.getValue(), 2);
}
return true;
}
};
}
/**
* Denote a block using unlocalized names. This can be useful to get around mod loading order issues.
* <p>
* While no immediate error will be thrown, client code should ensure said mod is loaded and
* said mod is present, otherwise bad things will happen later!
*/
public static <T> IStructureElement<T> ofBlockUnlocalizedName(String modid, String unlocalizedName, int meta) {
if (StringUtils.isBlank(unlocalizedName)) throw new IllegalArgumentException();
if (meta < 0) throw new IllegalArgumentException();
if (meta > 15) throw new IllegalArgumentException();
if (StringUtils.isBlank(modid)) throw new IllegalArgumentException();
return new IStructureElement<T>() {
private Block block;
private Block getBlock() {
if (block == null)
block = GameRegistry.findBlock(modid, unlocalizedName);
return block;
}
@Override
public boolean check(T t, World world, int x, int y, int z) {
return world.getBlock(x, y, z) == getBlock() && world.getBlockMetadata(x, y, z) == meta;
}
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLibAPI.hintParticle(world, x, y, z, getBlock(), meta);
return true;
}
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, getBlock(), meta, 2);
return true;
}
};
}
/**
* Similiar to the other overload, but allows client code to specify a fallback in case said block was not found later
* when the element got called.
*
* This is slightly different to using the other overload and another element in a {@link #ofChain(IStructureElement[])},
* as that combination would cause crash, where this won't.
*/
public static <T> IStructureElement<T> ofBlockUnlocalizedName(String modid, String unlocalizedName, int meta, IStructureElement<T> fallback) {
if (StringUtils.isBlank(unlocalizedName)) throw new IllegalArgumentException();
if (meta < 0) throw new IllegalArgumentException();
if (meta > 15) throw new IllegalArgumentException();
if (StringUtils.isBlank(modid)) throw new IllegalArgumentException();
if (fallback == null) throw new IllegalArgumentException();
return new IStructureElement<T>() {
private Block block;
private boolean initialized;
private boolean init() {
if (!initialized) {
block = GameRegistry.findBlock(modid, unlocalizedName);
initialized = true;
}
return block != null;
}
@Override
public boolean check(T t, World world, int x, int y, int z) {
if (init())
return world.getBlock(x, y, z) != block && world.getBlockMetadata(x, y, z) == meta;
else
return fallback.check(t, world, x, y, z);
}
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
if (init()) {
StructureLibAPI.hintParticle(world, x, y, z, block, meta);
return true;
} else
return fallback.spawnHint(t, world, x, y, z, trigger);
}
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
if (init()) {
world.setBlock(x, y, z, block, meta, 2);
return true;
} else
return fallback.placeBlock(t, world, x, y, z, trigger);
}
};
}
/**
* Does not allow Block duplicates (with different meta)
*/
@@ -629,6 +810,28 @@ public class StructureUtility {
//endregion
/**
* Enable this structure element only if given predicate returns true.
*/
public static <T> IStructureElement<T> onlyIf(Predicate<? super T> predicate, IStructureElement<? super T> downstream) {
return new IStructureElement<T>() {
@Override
public boolean check(T t, World world, int x, int y, int z) {
return predicate.test(t) && downstream.check(t, world, x, y, z);
}
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
return predicate.test(t) && downstream.spawnHint(t, world, x, y, z, trigger);
}
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
return predicate.test(t) && downstream.placeBlock(t, world, x, y, z, trigger);
}
};
}
/**
* Take care while chaining, as it will try to call every structure element until it returns true.
* If none does it will finally return false.
@@ -680,6 +883,28 @@ public class StructureUtility {
//region defer
/**
* Similar to defer, but caches the first returned element returned and won't call it again.
* Initialization is not thread safe.
*/
public static <T> IStructureElementDeferred<T> lazy(Supplier<IStructureElement<T>> to) {
if (to == null) {
throw new IllegalArgumentException();
}
return new LazyStructureElement<>(t -> to.get());
}
/**
* Similar to defer, but caches the first returned element returned and won't call it again.
* Initialization is not thread safe.
*/
public static <T> IStructureElementDeferred<T> lazy(Function<T, IStructureElement<T>> to) {
if (to == null) {
throw new IllegalArgumentException();
}
return new LazyStructureElement<>(to);
}
public static <T> IStructureElementDeferred<T> defer(Supplier<IStructureElement<T>> to) {
if (to == null) {
throw new IllegalArgumentException();
@@ -1307,4 +1532,5 @@ public class StructureUtility {
}
return shape;
}
}
@@ -0,0 +1,5 @@
/**
* All public stuff in this package and its subpackages are considered part of the public API.
* Backwards compatibility is maintained to the maximum extend possible.
*/
package com.gtnewhorizon.structurelib.structure;
@@ -15,17 +15,17 @@ tile.structurelib.blockhint.13.name=Hint air
tile.structurelib.blockhint.14.name=Hint no air
tile.structurelib.blockhint.15.name=Hint error
item.structurelib.frontRotationTool.name=Front Rotation Tool
item.structurelib.frontRotationTool.name=Front Rotation Tool (Standalone)
item.structurelib.frontRotationTool.desc.0=Triggers Front Rotation Interface
item.structurelib.frontRotationTool.desc.1=Rotates only the front panel,
item.structurelib.frontRotationTool.desc.2=which allows structure rotation.
item.structurelib.constructableTrigger.name=Multiblock Machine Blueprint
item.structurelib.constructableTrigger.name=Multiblock Structure Hologram Projector
item.structurelib.constructableTrigger.desc.0=Triggers Constructable Interface
item.structurelib.constructableTrigger.desc.1=Shows multiblock construction details,
item.structurelib.constructableTrigger.desc.2=just Use on a multiblock controller.
item.structurelib.constructableTrigger.desc.3=(Sneak Use in creative to build)
item.structurelib.constructableTrigger.desc.4=Quantity affects tier/mode/type
item.structurelib.constructableTrigger.desc.1=Shows multiblock construction schematic,
item.structurelib.constructableTrigger.desc.2=use on the multiblock controller.
item.structurelib.constructableTrigger.desc.3=(Sneak use on controller in creative to build)
item.structurelib.constructableTrigger.desc.4=Quantity of schematics in item stack affects tier/mode/type
structurelib.blockhint.desc.0=Helps while building
structurelib.blockhint.0.name=Hint 1 dot
@@ -49,4 +49,110 @@ structurelib.blockhint.14.name=Hint no air
structurelib.blockhint.desc.4=Make sure it does not contain Air material.
structurelib.blockhint.15.name=Hint error
structurelib.blockhint.desc.5=ERROR, what did u expect?
itemGroup.structurelib=StructureLib
itemGroup.structurelib=StructureLib
structurelib.facing.0=down normal none
structurelib.facing.1=down normal horizontal
structurelib.facing.2=down normal vertical
structurelib.facing.3=down normal both
structurelib.facing.4=down clockwise none
structurelib.facing.5=down clockwise horizontal
structurelib.facing.6=down clockwise vertical
structurelib.facing.7=down clockwise both
structurelib.facing.8=down upside down
structurelib.facing.9=down upside down
structurelib.facing.10=down upside down
structurelib.facing.11=down upside down
structurelib.facing.12=down counter clockwise
structurelib.facing.13=down counter clockwise
structurelib.facing.14=down counter clockwise
structurelib.facing.15=down counter clockwise
structurelib.facing.16=up normal none
structurelib.facing.17=up normal horizontal
structurelib.facing.18=up normal vertical
structurelib.facing.19=up normal both
structurelib.facing.20=up clockwise none
structurelib.facing.21=up clockwise horizontal
structurelib.facing.22=up clockwise vertical
structurelib.facing.23=up clockwise both
structurelib.facing.24=up upside down
structurelib.facing.25=up upside down
structurelib.facing.26=up upside down
structurelib.facing.27=up upside down
structurelib.facing.28=up counter clockwise
structurelib.facing.29=up counter clockwise
structurelib.facing.30=up counter clockwise
structurelib.facing.31=up counter clockwise
structurelib.facing.32=north normal none
structurelib.facing.33=north normal horizontal
structurelib.facing.34=north normal vertical
structurelib.facing.35=north normal both
structurelib.facing.36=north clockwise none
structurelib.facing.37=north clockwise horizontal
structurelib.facing.38=north clockwise vertical
structurelib.facing.39=north clockwise both
structurelib.facing.40=north upside down
structurelib.facing.41=north upside down
structurelib.facing.42=north upside down
structurelib.facing.43=north upside down
structurelib.facing.44=north counter clockwise
structurelib.facing.45=north counter clockwise
structurelib.facing.46=north counter clockwise
structurelib.facing.47=north counter clockwise
structurelib.facing.48=south normal none
structurelib.facing.49=south normal horizontal
structurelib.facing.50=south normal vertical
structurelib.facing.51=south normal both
structurelib.facing.52=south clockwise none
structurelib.facing.53=south clockwise horizontal
structurelib.facing.54=south clockwise vertical
structurelib.facing.55=south clockwise both
structurelib.facing.56=south upside down
structurelib.facing.57=south upside down
structurelib.facing.58=south upside down
structurelib.facing.59=south upside down
structurelib.facing.60=south counter clockwise
structurelib.facing.61=south counter clockwise
structurelib.facing.62=south counter clockwise
structurelib.facing.63=south counter clockwise
structurelib.facing.64=west normal none
structurelib.facing.65=west normal horizontal
structurelib.facing.66=west normal vertical
structurelib.facing.67=west normal both
structurelib.facing.68=west clockwise none
structurelib.facing.69=west clockwise horizontal
structurelib.facing.70=west clockwise vertical
structurelib.facing.71=west clockwise both
structurelib.facing.72=west upside down
structurelib.facing.73=west upside down
structurelib.facing.74=west upside down
structurelib.facing.75=west upside down
structurelib.facing.76=west counter clockwise
structurelib.facing.77=west counter clockwise
structurelib.facing.78=west counter clockwise
structurelib.facing.79=west counter clockwise
structurelib.facing.80=east normal none
structurelib.facing.81=east normal horizontal
structurelib.facing.82=east normal vertical
structurelib.facing.83=east normal both
structurelib.facing.84=east clockwise none
structurelib.facing.85=east clockwise horizontal
structurelib.facing.86=east clockwise vertical
structurelib.facing.87=east clockwise both
structurelib.facing.88=east upside down
structurelib.facing.89=east upside down
structurelib.facing.90=east upside down
structurelib.facing.91=east upside down
structurelib.facing.92=east counter clockwise
structurelib.facing.93=east counter clockwise
structurelib.facing.94=east counter clockwise
structurelib.facing.95=east counter clockwise
structurelib.config.client=Client Side Configurations
structurelib.config.client.tooltip=Configurations that only changes how the game looks like, but not how it functions.
structurelib.config.client.hologram=Hologram Configurations
structurelib.config.client.hologram.tooltip=Configurations that changes how the hologram got projected into the world by default.
structurelib.config.client.hologram.maxCoexisting=Max Coexisting Holograms
structurelib.config.client.hologram.maxCoexisting.tooltip=Number of holograms that can coexist. Usually all hints generated by one right click belongs to one hologram. An attempt will be made to prune old holograms when a new hologram is about to be projected and this limit would be exceeded.
structurelib.config.client.hologram.removeColliding=Remove Colliding Holograms
structurelib.config.client.hologram.removeColliding.tooltip=Whether an attempt will be made to remove any existing hologram that collides with a new hologram.
@@ -0,0 +1,158 @@
tile.structurelib.blockhint.0.name=提示方块:1号
tile.structurelib.blockhint.1.name=提示方块:2号
tile.structurelib.blockhint.2.name=提示方块:3号
tile.structurelib.blockhint.3.name=提示方块:4号
tile.structurelib.blockhint.4.name=提示方块:5号
tile.structurelib.blockhint.5.name=提示方块:6号
tile.structurelib.blockhint.6.name=提示方块:7号
tile.structurelib.blockhint.7.name=提示方块:8号
tile.structurelib.blockhint.8.name=提示方块:9号
tile.structurelib.blockhint.9.name=提示方块:10号
tile.structurelib.blockhint.10.name=提示方块:11号
tile.structurelib.blockhint.11.name=提示方块:12号
tile.structurelib.blockhint.12.name=提示方块:一般
tile.structurelib.blockhint.13.name=提示方块:空气
tile.structurelib.blockhint.14.name=提示方块:非空气
tile.structurelib.blockhint.15.name=提示方块:错误
item.structurelib.frontRotationTool.name=正面旋转扳手 (StructureLib)
item.structurelib.frontRotationTool.desc.0=可以旋转/翻转多方块主机
item.structurelib.frontRotationTool.desc.1=多方块机器结构也需要跟随
item.structurelib.frontRotationTool.desc.2=多方块主机一起旋转/翻转。
item.structurelib.constructableTrigger.name=多方块结构全息投影仪
item.structurelib.constructableTrigger.desc.0=可以显示多方块机器的结构
item.structurelib.constructableTrigger.desc.1=只能在多方块主机上使用,将会显示机器
item.structurelib.constructableTrigger.desc.2=结构的示意图。 (译者注:请搭高使用)
item.structurelib.constructableTrigger.desc.3= (创造模式下潜行右键可以直接完成搭建)
item.structurelib.constructableTrigger.desc.4=此物品堆叠数量会影响显示的机器等级/模式/类型
structurelib.blockhint.desc.0=帮助你搭建机器
structurelib.blockhint.0.name=提示方块:1号
structurelib.blockhint.1.name=提示方块:2号
structurelib.blockhint.2.name=提示方块:3号
structurelib.blockhint.3.name=提示方块:4号
structurelib.blockhint.4.name=提示方块:5号
structurelib.blockhint.5.name=提示方块:6号
structurelib.blockhint.6.name=提示方块:7号
structurelib.blockhint.7.name=提示方块:8号
structurelib.blockhint.8.name=提示方块:9号
structurelib.blockhint.9.name=提示方块:10号
structurelib.blockhint.10.name=提示方块:11号
structurelib.blockhint.11.name=提示方块:12号
structurelib.blockhint.desc.1=特定方块们的占位符。
structurelib.blockhint.12.name=提示方块:一般
structurelib.blockhint.desc.2=一般通用占位符。
structurelib.blockhint.13.name=提示方块:空气
structurelib.blockhint.desc.3=确保这里是空气方块。
structurelib.blockhint.14.name=提示方块:非空气
structurelib.blockhint.desc.4=确保这里不是空气方块。
structurelib.blockhint.15.name=提示方块:错误
structurelib.blockhint.desc.5=ERROR,你想要做什么?
itemGroup.structurelib=StructureLib
structurelib.facing.0=面朝下方
structurelib.facing.1=面朝下方,并水平翻转
structurelib.facing.2=面朝下方,并垂直翻转
structurelib.facing.3=面朝下方,并旋转180度
structurelib.facing.4=面朝下方,并顺时针旋转90度
structurelib.facing.5=面朝下方,顺时针旋转90度并水平翻转
structurelib.facing.6=面朝下方,顺时针旋转90度并垂直翻转
structurelib.facing.7=面朝下方,并逆时针旋转90度
structurelib.facing.8=面朝下方,并旋转180度
structurelib.facing.9=面朝下方,并垂直翻转
structurelib.facing.10=面朝下方,并水平翻转
structurelib.facing.11=面朝下方
structurelib.facing.12=面朝下方,并逆时针旋转90度
structurelib.facing.13=面朝下方,逆时针旋转90度并水平翻转
structurelib.facing.14=面朝下方,逆时针旋转90度并垂直翻转
structurelib.facing.15=面朝下方,并顺时针旋转90度
structurelib.facing.16=面朝上方
structurelib.facing.17=面朝上方,并水平翻转
structurelib.facing.18=面朝上方,并垂直翻转
structurelib.facing.19=面朝上方,并旋转180度
structurelib.facing.20=面朝上方,并顺时针旋转90度
structurelib.facing.21=面朝上方,顺时针旋转90度并水平翻转
structurelib.facing.22=面朝上方,顺时针旋转90度并垂直翻转
structurelib.facing.23=面朝上方,并逆时针旋转90度
structurelib.facing.24=面朝上方,并旋转180度
structurelib.facing.25=面朝上方,并垂直翻转
structurelib.facing.26=面朝上方,并水平翻转
structurelib.facing.27=面朝上方
structurelib.facing.28=面朝上方,并逆时针旋转90度
structurelib.facing.29=面朝上方,逆时针旋转90度并水平翻转
structurelib.facing.30=面朝上方,逆时针旋转90度并垂直翻转
structurelib.facing.31=面朝上方,并顺时针旋转90度
structurelib.facing.32=面朝北方
structurelib.facing.33=面朝北方,并水平翻转
structurelib.facing.34=面朝北方,并垂直翻转
structurelib.facing.35=面朝北方,并旋转180度
structurelib.facing.36=面朝北方,并顺时针旋转90度
structurelib.facing.37=面朝北方,顺时针旋转90度并水平翻转
structurelib.facing.38=面朝北方,顺时针旋转90度并垂直翻转
structurelib.facing.39=面朝北方,并逆时针旋转90度
structurelib.facing.40=面朝北方,并旋转180度
structurelib.facing.41=面朝北方,并垂直翻转
structurelib.facing.42=面朝北方,并水平翻转
structurelib.facing.43=面朝北方
structurelib.facing.44=面朝北方,并逆时针旋转90度
structurelib.facing.45=面朝北方,逆时针旋转90度并水平翻转
structurelib.facing.46=面朝北方,逆时针旋转90度并垂直翻转
structurelib.facing.47=面朝北方,并顺时针旋转90度
structurelib.facing.48=面朝南方
structurelib.facing.49=面朝南方,并水平翻转
structurelib.facing.50=面朝南方,并垂直翻转
structurelib.facing.51=面朝南方,并旋转180度
structurelib.facing.52=面朝南方,并顺时针旋转90度
structurelib.facing.53=面朝南方,顺时针旋转90度并水平翻转
structurelib.facing.54=面朝南方,顺时针旋转90度并垂直翻转
structurelib.facing.55=面朝南方,并逆时针旋转90度
structurelib.facing.56=面朝南方,并旋转180度
structurelib.facing.57=面朝南方,并垂直翻转
structurelib.facing.58=面朝南方,并水平翻转
structurelib.facing.59=面朝南方
structurelib.facing.60=面朝南方,并逆时针旋转90度
structurelib.facing.61=面朝南方,逆时针旋转90度并水平翻转
structurelib.facing.62=面朝南方,逆时针旋转90度并垂直翻转
structurelib.facing.63=面朝南方,并顺时针旋转90度
structurelib.facing.64=面朝西方
structurelib.facing.65=面朝西方,并水平翻转
structurelib.facing.66=面朝西方,并垂直翻转
structurelib.facing.67=面朝西方,并旋转180度
structurelib.facing.68=面朝西方,并顺时针旋转90度
structurelib.facing.69=面朝西方,顺时针旋转90度并水平翻转
structurelib.facing.70=面朝西方,顺时针旋转90度并垂直翻转
structurelib.facing.71=面朝西方,并逆时针旋转90度
structurelib.facing.72=面朝西方,并旋转180度
structurelib.facing.73=面朝西方,并垂直翻转
structurelib.facing.74=面朝西方,并水平翻转
structurelib.facing.75=面朝西方
structurelib.facing.76=面朝西方,并逆时针旋转90度
structurelib.facing.77=面朝西方,逆时针旋转90度并水平翻转
structurelib.facing.78=面朝西方,逆时针旋转90度并垂直翻转
structurelib.facing.79=面朝西方,并顺时针旋转90度
structurelib.facing.80=面朝东方
structurelib.facing.81=面朝东方,并水平翻转
structurelib.facing.82=面朝东方,并垂直翻转
structurelib.facing.83=面朝东方,并旋转180度
structurelib.facing.84=面朝东方,并顺时针旋转90度
structurelib.facing.85=面朝东方,顺时针旋转90度并水平翻转
structurelib.facing.86=面朝东方,顺时针旋转90度并垂直翻转
structurelib.facing.87=面朝东方,并逆时针旋转90度
structurelib.facing.88=面朝东方,并旋转180度
structurelib.facing.89=面朝东方,并垂直翻转
structurelib.facing.90=面朝东方,并水平翻转
structurelib.facing.91=面朝东方
structurelib.facing.92=面朝东方,并逆时针旋转90度
structurelib.facing.93=面朝东方,逆时针旋转90度并水平翻转
structurelib.facing.94=面朝东方,逆时针旋转90度并垂直翻转
structurelib.facing.95=面朝东方,并顺时针旋转90度
structurelib.config.client=客户端-配置
structurelib.config.client.tooltip=修改此配置只会改变游戏中的显示效果,而不会改变实际工作模式。
structurelib.config.client.hologram=全息投影仪-配置
structurelib.config.client.hologram.tooltip=这将决定默认情况下,机器结构细节将如何被投影到世界中。
structurelib.config.client.hologram.maxCoexisting=最多可以同时存在的全息投影数量
structurelib.config.client.hologram.maxCoexisting.tooltip=这决定最多可以同时存在多少台机器的全息投影。一般一次使用全息投影仪右键生成的所有机器结构细节被视为一个全息投影。当同时存在多个全息投影,并超过此数量时,再次使用全息投影仪会移除旧有的全息投影。
structurelib.config.client.hologram.removeColliding=移除冲突的全息投影
structurelib.config.client.hologram.removeColliding.tooltip=当新的全息投影与已存在的全息投影冲突时,开启此选项时会移除已存在的全息投影。
Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

+4 -4
View File
@@ -1,10 +1,10 @@
[
{
"modid": "structurelib",
"name": "StructureLib",
"modid": "${modId}",
"name": "${modName}",
"description": "Multiblocks with ease",
"version": "${version}",
"mcversion": "${mcversion}",
"version": "${modVersion}",
"mcversion": "${minecraftVersion}",
"url": "",
"updateUrl": "",
"authorList": ["glee8e"],