Compare commits

..
8 Commits
Author SHA1 Message Date
Martin Robertz e37a932d84 Merge branch 'MeteorWeightChanges' into dev 2022-04-08 19:54:26 +02:00
Bigfluf 1593b5482b Using getTotalMeteorWeight function
Changed copy-pasted weight calculation code to function call for getTotalMeteorWeight
2022-04-08 12:03:48 +02:00
Bigfluf 00f9fa1add Added getTotalMeteorWeight function
Moved loop to calculate total weight to it's own function, used in NEI tab as well
2022-04-08 12:01:27 +02:00
Bigfluf 5c930a479f Update BloodMagicConfiguration.java 2022-03-31 01:43:41 +02:00
Bigfluf d8b0fa1cc9 Update NEIMeteorRecipeHandler.java 2022-03-31 01:41:00 +02:00
Bigfluf 801a8548f2 Update MeteorParadigm.java
Removed hardcoded maxChance and chance at fixed 1000 total weight, instead using dynamically calculated total weight of all the blocks in the meteor
2022-03-31 01:38:14 +02:00
ScriptedPiky 366a22908f Experimental Additions
Based on what BigFluf (211200168656240642) on Discord stated:
"If this works you should be able to change the weights in the configs to any number you like, and it'll just use those as relative chances and never add any 'filler' blocks like the stone
So for example if you have a meteor with just Black Granite with weight 1 and Iron Ore with weight 1, both would have 50% chance
Or you could put both at 1 million and it'd still be the same
Just make sure the new meteor GUI is changed in the same way if possible, otherwise the ore chances will be inaccurate"
2022-03-30 13:11:45 -07:00
ScriptedPiky c72e20a7ef Set "weight" to 0 for testing
What will happen if the weight is 0? Time to find out!
2022-03-30 12:53:57 -07:00
28 changed files with 353 additions and 547 deletions

No files matched your search

+34 -2
View File
@@ -1,3 +1,5 @@
# 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
@@ -9,5 +11,35 @@ on:
jobs:
build-and-test:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
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 | tee --append server.log || true
- name: Test no errors reported during server run
run: |
chmod +x .github/scripts/test-no-error-reports.sh
.github/scripts/test-no-error-reports.sh
+44 -7
View File
@@ -1,14 +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: [ '*' ]
permissions:
contents: write
tags:
- '*'
jobs:
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
secrets: inherit
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 }}
-3
View File
@@ -1,3 +0,0 @@
compileJava {
options.encoding = "UTF-8"
}
+91 -245
View File
@@ -1,36 +1,34 @@
//version: 1652851397
//version: 1642484596
/*
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 {
maven {
name 'forge'
url 'https://maven.minecraftforge.net'
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/'
name = "Scala CI dependencies"
url = "https://repo1.maven.org/maven2/"
}
maven {
name 'jitpack'
url 'https://jitpack.io'
name = "jitpack"
url = "https://jitpack.io"
}
}
dependencies {
@@ -39,27 +37,14 @@ buildscript {
}
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 'com.google.devtools.ksp' version '1.5.30-1.0.0' 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
id("org.ajoberstar.grgit") version("3.1.1")
id("com.github.johnrengelman.shadow") version("4.0.4")
id("com.palantir.git-version") version("0.12.3")
id("maven-publish")
}
if (project.file('.git/HEAD').isFile()) {
apply plugin: 'com.palantir.git-version'
}
def out = services.get(StyledTextOutputFactory).create('an-output')
apply plugin: 'forge'
def projectJavaVersion = JavaLanguageVersion.of(8)
@@ -104,31 +89,27 @@ checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
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((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
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((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
}
if(accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if(!getFile(targetFile).exists()) {
if(getFile(targetFile).exists() == false) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
}
@@ -140,17 +121,15 @@ if(usesMixins.toBoolean()) {
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)
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
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((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
}
}
@@ -158,9 +137,8 @@ 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)
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
}
}
@@ -173,35 +151,17 @@ configurations.all {
}
// 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")
}
'git config core.fileMode false'.execute()
// Pulls version first from the VERSION env and then git tag
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
String versionOverride = System.getenv("VERSION") ?: null
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
version = minecraftVersion + "-" + identifiedVersion
}
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')
catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!");
}
group = modGroup
@@ -212,25 +172,9 @@ else {
archivesBaseName = modId
}
def arguments = []
def jvmArguments = []
if (usesMixins.toBoolean()) {
arguments += [
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
if (usesMixinDebug.toBoolean()) {
jvmArguments += [
"-Dmixin.debug.countInjections=true",
"-Dmixin.debug.verbose=true",
"-Dmixin.debug.export=true"
]
}
}
minecraft {
version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion
runDir = 'run'
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
runDir = "run"
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
@@ -241,30 +185,16 @@ minecraft {
replace gradleTokenModName, modName
}
if(gradleTokenVersion) {
replace gradleTokenVersion, modVersion
replace gradleTokenVersion, versionDetails().lastTag
}
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'
if(file("addon.gradle").exists()) {
apply from: "addon.gradle"
}
apply from: 'repositories.gradle'
@@ -277,63 +207,58 @@ configurations {
repositories {
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
}
if(usesMixins.toBoolean()) {
maven {
name 'sponge'
url 'https://repo.spongepowered.org/repository/maven-public'
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
url 'https://jitpack.io'
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')
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') {
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'
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')
compile("com.github.GTNewHorizons:SpongeMixins:1.5.0")
}
}
apply from: 'dependencies.gradle'
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
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 = """{
if(usesMixins.toBoolean()) {
getFile("/src/main/resources/mixins." + modId + ".json").text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
"plugin": "${modGroup}.${mixinPlugin}",
"refmap": "${mixingConfigRefMap}",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8",
"mixins": [],
"client": [],
"server": []
"compatibilityLevel": "JAVA_8"
}
"""
}
}
}
@@ -397,6 +322,15 @@ afterEvaluate {
}
runClient {
def arguments = []
if(usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
if(developmentEnvironmentUserName) {
arguments += [
"--username",
@@ -405,12 +339,19 @@ runClient {
}
args(arguments)
jvmArgs(jvmArguments)
}
runServer {
def arguments = []
if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
args(arguments)
jvmArgs(jvmArguments)
}
tasks.withType(JavaExec).configureEach {
@@ -421,7 +362,8 @@ tasks.withType(JavaExec).configureEach {
)
}
processResources {
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
@@ -430,18 +372,18 @@ processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace modVersion and minecraftVersion
// replace version and mcversion
expand "minecraftVersion": project.minecraft.version,
"modVersion": modVersion,
"modId": modId,
"modName": modName
"modVersion": versionDetails().lastTag,
"modId": modId,
"modName": modName
}
if(usesMixins.toBoolean()) {
from refMap
}
// copy everything else that's not the mcmod.info
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
@@ -449,7 +391,7 @@ processResources {
def getManifestAttributes() {
def manifestAttributes = [:]
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
@@ -465,14 +407,14 @@ def getManifestAttributes() {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) {
from (sourceSets.main.allSource)
from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
@@ -527,7 +469,7 @@ task devJar(type: Jar) {
}
task apiJar(type: Jar) {
from (sourceSets.main.allSource) {
from (sourceSets.main.allJava) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
@@ -552,24 +494,13 @@ artifacts {
}
}
// 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
publishing {
publications {
maven(MavenPublication) {
from components.java
if(usesShadowedDependencies.toBoolean()) {
artifact source: shadowJar, classifier: ""
}
artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: ""
if(!noPublishedSources) {
artifact source: sourcesJar, classifier: "sources"
artifact source: sourcesJar, classifier: "src"
}
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
if (apiPackage) {
@@ -580,25 +511,6 @@ publishing {
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)
}
}
}
}
@@ -626,7 +538,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
println("Build script update available! Run 'gradle updateBuildScript'")
}
}
@@ -638,7 +550,7 @@ 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!")
print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
return true
}
return false
@@ -669,76 +581,10 @@ configure(updateBuildScript) {
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)) {
if (project.hasProperty(propertyName) == false) {
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")
}
}
+3 -8
View File
@@ -1,12 +1,7 @@
// Add your dependencies here
dependencies {
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.31:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Botania:1.9.5-GTNH:api") {
compileOnly("com.github.GTNewHorizons:Botania:master-SNAPSHOT:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.4:api") {
@@ -17,14 +12,14 @@ dependencies {
}
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev")
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.2.20-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.2.7-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Chisel:2.10.6-GTNH:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {
compileOnly("com.github.GTNewHorizons:ZenScript:master-SNAPSHOT") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.2.6:dev") {
@@ -278,7 +278,6 @@ public class AlchemicalWizardry
public static int ritualWeakCostThunderstorm;
public static int ritualWeakCostZombie;
public static boolean isGregTechLoaded;
public static boolean isThaumcraftLoaded;
public static boolean isForestryLoaded;
public static boolean isBotaniaLoaded;
@@ -404,7 +403,6 @@ public class AlchemicalWizardry
public static String entityMinorDemonGruntGuardianEarthID = "AW024";
public static boolean isDemonRitualCreativeOnly = false;
public static int[] demonRitualDimensionBlacklist = new int[]{0};
public static Fluid lifeEssenceFluid;
@@ -1063,7 +1061,6 @@ public class AlchemicalWizardry
public void postInit(FMLPostInitializationEvent event)
{
proxy.registerPostSideObjects();
isGregTechLoaded = Loader.isModLoaded("gregtech");
//TODO Thaumcraft Integration
if (Loader.isModLoaded("Thaumcraft"))
{
@@ -15,7 +15,6 @@ import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectDemonPortal;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -203,7 +202,7 @@ public class BloodMagicConfiguration
TEDemonPortal.demonLimit = config.get(tempDemonConfigs, "demonHoardLimit", 100).getInt();
AlchemicalWizardry.isDemonRitualCreativeOnly = config.get(tempDemonConfigs, "IsDemonRitualCreativeOnly", false).getBoolean();
AlchemicalWizardry.demonRitualDimensionBlacklist = config.get(tempDemonConfigs, "dimension blacklist for the demon portal activation", new int[]{0}).getIntList();
BoundArmour.tryComplexRendering = config.get("WimpySettings", "UseFancyBoundArmour", true).getBoolean(true);
// ItemIncense.itemDuration = config.get("TestIncenseSettings", "ItemDuration", 100).getInt();
@@ -9,8 +9,8 @@ import net.minecraft.item.ItemStack;
public class AltarRecipeRegistry
{
public static List<AltarRecipe> altarRecipes = new LinkedList<>();
public static Map<Integer, ItemStack> orbMap = new HashMap<>();
public static List<AltarRecipe> altarRecipes = new LinkedList();
public static Map<Integer, ItemStack> orbMap = new HashMap();
public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
{
@@ -8,7 +8,6 @@ import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import WayofTime.alchemicalWizardry.api.event.RitualRunEvent;
@@ -22,7 +21,6 @@ public class Rituals
public final int actCost;
public final RitualEffect effect;
public final String name;
public String localizedName = "";
public final MRSRenderer customRenderer;
@@ -66,7 +64,6 @@ public class Rituals
ritual.removeRitualFromList();
ritualMap.put(key, ritual);
keyList.add(key);
ritual.setRitualLocalizedName(StatCollector.translateToLocal("ritual." + key + ".name"));
return true;
}
}
@@ -82,7 +79,6 @@ public class Rituals
ritual.removeRitualFromList();
ritualMap.put(key, ritual);
keyList.add(key);
ritual.setRitualLocalizedName(StatCollector.translateToLocal("ritual." + key + ".name"));
return true;
}
}
@@ -295,15 +291,6 @@ public class Rituals
{
return this.name;
}
public void setRitualLocalizedName(String localizedName)
{
this.localizedName = localizedName;
}
public String getRitualLocalizedName()
{
return localizedName.isEmpty() ? this.name : localizedName;
}
public static String getNameOfRitual(String id)
{
@@ -318,20 +305,6 @@ public class Rituals
return "";
}
public static String getLocalizedNameOfRitual(String id)
{
if (ritualMap.containsKey(id))
{
Rituals ritual = ritualMap.get(id);
if (ritual != null)
{
return ritual.getRitualLocalizedName();
}
}
return "";
}
public static String getNextRitualKey(String key)
{
@@ -5,31 +5,18 @@ import net.minecraft.nbt.NBTTagCompound;
public class IMCForNEI {
public static void IMCSender() {
sendHandler("alchemicalwizardry.meteor", "AWWayofTime:masterStone", 130);
sendCatalyst("alchemicalwizardry.meteor", "AWWayofTime:masterStone");
setNBTAndSend("WayofTime.alchemicalWizardry.client.nei.NEIMeteorRecipeHandler", "AWWayofTime:masterStone", 130);
}
private static void sendHandler(String handlerName, String stack, int height) {
private static void setNBTAndSend(String handlerName, String aBlock, int height) {
NBTTagCompound NBT = new NBTTagCompound();
NBT.setString("handler", handlerName);
NBT.setString("modName", "Blood Magic");
NBT.setString("modId", "AWWayofTime");
NBT.setBoolean("modRequired", true);
NBT.setString("itemName", stack);
NBT.setString("itemName", aBlock);
NBT.setInteger("handlerHeight", height);
NBT.setInteger("maxRecipesPerPage", 1);
FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", NBT);
}
private static void sendCatalyst(String handlerName, String stack, int priority) {
NBTTagCompound aNBT = new NBTTagCompound();
aNBT.setString("handlerID", handlerName);
aNBT.setString("itemName", stack);
aNBT.setInteger("priority", priority);
FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", aNBT);
}
private static void sendCatalyst(String handlerName, String stack) {
sendCatalyst(handlerName, stack, 0);
}
}
@@ -16,6 +16,7 @@ import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiWritingTable;
import codechicken.nei.ItemList;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
@@ -1,20 +1,25 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
/**
* NEI Altar Recipe Handler by joshie *
@@ -76,6 +81,51 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
}
}
//Mouse Position helper
public Point getMouse(int width, int height) {
Point mousepos = getMousePosition();
int guiLeft = (width - 176) / 2;
int guiTop = (height - 166) / 2;
Point relMouse = new Point(mousepos.x - guiLeft, mousepos.y - guiTop);
return relMouse;
}
//width helper, getting width normal way hates me on compile
public int getGuiWidth(GuiRecipe gui) {
try {
Field f = gui.getClass().getField("width");
return (Integer) f.get(gui);
} catch (NoSuchFieldException e) {
try {
Field f = gui.getClass().getField("field_146294_l");
return (Integer) f.get(gui);
} catch (Exception e2) {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
//height helper, getting height normal way hates me on compile
public int getGuiHeight(GuiRecipe gui) {
try {
Field f = gui.getClass().getField("height");
return (Integer) f.get(gui);
} catch (NoSuchFieldException e) {
try {
Field f = gui.getClass().getField("field_146295_m");
return (Integer) f.get(gui);
} catch (Exception e2) {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
@Override
public void drawExtras(int id) {
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
@@ -84,19 +134,19 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
}
@Override
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int id) {
super.handleTooltip(gui, currenttip, id);
Point mouse = GuiDraw.getMousePosition();
Point root = gui.getRecipePosition(id);
int offsetX = gui.guiLeft + root.x;
int offsetY = gui.guiTop + root.y;
if(mouse.x >= 14 + offsetX && mouse.x <= 75 + offsetX && mouse.y >= 22 + offsetY && mouse.y <= 56 + offsetY) {
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t");
currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t");
}
return currenttip;
}
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int id) {
currenttip = super.handleTooltip(gui, currenttip, id);
Point mouse = getMouse(getGuiWidth(gui), getGuiHeight(gui));
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
int yLow = id % 2 == 0 ? 38 : 102;
int yHigh = id % 2 == 0 ? 72 : 136;
if(mouse.x >= 19 && mouse.x <= 80 && mouse.y >= yLow && mouse.y <= yHigh) {
currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t");
currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t");
}
return currenttip;
}
@Override
public String getOverlayIdentifier() {
@@ -117,4 +167,21 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
public String getGuiTexture() {
return new ResourceLocation("alchemicalwizardry", "gui/nei/altar.png").toString();
}
public static Point getMousePosition() {
Dimension size = displaySize();
Dimension res = displayRes();
return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
}
public static Dimension displaySize() {
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
return new Dimension(res.getScaledWidth(), res.getScaledHeight());
}
public static Dimension displayRes() {
Minecraft mc = Minecraft.getMinecraft();
return new Dimension(mc.displayWidth, mc.displayHeight);
}
}
@@ -1,14 +1,17 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.awt.Rectangle;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Mouse;
import java.awt.*;
/**
* Binding Ritual Handler by Arcaratus
@@ -110,4 +113,24 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler
{
return new ResourceLocation("alchemicalwizardry", "gui/nei/bindingRitual.png").toString();
}
public static Point getMousePosition()
{
Dimension size = displaySize();
Dimension res = displayRes();
return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
}
public static Dimension displaySize()
{
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
return new Dimension(res.getScaledWidth(), res.getScaledHeight());
}
public static Dimension displayRes()
{
Minecraft mc = Minecraft.getMinecraft();
return new Dimension(mc.displayWidth, mc.displayHeight);
}
}
@@ -1,22 +1,24 @@
package WayofTime.alchemicalWizardry.client.nei;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import codechicken.nei.ItemList;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.ShapedRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.StatCollector;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
/**
* NEI Blood Orb Shaped Recipe Handler by joshie *
*/
@@ -58,8 +60,7 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
@@ -77,8 +78,7 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (irecipe instanceof ShapedBloodOrbRecipe) {
@@ -92,8 +92,7 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
CachedShapedRecipe recipe = null;
@@ -4,16 +4,16 @@ import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.ShapelessRecipeHandler;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.ShapelessRecipeHandler;
/**
* NEI Blood Orb Shapeless Recipe Handler by joshie *
@@ -54,8 +54,7 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
@@ -74,8 +73,7 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
@Override
public void loadCraftingRecipes(ItemStack result) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
@@ -92,8 +90,7 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
@@ -16,7 +16,6 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@@ -26,45 +25,34 @@ import java.util.stream.Collectors;
public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
public class CachedMeteorRecipe extends CachedRecipe {
private final List<MeteorParadigmComponent> components;
private final List<PositionedStack> input = new ArrayList<>();
private final List<PositionedStack> outputs = new ArrayList<>();
private final int cost;
private final int radius;
private Point focus;
public CachedMeteorRecipe(MeteorParadigm meteor, ItemStack focusStack) {
public CachedMeteorRecipe(MeteorParadigm meteor) {
this.components = meteor.componentList;
this.input.add(new PositionedStack(meteor.focusStack, 74, 4));
int row = 0;
int col = 0;
float totalMeteorWeight = meteor.getTotalMeteorWeight();
List<MeteorParadigmComponent> sortedComponents = new ArrayList<>(meteor.componentList);
sortedComponents.sort(Comparator.comparingInt(c -> -c.chance));
for (MeteorParadigmComponent component : sortedComponents) {
for (MeteorParadigmComponent component : meteor.componentList) {
ItemStack stack = component.getValidBlockParadigm();
int xPos = 3 + 18 * col;
int yPos = 37 + 18 * row;
List<String> tooltips = new ArrayList<>();
if (stack == null) {
stack = new ItemStack(Blocks.fire);
tooltips.add(String.format("no entries found for oredict \"%s\"", component.getOreDictName()));
}
float chance = component.getChance() / totalMeteorWeight;
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(component.getChance() / totalMeteorWeight)));
this.outputs.add(new TooltipStack(stack, 3 + 18 * col, 37 + 18 * row, tooltips));
col++;
if (col > 8) {
col = 0;
row++;
}
if (focusStack != null && matchItem(focusStack, stack)) {
this.focus = new Point(xPos - 1, yPos - 1);
}
}
this.radius = meteor.radius;
this.cost = meteor.cost;
@@ -85,6 +73,10 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
return this.outputs;
}
public List<MeteorParadigmComponent> getComponents() {
return components;
}
public int getCost() {
return cost;
}
@@ -103,7 +95,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier()) && getClass() == NEIMeteorRecipeHandler.class) {
for (MeteorParadigm meteor : getSortedMeteors()) {
arecipes.add(new CachedMeteorRecipe(meteor, null));
arecipes.add(new CachedMeteorRecipe(meteor));
}
} else {
super.loadCraftingRecipes(outputId, results);
@@ -113,8 +105,8 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(ItemStack result) {
for (MeteorParadigm meteor : getSortedMeteors()) {
if (meteor.componentList.stream().anyMatch(m -> matchItem(result, m.getValidBlockParadigm()))) {
arecipes.add(new CachedMeteorRecipe(meteor, result));
if (meteor.componentList.stream().anyMatch(m -> NEIServerUtils.areStacksSameTypeCrafting(result, m.getValidBlockParadigm()))) {
arecipes.add(new CachedMeteorRecipe(meteor));
}
}
}
@@ -122,25 +114,12 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (MeteorParadigm meteor : getSortedMeteors()) {
if (matchItem(ingredient, meteor.focusStack)) {
arecipes.add(new CachedMeteorRecipe(meteor, null));
if (NEIServerUtils.areStacksSameTypeCrafting(ingredient, meteor.focusStack)) {
arecipes.add(new CachedMeteorRecipe(meteor));
}
}
}
private boolean matchItem(ItemStack compared, ItemStack compareTo) {
if (compared == null || compareTo == null) return false;
if (NEIServerUtils.areStacksSameTypeCrafting(compared, compareTo)) {
return true;
}
// ignore ore variants (like basalt ore)
if (compared.getUnlocalizedName().startsWith("gt.blockores")
&& compareTo.getUnlocalizedName().startsWith("gt.blockores")) {
return compared.getItemDamage() % 1000 == compareTo.getItemDamage() % 1000;
}
return false;
}
@Override
public String getGuiTexture() {
return new ResourceLocation("alchemicalwizardry", "gui/nei/meteor.png").toString();
@@ -156,25 +135,19 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
CachedMeteorRecipe meteorRecipe = (CachedMeteorRecipe) this.arecipes.get(recipe);
int cost = meteorRecipe.getCost();
int radius = meteorRecipe.getRadius();
Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("nei.recipe.meteor.cost", String.format("%,d", cost)), 2, 168, 0x000000);
Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("nei.recipe.meteor.radius", radius), 2, 179, 0x000000);
Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("nei.recipe.meteor.cost", String.format("%,d", cost)), 2, 96, 0x000000);
Minecraft.getMinecraft().fontRenderer.drawString(I18n.format("nei.recipe.meteor.radius", radius), 2, 107, 0x000000);
}
@Override
public void drawBackground(int recipeIndex) {
public void drawBackground(int recipe) {
GL11.glColor4f(1, 1, 1, 1);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 166, 202);
CachedMeteorRecipe recipe = (CachedMeteorRecipe) this.arecipes.get(recipeIndex);
Point focus = recipe.focus;
if (focus != null) {
GuiDraw.drawTexturedModalRect(focus.x, focus.y, 172, 0, 18, 18);
}
GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 172, 130);
}
@Override
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipe) {
public List<String> handleItemTooltip(GuiRecipe gui, ItemStack stack, List<String> currenttip, int recipe) {
CachedMeteorRecipe meteorRecipe = (CachedMeteorRecipe) this.arecipes.get(recipe);
for (PositionedStack pStack : meteorRecipe.outputs) {
if (!gui.isMouseOver(pStack, recipe)) continue;
@@ -202,10 +175,9 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
}
private String getFormattedChance(float chance) {
return new DecimalFormat("0.##").format(chance * 100);
}
private int getEstimatedAmount(float chance, int radius) {
return (int) Math.ceil(3f / 4 * Math.PI * Math.pow(radius, 3) * chance);
float percentage = chance * 100.0f;
boolean isInteger = percentage - (int) percentage <= 0.01;
if (isInteger) return String.format("%,d", (int) percentage);
else return String.format("%,.1f", percentage);
}
}
@@ -1,9 +1,11 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.util.List;
import codechicken.nei.PositionedStack;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class TooltipStack extends PositionedStack {
private final List<String> tooltips;
@@ -50,7 +50,7 @@ public class ItemDiabloKey extends EnergyItems
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
World world = par3EntityPlayer.worldObj;
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer instanceof FakePlayer)
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer instanceof FakePlayer || par3EntityPlayer instanceof EntityPlayerMP)
{
return par1ItemStack;
}
@@ -64,7 +64,7 @@ public class ItemDiabloKey extends EnergyItems
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ);
}
if (par3EntityPlayer.worldObj.isRemote)
if (!par3EntityPlayer.worldObj.isRemote && !(par3EntityPlayer.getClass().equals(EntityPlayerMP.class)))
{
return par1ItemStack;
}
@@ -103,7 +103,6 @@ public class ItemDiabloKey extends EnergyItems
EnergyItems.checkAndSetItemOwner(itemStack, ownerName);
}
}
par3EntityPlayer.inventoryContainer.detectAndSendChanges();
return par1ItemStack;
}
@@ -158,7 +158,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
{
return super.getItemStackDisplayName(stack);
}
return StatCollector.translateToLocalFormatted("bm.string.ritualDiviner", Rituals.getLocalizedNameOfRitual(ritualID));
return "Ritual: " + Rituals.getNameOfRitual(ritualID);
} else
{
return super.getItemStackDisplayName(stack);
@@ -412,7 +412,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
if (world.isRemote)
{
IChatComponent chatmessagecomponent = new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + Rituals.getLocalizedNameOfRitual(this.getCurrentRitual(stack)));
IChatComponent chatmessagecomponent = new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + Rituals.getNameOfRitual(this.getCurrentRitual(stack)));
player.addChatComponentMessage(chatmessagecomponent);
}
}
@@ -30,7 +30,7 @@ public class RitualEffectDemonPortal extends RitualEffect
public static final int drainRate = 50;
public static final Reagent[] reagents = new Reagent[]{ReagentRegistry.aetherReagent, ReagentRegistry.aquasalusReagent, ReagentRegistry.terraeReagent, ReagentRegistry.incendiumReagent, ReagentRegistry.sanctusReagent, ReagentRegistry.tenebraeReagent, ReagentRegistry.magicalesReagent, ReagentRegistry.potentiaReagent};
public static final Int3[] jarLocations = new Int3[]{new Int3(4, 5, 4), new Int3(-4, 5, 4), new Int3(4, 5, -4), new Int3(-4, 5, -4), new Int3(0, 5, 6), new Int3(0, 5, -6), new Int3(6, 5, 0), new Int3(-6, 5, 0)};
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@@ -123,10 +123,6 @@ public class RitualEffectDemonPortal extends RitualEffect
@Override
public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player)
{
for (int dim : AlchemicalWizardry.demonRitualDimensionBlacklist) {
if (player.dimension == dim) return false;
}
if(!checkJars(ritualStone))
{
player.addChatMessage(new ChatComponentTranslation("message.ritualdemonportal.missingjar"));
@@ -4,12 +4,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.common.Optional;
import gregtech.common.blocks.GT_TileEntity_Ores;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
@@ -126,9 +123,7 @@ public class MeteorParadigm
ItemStack blockStack = mpc.getValidBlockParadigm();
if(blockStack != null && blockStack.getItem() instanceof ItemBlock)
{
((ItemBlock)blockStack.getItem()).placeBlockAt(blockStack, null, world, x + i, y + j, z + k, 0, 0, 0, 0, blockStack.getItemDamage());
if (AlchemicalWizardry.isGregTechLoaded)
setGTOresNaturalIfNeeded(world, x + i, y + j, z + k);
((ItemBlock)blockStack.getItem()).placeBlockAt(blockStack, null, world, x + i, y + j, z + k, 0, 0, 0, 0, blockStack.getItemDamage());
world.markBlockForUpdate(x + i, y + j, z + k);
hasPlacedBlock = true;
break;
@@ -184,12 +179,4 @@ public class MeteorParadigm
}
}
}
@Optional.Method(modid = "gregtech")
private static void setGTOresNaturalIfNeeded(World world, int x, int y, int z) {
final TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof GT_TileEntity_Ores) {
((GT_TileEntity_Ores) tileEntity).mNatural = true;
}
}
}
-15
View File
@@ -1,15 +0,0 @@
# NEI Access Transformer configuration file
public net.minecraft.client.gui.inventory.GuiContainer field_146999_f #xSize
public net.minecraft.client.gui.inventory.GuiContainer field_147000_g #ySize
public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft
public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop
public net.minecraft.client.gui.inventory.GuiContainer field_147007_t #spreading
public net.minecraft.client.gui.inventory.GuiContainer field_147008_s #spreadingSlots
public net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet/minecraft/inventory/Slot; #getSlotAtPosition
public net.minecraft.client.gui.GuiScreen field_146292_n #buttonList
public net.minecraft.entity.EntityList field_75624_e #classToIDMapping
public net.minecraft.client.renderer.Tessellator field_78415_z #isDrawing
public net.minecraft.client.multiplayer.PlayerControllerMP field_78779_k #currentGameType
public net.minecraft.nbt.NBTTagCompound field_74784_a #tagMap
public net.minecraft.nbt.NBTTagList field_74747_a #taglist
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -256,7 +256,6 @@ bm.string.drain=Drain
bm.string.tier=Tier
bm.string.crafting.orb.shaped=Shaped Orb Crafting
bm.string.crafting.orb.shapeless=Shapeless Orb Crafting
bm.string.ritualDiviner=Radius: %s
text.recipe.altar=Blood Altar
text.recipe.altar.tier=Tier: %s
text.recipe.altar.bloodRequired=LP: %s
@@ -265,45 +264,6 @@ nei.recipe.meteor.category=Meteor Ritual
nei.recipe.meteor.cost=Cost: %s LP
nei.recipe.meteor.radius=Radius: %s
nei.recipe.meteor.chance=Chance: %s%%
nei.recipe.meteor.amount=Estimated amount: %s
#Rituals
ritual.AW001Water.name=Ritual of the Full Spring
ritual.AW002Lava.name=Serenade of the Nether
ritual.AW003GreenGrove.name=Ritual of the Green Grove
ritual.AW004Interdiction.name=Interdiction Ritual
ritual.AW005Containment.name=Ritual of Containment
ritual.AW006Binding.name=Ritual of Binding
ritual.AW007Unbinding.name=Ritual of Unbinding
ritual.AW008HighJump.name=Ritual of the High Jump
ritual.AW009Magnetism.name=Ritual of Magnetism
ritual.AW010Crusher.name=Ritual of the Crusher
ritual.AW011Speed.name=Ritual of Speed
ritual.AW012AnimalGrowth.name=Ritual of the Shepherd
ritual.AW013Suffering.name=Well of Suffering
ritual.AW014Regen.name=Ritual of Regeneration
ritual.AW015FeatheredKnife.name=Ritual of the Feathered Knife
ritual.AW016FeatheredEarth.name=Ritual of the Feathered Earth
ritual.AW017Gaia.name=Ritual of Gaia's Transformation
ritual.AW018Condor.name=Reverence of the Condor
ritual.AW019FallingTower.name=Mark of the Falling Tower
ritual.AW020BalladOfAlchemy.name=Ballad of Alchemy
ritual.AW021Expulsion.name=Aura of Expulsion
ritual.AW022Supression.name=Dome of Supression
ritual.AW023Zephyr.name=Call of the Zephyr
ritual.AW024Harvest.name=Reap of the Harvest Moon
ritual.AW025Conduit.name=Cry of the Eternal Soul
ritual.AW026Ellipsoid.name=Focus of the Ellipsoid
ritual.AW027Evaporation.name=Song of Evaporation
ritual.AW028SpawnWard.name=Ward of Sacrosanctity
ritual.AW029VeilOfEvil.name=Veil of Evil
ritual.AW030FullStomach.name=Requiem of the Satiated Stomach
ritual.AW031Convocation.name=Convocation of the Damned
ritual.AW032Symmetry.name=Symmetry of the Omega
ritual.AW033Stalling.name=Duet of the Fused Souls
ritual.AW034Crafting.name=Rhythm of the Beating Anvil
ritual.AW035PhantomHands.name=Orchestra of the Phantom Hands
ritual.AW036SphereIsland.name=Blood of the New Moon
#Entities
entity.AWWayofTime.EarthElemental.name=Earth Elemental
@@ -369,6 +329,8 @@ commands.bind.remove.success=Unbinding successful
commands.orb.usage=/bloodmagic orb [set|get] player [tier]
commands.orb.help=Used to set or get the Player's max Blood Orb tier.
commands.bind.usage=/bind <player>
commands.bind.success=Item successfully bound!
commands.bind.failed.noPlayer=There is no player specified
commands.bind.failed.alreadyBound=Item is already bound; use /unbind to unbind it
commands.bind.failed.notBindable=Item cannot be bound
@@ -277,7 +277,7 @@ entity.AWWayofTime.MinorDemonGrunt.name=Демон Грунт
#Commands
commands.soulnetwork.usage=/soulnetwork <игрок>
commands.bind.usage=/bloodmagic bind [true|false] <игрок>
commands.bind.usage=/bind <игрок>
commands.bind.success=Предмет успешно привязан!
commands.bind.failed.noPlayer=Игрок не выбран
commands.bind.failed.alreadyBound=Предмет уже привязан; используйте /unbind для отвязки
@@ -1,4 +1,4 @@
#Block Localization
#Block Localization
tile.bloodAltar.name=血之祭坛
tile.bloodRune.blank.name=气血符文
tile.bloodRune.fill.name=增容符文
@@ -256,54 +256,10 @@ bm.string.drain=消耗
bm.string.tier=层数
bm.string.crafting.orb.shaped=特定血宝珠合成
bm.string.crafting.orb.shapeless=不定血宝珠合成
bm.string.ritualDiviner=仪式: %s
text.recipe.altar=血之祭坛
text.recipe.altar.tier=层数: %s
text.recipe.altar.bloodRequired=LP: %s
text.recipe.shapedOrb=合适宝珠合成
nei.recipe.meteor.category=陨星仪式
nei.recipe.meteor.cost=消耗: %s LP
nei.recipe.meteor.radius=半径: %s
nei.recipe.meteor.chance=几率: %s%%
nei.recipe.meteor.amount=期望数量: %s
#Rituals
ritual.AW001Water.name=涌泉仪式
ritual.AW002Lava.name=下界夜曲
ritual.AW003GreenGrove.name=绿丛仪式
ritual.AW004Interdiction.name=禁止仪式
ritual.AW005Containment.name=牵制仪式
ritual.AW006Binding.name=绑定仪式
ritual.AW007Unbinding.name=解绑仪式
ritual.AW008HighJump.name=高跳仪式
ritual.AW009Magnetism.name=磁矿仪式
ritual.AW010Crusher.name=挖掘仪式
ritual.AW011Speed.name=速移仪式
ritual.AW012AnimalGrowth.name=牧养仪式
ritual.AW013Suffering.name=苦难之井
ritual.AW014Regen.name=重生仪式
ritual.AW015FeatheredKnife.name=羽刀仪式
ritual.AW016FeatheredEarth.name=羽地仪式
ritual.AW017Gaia.name=盖亚仪式
ritual.AW018Condor.name=崇敬之鹰
ritual.AW019FallingTower.name=陨星仪式
ritual.AW020BalladOfAlchemy.name=炼金之谣
ritual.AW021Expulsion.name=驱逐氛场
ritual.AW022Supression.name=抑液仪式
ritual.AW023Zephyr.name=和风之唤
ritual.AW024Harvest.name=满月收割
ritual.AW025Conduit.name=永魂之泣
ritual.AW026Ellipsoid.name=幽影屏障
ritual.AW027Evaporation.name=蒸发之曲
ritual.AW028SpawnWard.name=神圣庇佑
ritual.AW029VeilOfEvil.name=罪恶遮纱
ritual.AW030FullStomach.name=盛宴之歌
ritual.AW031Convocation.name=恶魔入侵
ritual.AW032Symmetry.name=欧米伽仪式
ritual.AW033Stalling.name=熔魂合奏
ritual.AW034Crafting.name=工作节律
ritual.AW035PhantomHands.name=幻手乐团
ritual.AW036SphereIsland.name=新月之血
#Entities
entity.AWWayofTime.EarthElemental.name=土之元素精灵
@@ -361,14 +317,16 @@ commands.network.fill.success=成功填充 %s 的LP网络.
commands.network.cap.help=将指定玩家的LP网络填充到其持有的最高级气血宝珠可以存储的最大值。
commands.network.cap.success=成功锁定了 %s 的LP网络.
commands.bind.usage=/bloodmagic bind [true|false] [玩家]
commands.bind.usage=/bind <玩家>
commands.bind.help=尝试将手持物品绑定(解绑)
commands.bind.success=绑定成功
commands.bind.success=物品成功绑定!
commands.bind.remove.success=解绑成功
commands.orb.usage=/bloodmagic orb [set|get] player [等级]
commands.orb.help=用来设定或获取指定玩家的最高等级气血宝珠.
commands.bind.usage=/bind <玩家>
commands.bind.success=物品成功绑定!
commands.bind.failed.noPlayer=没有指定玩家
commands.bind.failed.alreadyBound=物品已经被绑定; 使用 /unbind 来解除绑定
commands.bind.failed.notBindable=物品无法被绑定
@@ -481,7 +439,7 @@ tooltip.sacrificialdagger.desc2=只是刺一下手指
tooltip.sacrificialdagger.desc3=你就能获得力量...
tooltip.sanguinearmor.desc1=一双充满力量的护目镜
tooltip.sanguinearmor.desc2=灌入被禁止的力量的长袍
tooltip.sanguinearmor.visdisc=魔力减免:
tooltip.sanguinearmor.visdisc=灵气减免:
tooltip.scribetool.desc=书写是在墙壁上的...
tooltip.seersigil.desc=看到更多总会有所不足
tooltip.sigilofelementalaffinity.desc1=在火中呼吸的鱼
@@ -284,7 +284,7 @@ entity.AWWayofTime.MinorDemonGrunt.name=格倫魔
#Commands
commands.soulnetwork.usage=/soulnetwork <玩家>
commands.bind.usage=/bloodmagic bind [true|false] <玩家>
commands.bind.usage=/bind <玩家>
commands.bind.success=物品成功綁定!
commands.bind.failed.noPlayer=沒有指定玩家
commands.bind.failed.alreadyBound=物品已經被綁定; 使用 /unbind 來解除綁定
@@ -1,5 +0,0 @@
commands.forge.usage=指令:/forge <子命令>. 子命令包括:tps, track
commands.forge.usage.tracking=指令:/forge track <类型> <持续时间>. 可用类型有:te (实体方块). 持续时间 < 60.
commands.forge.tps.summary=%s : 平均tick耗时: %d ms. 平均TPS: %d
commands.forge.tracking.te.enabled=已启用实体方块追踪 %d 秒.