mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 14:44:35 +00:00
Compare commits
43
Commits
2.9.7
...
2.10.2-GTNH
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4165072a7 | ||
|
|
b47b9c796b | ||
|
|
87fdd6a89b | ||
|
|
ddc1e1e1f2 | ||
|
|
2c6f726adf | ||
|
|
3b436ac6fe | ||
|
|
57730ee5e7 | ||
|
|
1cca6cceb1 | ||
|
|
a33dfd1ad9 | ||
|
|
6bb9808bc7 | ||
|
|
c6f9373308 | ||
|
|
37d8e908b4 | ||
|
|
5f8734093c | ||
|
|
d4de411389 | ||
|
|
39c135203e | ||
|
|
ab83665d9a | ||
|
|
d3b68032cd | ||
|
|
e02c02d35c | ||
|
|
c5e8645d1a | ||
|
|
52c184b7ab | ||
|
|
d4330b1512 | ||
|
|
53c72a9397 | ||
|
|
f728eb1a15 | ||
|
|
48f5e6fec2 | ||
|
|
346a818a5a | ||
|
|
587afa8e1d | ||
|
|
3ae2128564 | ||
|
|
8c82d0fa41 | ||
|
|
07dce1355a | ||
|
|
acdd403636 | ||
|
|
6916e91591 | ||
|
|
06dadab7de | ||
|
|
aed35c359e | ||
|
|
0b6a55c16c | ||
|
|
1ff93570da | ||
|
|
ce290e5e24 | ||
|
|
706a6cae90 | ||
|
|
88118d11a3 | ||
|
|
c3f77411b0 | ||
|
|
f5aaf31a8d | ||
|
|
a239e7b44f | ||
|
|
2f7c6e9e39 | ||
|
|
dee61e51cd |
No files matched your search
@@ -1,16 +0,0 @@
|
|||||||
# text stuff
|
|
||||||
*.java text
|
|
||||||
*.sh text eol=lf
|
|
||||||
*.bat text eol=crlf
|
|
||||||
*.md text
|
|
||||||
|
|
||||||
#binary
|
|
||||||
*.dat binary
|
|
||||||
*.bin binary
|
|
||||||
*.png binary
|
|
||||||
*.exe binary
|
|
||||||
*.dll binary
|
|
||||||
*.zip binary
|
|
||||||
*.jar binary
|
|
||||||
*.7z binary
|
|
||||||
*.db binary
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
directory="run/crash-reports"
|
||||||
|
if [ -d $directory ]; then
|
||||||
|
echo "Crash reports detected:"
|
||||||
|
cat $directory/*
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "No crash reports detected"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
@@ -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 minute
|
||||||
|
run: |
|
||||||
|
mkdir run
|
||||||
|
echo "eula=true" > run/eula.txt
|
||||||
|
timeout 60 ./gradlew runServer || true
|
||||||
|
|
||||||
|
- name: Test no crashes happend
|
||||||
|
run: |
|
||||||
|
chmod +x .github/scripts/test-no-crash-reports.sh
|
||||||
|
.github/scripts/test-no-crash-reports.sh
|
||||||
@@ -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: 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
|
||||||
+24
-41
@@ -1,46 +1,29 @@
|
|||||||
#eclipse
|
.gradle
|
||||||
.project
|
.settings
|
||||||
|
/.idea/
|
||||||
|
/run/
|
||||||
|
/build/
|
||||||
|
/eclipse/
|
||||||
.classpath
|
.classpath
|
||||||
.metadata
|
.project
|
||||||
org.*
|
/bin/
|
||||||
bin
|
/config/
|
||||||
|
/crash-reports/
|
||||||
#idea
|
/logs/
|
||||||
.idea
|
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
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
out
|
src/main/resources/mixins.*.json
|
||||||
classes
|
|
||||||
|
|
||||||
#gradle
|
|
||||||
build
|
|
||||||
.gradle
|
|
||||||
|
|
||||||
#runtime
|
|
||||||
eclipse
|
|
||||||
run
|
|
||||||
|
|
||||||
#mac
|
|
||||||
.DS_Store
|
|
||||||
*.command
|
|
||||||
|
|
||||||
#windows
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
#workspace
|
|
||||||
saves
|
|
||||||
asm
|
|
||||||
logs
|
|
||||||
screenshots
|
|
||||||
mods
|
|
||||||
lib
|
|
||||||
libs
|
|
||||||
#config I assume you want to keep your minecraft config and world out
|
|
||||||
#world this is taken care of with the run folder up at runtime you are actually removing the packages
|
|
||||||
|
|
||||||
*.json
|
|
||||||
/server.properties
|
|
||||||
*.dat
|
|
||||||
*.psd
|
|
||||||
*.bat
|
*.bat
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
# Chisel
|
||||||
|
|
||||||
|
Changelog of Chisel.
|
||||||
|
|
||||||
|
|
||||||
|
### [#9 fix(gradle): fix gradle wrapper script and plugins](https://github.com/GTNewHorizons/Chisel/pull/9)
|
||||||
|
**Merge pull request #9 from GTNewHorizons/update-gradle**
|
||||||
|
* fix(gradle): fix gradle wrapper script and plugins
|
||||||
|
|
||||||
|
[39c135203e97cb7](https://github.com/GTNewHorizons/Chisel/commit/39c135203e97cb7)
|
||||||
|
by Martin Robertz *2021-04-29 19:25:47*
|
||||||
|
### No issue
|
||||||
|
**Present GUI should only open if its block is still present server side**
|
||||||
|
|
||||||
|
[5f8734093c85cfc](https://github.com/GTNewHorizons/Chisel/commit/5f8734093c85cfc)
|
||||||
|
by jss2a98aj *2021-05-07 14:27:04*
|
||||||
|
|
||||||
|
**update gradle**
|
||||||
|
|
||||||
|
[d4de4113898901c](https://github.com/GTNewHorizons/Chisel/commit/d4de4113898901c)
|
||||||
|
by DreamMasterXXL *2021-04-29 20:02:26*
|
||||||
|
|
||||||
|
**fix(gradle): fix gradle wrapper script and plugins**
|
||||||
|
* - Update the wrapper to 5.6.4
|
||||||
|
* - Switch to overminddl1 for Forge
|
||||||
|
* - Upgrade version and repository of Grgit
|
||||||
|
* TODO:
|
||||||
|
* Host an ivy for EquivalentExchange3-1.7.10-0.3.505-dev.jar
|
||||||
|
* at http://downloads.gtnewhorizons.com/Mods_for_Jenkins/
|
||||||
|
|
||||||
|
[ab83665d9aea1dc](https://github.com/GTNewHorizons/Chisel/commit/ab83665d9aea1dc)
|
||||||
|
by Léa Gris *2021-04-29 15:05:24*
|
||||||
|
|
||||||
|
**Revert "Merge branch '1.7/release' into 1.7/release"**
|
||||||
|
* This reverts commit e02c02d35c644ef288b4d275dc1cb0b97da74b5b, reversing
|
||||||
|
* changes made to c5e8645d1aa3c84ee80320fb71b4a5ecd70dab5d.
|
||||||
|
|
||||||
|
[d3b68032cd2a950](https://github.com/GTNewHorizons/Chisel/commit/d3b68032cd2a950)
|
||||||
|
by glowredman *2021-03-23 13:14:46*
|
||||||
|
|
||||||
|
**Merge branch '1.7/release' into 1.7/release**
|
||||||
|
|
||||||
|
[e02c02d35c644ef](https://github.com/GTNewHorizons/Chisel/commit/e02c02d35c644ef)
|
||||||
|
by glowredman *2021-03-23 11:22:39*
|
||||||
|
|
||||||
+449
-146
@@ -1,94 +1,347 @@
|
|||||||
|
//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428
|
||||||
|
/*
|
||||||
|
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/SinTh0r4s/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 java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
|
||||||
maven {
|
maven {
|
||||||
name = "forge"
|
name = "forge"
|
||||||
url = "http://files.minecraftforge.net/maven"
|
url = "https://maven.minecraftforge.net"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "sonatype"
|
name = "sonatype"
|
||||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
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 {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
|
||||||
classpath 'org.ajoberstar:gradle-git:0.10.1'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.matthewprenger.cursegradle' version '1.0.3'
|
id 'idea'
|
||||||
|
id 'scala'
|
||||||
|
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")
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'forge'
|
apply plugin: 'forge'
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
def projectJavaVersion = JavaLanguageVersion.of(8)
|
||||||
targetCompatibility = 1.8
|
|
||||||
|
|
||||||
import org.ajoberstar.grgit.Grgit
|
java {
|
||||||
|
toolchain {
|
||||||
def repo = Grgit.open(project.file('.'))
|
languageVersion.set(projectJavaVersion)
|
||||||
project.ext.gitHash = repo.log().find().abbreviatedId
|
}
|
||||||
def branchname = repo.branch.getCurrent().fullName
|
|
||||||
if (branchname.contains('HEAD')) {
|
|
||||||
branchname = System.getenv("GIT_BRANCH")
|
|
||||||
}
|
}
|
||||||
branchname = branchname.substring(branchname.lastIndexOf('/') + 1)
|
|
||||||
|
|
||||||
boolean dev = System.getenv("RELEASE") == null || System.getenv("RELEASE").equalsIgnoreCase("false")
|
idea {
|
||||||
|
module {
|
||||||
|
inheritOutputDirs = true
|
||||||
|
downloadJavadoc = true
|
||||||
|
downloadSources = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ext.buildnumber = 0
|
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
||||||
project.buildnumber = System.getenv('BUILD_NUMBER') == null ? "CUSTOM" : System.getenv('BUILD_NUMBER')
|
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
|
||||||
|
}
|
||||||
|
|
||||||
version = dev ? "${branchname}-${buildnumber}-${project.ext.gitHash}" : "${mod_version}.${buildnumber}"
|
checkPropertyExists("modName")
|
||||||
group = "team.chisel" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
checkPropertyExists("modId")
|
||||||
archivesBaseName = "Chisel"
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
String javaSourceDir = "src/main/java/"
|
||||||
|
String scalaSourceDir = "src/main/scala/"
|
||||||
|
|
||||||
|
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||||
|
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||||
|
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("\\.", "/")
|
||||||
|
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() == false) {
|
||||||
|
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("\\.", "/")
|
||||||
|
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"
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
'git config core.fileMode false'.execute()
|
||||||
|
// Pulls version from git tag
|
||||||
|
try {
|
||||||
|
version = minecraftVersion + "-" + gitVersion()
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
|
||||||
|
}
|
||||||
|
|
||||||
|
group = modGroup
|
||||||
|
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||||
|
archivesBaseName = customArchiveBaseName
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
archivesBaseName = modId
|
||||||
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "${minecraft_version}-${forge_version}"
|
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
|
||||||
runDir = "run"
|
runDir = "run"
|
||||||
|
|
||||||
replaceIn "Chisel.java"
|
if (replaceGradleTokenInFile) {
|
||||||
replace "@VERSION@", project.version
|
replaceIn replaceGradleTokenInFile
|
||||||
|
if(gradleTokenModId) {
|
||||||
|
replace gradleTokenModId, modId
|
||||||
|
}
|
||||||
|
if(gradleTokenModName) {
|
||||||
|
replace gradleTokenModName, modName
|
||||||
|
}
|
||||||
|
if(gradleTokenVersion) {
|
||||||
|
replace gradleTokenVersion, versionDetails().lastTag
|
||||||
|
}
|
||||||
|
if(gradleTokenGroupName) {
|
||||||
|
replace gradleTokenGroupName, modGroup
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(file("addon.gradle").exists()) {
|
||||||
|
apply from: "addon.gradle"
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: 'repositories.gradle'
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
shade
|
implementation.extendsFrom(shadowImplementation)
|
||||||
compile.extendsFrom shade
|
|
||||||
compile.extendsFrom exportedCompile
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
|
||||||
name 'Chicken Bones Repo'
|
|
||||||
url "http://chickenbones.net/maven/"
|
|
||||||
}
|
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
name 'Prof Mobius Repo'
|
name = "Overmind forge repo mirror"
|
||||||
url "http://mobiusstrip.eu/maven"
|
url = "https://gregtech.overminddl1.com/"
|
||||||
}
|
}
|
||||||
|
if(usesMixins.toBoolean()) {
|
||||||
maven {
|
maven {
|
||||||
name 'Chisel Repo'
|
name = "sponge"
|
||||||
url "http://maven.tterrag.com/"
|
url = "https://repo.spongepowered.org/repository/maven-public"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = "https://jitpack.io"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//compile "mcp.mobius.waila:Waila:${waila_version}_${minecraft_version}:dev"
|
if(usesMixins.toBoolean()) {
|
||||||
compile "codechicken:CodeChickenLib:${minecraft_version}-${ccl_version}:dev"
|
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
|
||||||
compile "codechicken:CodeChickenCore:${minecraft_version}-${ccc_version}:dev"
|
annotationProcessor("com.google.guava:guava:24.1.1-jre")
|
||||||
compile "codechicken:NotEnoughItems:${minecraft_version}-${nei_version}:dev"
|
annotationProcessor("com.google.code.gson:gson:2.8.6")
|
||||||
compile "codechicken:ForgeMultipart:${minecraft_version}-${fmp_version}:dev"
|
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
|
||||||
compile "com.pahimar.ee3:EquivalentExchange3:1.7.10-0.3.505:dev"
|
// using 0.8 to workaround a issue in 0.7 which fails mixin application
|
||||||
|
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
|
||||||
shade ("team.chisel.ctmlib:CTMLib:${ctmlib_version}") {
|
// Mixin includes a lot of dependencies that are too up-to-date
|
||||||
transitive = false
|
exclude module: "launchwrapper"
|
||||||
|
exclude module: "guava"
|
||||||
|
exclude module: "gson"
|
||||||
|
exclude module: "commons-io"
|
||||||
|
exclude module: "log4j-core"
|
||||||
|
}
|
||||||
|
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()) {
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
||||||
|
target = tasks.shadowJar
|
||||||
|
prefix = modGroup + ".shadow"
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
manifest {
|
||||||
|
attributes(getManifestAttributes())
|
||||||
|
}
|
||||||
|
|
||||||
|
minimize() // This will only allow shading for actually used classes
|
||||||
|
configurations = [project.configurations.shadowImplementation]
|
||||||
|
dependsOn(relocateShadowJar)
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
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 {
|
||||||
|
def arguments = []
|
||||||
|
|
||||||
|
if(usesMixins.toBoolean()) {
|
||||||
|
arguments += [
|
||||||
|
"--mods=../build/libs/$modId-${version}.jar",
|
||||||
|
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if(developmentEnvironmentUserName) {
|
||||||
|
arguments += [
|
||||||
|
"--username",
|
||||||
|
developmentEnvironmentUserName
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
args(arguments)
|
||||||
|
}
|
||||||
|
|
||||||
|
runServer {
|
||||||
|
def arguments = []
|
||||||
|
|
||||||
|
if (usesMixins.toBoolean()) {
|
||||||
|
arguments += [
|
||||||
|
"--mods=../build/libs/$modId-${version}.jar",
|
||||||
|
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
args(arguments)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaExec).configureEach {
|
||||||
|
javaLauncher.set(
|
||||||
|
javaToolchains.launcherFor {
|
||||||
|
languageVersion = projectJavaVersion
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
processResources
|
processResources
|
||||||
{
|
{
|
||||||
// this will ensure that this task is redone when the versions change.
|
// this will ensure that this task is redone when the versions change.
|
||||||
@@ -100,7 +353,14 @@ processResources
|
|||||||
include 'mcmod.info'
|
include 'mcmod.info'
|
||||||
|
|
||||||
// replace version and mcversion
|
// replace version and mcversion
|
||||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
expand "minecraftVersion": project.minecraft.version,
|
||||||
|
"modVersion": versionDetails().lastTag,
|
||||||
|
"modId": modId,
|
||||||
|
"modName": modName
|
||||||
|
}
|
||||||
|
|
||||||
|
if(usesMixins.toBoolean()) {
|
||||||
|
from refMap
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy everything else, thats not the mcmod.info
|
// copy everything else, thats not the mcmod.info
|
||||||
@@ -109,118 +369,161 @@ processResources
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
def getManifestAttributes() {
|
||||||
configurations.shade.each { dep ->
|
def manifestAttributes = [:]
|
||||||
from(project.zipTree(dep)){
|
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
|
||||||
exclude 'META-INF', 'META-INF/**', '*.info'
|
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() == false
|
||||||
|
]
|
||||||
|
}
|
||||||
|
return manifestAttributes
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
from (sourceSets.main.allJava)
|
||||||
|
from (file("$projectDir/LICENSE"))
|
||||||
|
getArchiveClassifier().set('sources')
|
||||||
|
}
|
||||||
|
|
||||||
|
task shadowDevJar(type: ShadowJar) {
|
||||||
|
from sourceSets.main.output
|
||||||
|
getArchiveClassifier().set("dev")
|
||||||
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'FMLAT': 'chisel_compile_at.cfg'
|
attributes(getManifestAttributes())
|
||||||
|
}
|
||||||
|
|
||||||
|
minimize() // This will only allow shading for actually used classes
|
||||||
|
configurations = [project.configurations.shadowImplementation]
|
||||||
|
}
|
||||||
|
|
||||||
|
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
|
||||||
|
target = tasks.shadowDevJar
|
||||||
|
prefix = modGroup + ".shadow"
|
||||||
|
}
|
||||||
|
|
||||||
|
task circularResolverJar(type: Jar) {
|
||||||
|
dependsOn(relocateShadowDevJar)
|
||||||
|
dependsOn(shadowDevJar)
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
task devJar(type: Jar) {
|
||||||
|
from sourceSets.main.output
|
||||||
|
getArchiveClassifier().set("dev")
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes(getManifestAttributes())
|
||||||
|
}
|
||||||
|
|
||||||
|
if(usesShadowedDependencies.toBoolean()) {
|
||||||
|
dependsOn(circularResolverJar)
|
||||||
|
enabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create deobf dev jars
|
|
||||||
task deobfJar(type: Jar) {
|
|
||||||
from sourceSets.main.output
|
|
||||||
classifier = 'deobf'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create API jar with sources and compiled files
|
|
||||||
task apiJar(type: Jar) {
|
task apiJar(type: Jar) {
|
||||||
from sourceSets.main.allSource
|
from (sourceSets.main.allJava) {
|
||||||
from sourceSets.main.output
|
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||||
include 'com/cricketcraft/chisel/api/**/*'
|
}
|
||||||
classifier = 'api'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create source attachment for dev jar
|
from (sourceSets.main.output) {
|
||||||
task sourcesJar(type: Jar) {
|
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||||
from sourceSets.main.allJava
|
}
|
||||||
classifier = 'sources'
|
|
||||||
|
from (sourceSets.main.resources.srcDirs) {
|
||||||
|
include("LICENSE")
|
||||||
|
}
|
||||||
|
|
||||||
|
getArchiveClassifier().set('api')
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives deobfJar
|
|
||||||
archives sourcesJar
|
archives sourcesJar
|
||||||
archives apiJar
|
archives devJar
|
||||||
}
|
if(apiPackage) {
|
||||||
|
archives apiJar
|
||||||
publishing {
|
|
||||||
tasks.publish.dependsOn 'build'
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
artifact jar
|
|
||||||
artifact deobfJar
|
|
||||||
artifact sourcesJar
|
|
||||||
artifact apiJar
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
if (project.hasProperty('mavendir')) {
|
|
||||||
maven { url mavendir }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
println('Changelog:\n' + getChangelogText())
|
// Updating
|
||||||
|
task updateBuildScript {
|
||||||
|
doLast {
|
||||||
|
if (performBuildScriptUpdate(projectDir.toString())) return
|
||||||
|
|
||||||
String getChangelogText() {
|
print("Build script already up-to-date!")
|
||||||
def changelogFile = file('changelog.txt')
|
|
||||||
String str = ''
|
|
||||||
int lineCount = 0
|
|
||||||
boolean done = false
|
|
||||||
changelogFile.eachLine {
|
|
||||||
if (done || it == null) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (it.size() > 1) {
|
|
||||||
def temp = it
|
|
||||||
if (lineCount == 0) {
|
|
||||||
temp = "Chisel ${version}"
|
|
||||||
temp = "<h2>$temp</h2>"
|
|
||||||
} else if (it.startsWith('-')) {
|
|
||||||
temp = " $temp"
|
|
||||||
} else {
|
|
||||||
temp = "<h4>$temp</h4>"
|
|
||||||
}
|
|
||||||
str += "$temp<br/>"
|
|
||||||
lineCount++
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
done = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return str
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.curseforge.dependsOn 'reobf'
|
|
||||||
tasks.curseforge.enabled = !dev && project.hasProperty('curseforge_key')
|
|
||||||
|
|
||||||
curseforge {
|
|
||||||
if (project.hasProperty('curseforge_key')) {
|
|
||||||
apiKey = project.curseforge_key
|
|
||||||
}
|
|
||||||
|
|
||||||
project {
|
|
||||||
id = project.projectId
|
|
||||||
changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG').equals('none') ? getChangelogText() : System.getenv('CHANGELOG')
|
|
||||||
changelogType = 'html'
|
|
||||||
releaseType = 'release'
|
|
||||||
relations {
|
|
||||||
embeddedLibrary 'ctmlib'
|
|
||||||
}
|
|
||||||
mainArtifact(jar) {
|
|
||||||
displayName = "Chisel - ${version}"
|
|
||||||
}
|
|
||||||
addArtifact deobfJar
|
|
||||||
addArtifact sourcesJar
|
|
||||||
addArtifact(apiJar) {
|
|
||||||
relations {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
idea { module { inheritOutputDirs = true } }
|
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||||
|
if (autoUpdateBuildScript.toBoolean()) {
|
||||||
|
performBuildScriptUpdate(projectDir.toString())
|
||||||
|
} else {
|
||||||
|
println("Build script update available! Run 'gradle updateBuildScript'")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static URL availableBuildScriptUrl() {
|
||||||
|
new URL("https://raw.githubusercontent.com/SinTh0r4s/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 } }
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper methods
|
||||||
|
|
||||||
|
def checkPropertyExists(String 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/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getFile(String relativePath) {
|
||||||
|
return new File(projectDir, relativePath)
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// Add your dependencies here
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev")
|
||||||
|
|
||||||
|
compile("team.chisel.ctmlib:CTMLib:MC1.7.10-1.4.1.5")
|
||||||
|
|
||||||
|
compileOnly("com.github.GTNewHorizons:waila:master-SNAPSHOT:dev") {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
|
compileOnly("com.github.GTNewHorizons:ForgeMultipart:master-SNAPSHOT:dev") {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOnly("curse.maven:ee3-65509:2305023") { // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,295 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<profiles version="12">
|
|
||||||
<profile kind="CodeFormatterProfile" name="Chisel2" version="12">
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="49"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="200"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="200"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
+62
-10
@@ -1,12 +1,64 @@
|
|||||||
mod_version=2.9.7-GTNH
|
modName = Chisel
|
||||||
minecraft_version=1.7.10
|
|
||||||
forge_version=10.13.4.1481-1.7.10
|
|
||||||
|
|
||||||
ctmlib_version=MC1.7.10-1.4.1.5
|
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||||
ccl_version=1.1.3.140
|
modId = chisel
|
||||||
ccc_version=1.0.7.46
|
|
||||||
nei_version=1.0.5.111
|
|
||||||
waila_version=1.5.10
|
|
||||||
fmp_version=1.2.0.344
|
|
||||||
|
|
||||||
projectId=235279
|
modGroup = team.chisel
|
||||||
|
|
||||||
|
# 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 = Chisel.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 = chisel_compile_at.cfg
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||||
|
# projects. New projects should not use this parameter.
|
||||||
|
#customArchiveBaseName =
|
||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
|
|
||||||
@@ -1,5 +1,21 @@
|
|||||||
#!/usr/bin/env sh
|
#!/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.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
|||||||
APP_BASE_NAME=`basename "$0"`
|
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.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
@@ -109,8 +125,8 @@ if $darwin; then
|
|||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|||||||
Vendored
+17
-1
@@ -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
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
|||||||
set APP_HOME=%DIRNAME%
|
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.
|
@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 DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
before_install:
|
||||||
|
- ./gradlew setupCIWorkspace
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Add any additional repositories for your dependencies here
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name 'Chisel Repo'
|
||||||
|
url "http://maven.tterrag.com/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url "https://cursemaven.com"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = "https://jitpack.io"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
rootProject.name = 'Chisel'
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
|
|
||||||
public class BlockCoordinates implements Comparable
|
|
||||||
{
|
|
||||||
public int x;
|
|
||||||
|
|
||||||
/** the y coordinate */
|
|
||||||
public int y;
|
|
||||||
|
|
||||||
/** the z coordinate */
|
|
||||||
public int z;
|
|
||||||
|
|
||||||
public BlockCoordinates() {}
|
|
||||||
|
|
||||||
public BlockCoordinates(int par1, int par2, int par3)
|
|
||||||
{
|
|
||||||
this.x = par1;
|
|
||||||
this.y = par2;
|
|
||||||
this.z = par3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockCoordinates(TileEntity tile)
|
|
||||||
{
|
|
||||||
this.x = tile.xCoord;
|
|
||||||
this.y = tile.yCoord;
|
|
||||||
this.z = tile.zCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockCoordinates(BlockCoordinates par1ChunkCoordinates)
|
|
||||||
{
|
|
||||||
this.x = par1ChunkCoordinates.x;
|
|
||||||
this.y = par1ChunkCoordinates.y;
|
|
||||||
this.z = par1ChunkCoordinates.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object par1Obj)
|
|
||||||
{
|
|
||||||
if (!(par1Obj instanceof BlockCoordinates))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BlockCoordinates coordinates = (BlockCoordinates)par1Obj;
|
|
||||||
return this.x == coordinates.x && this.y == coordinates.y && this.z == coordinates.z ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return this.x + this.y << 8 + this.z << 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compare the coordinate with another coordinate
|
|
||||||
*/
|
|
||||||
public int compareWorldCoordinate(BlockCoordinates par1)
|
|
||||||
{
|
|
||||||
return this.y == par1.y ? (this.z == par1.z ? this.x - par1.x : this.z - par1.z) : this.y - par1.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set(int par1, int par2, int par3, int d)
|
|
||||||
{
|
|
||||||
this.x = par1;
|
|
||||||
this.y = par2;
|
|
||||||
this.z = par3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the squared distance between this coordinates and the coordinates given as argument.
|
|
||||||
*/
|
|
||||||
public float getDistanceSquared(int par1, int par2, int par3)
|
|
||||||
{
|
|
||||||
float f = (float)(this.x - par1);
|
|
||||||
float f1 = (float)(this.y - par2);
|
|
||||||
float f2 = (float)(this.z - par3);
|
|
||||||
return f * f + f1 * f1 + f2 * f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the squared distance between this coordinates and the ChunkCoordinates given as argument.
|
|
||||||
*/
|
|
||||||
public float getDistanceSquaredToWorldCoordinates(BlockCoordinates par1ChunkCoordinates)
|
|
||||||
{
|
|
||||||
return this.getDistanceSquared(par1ChunkCoordinates.x, par1ChunkCoordinates.y, par1ChunkCoordinates.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int compareTo(Object par1Obj)
|
|
||||||
{
|
|
||||||
return this.compareWorldCoordinate((BlockCoordinates)par1Obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readNBT(NBTTagCompound nbt) {
|
|
||||||
this.x = nbt.getInteger("b_x");
|
|
||||||
this.y = nbt.getInteger("b_y");
|
|
||||||
this.z = nbt.getInteger("b_z");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeNBT(NBTTagCompound nbt) {
|
|
||||||
nbt.setInteger("b_x",x);
|
|
||||||
nbt.setInteger("b_y",y);
|
|
||||||
nbt.setInteger("b_z",z);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IArchitect {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of blocks that should be highlighted in world.
|
|
||||||
*/
|
|
||||||
public ArrayList<BlockCoordinates> getArchitectBlocks(ItemStack stack, World world,
|
|
||||||
int x, int y, int z, int side, EntityPlayer player);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* which axis should be displayed.
|
|
||||||
*/
|
|
||||||
public boolean showAxis(ItemStack stack, World world, EntityPlayer player, int side, EnumAxis axis);
|
|
||||||
|
|
||||||
public enum EnumAxis {
|
|
||||||
X, // east / west
|
|
||||||
Y, // up / down
|
|
||||||
Z; // north / south
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* Equipped head slot items that extend this class will be able to perform most functions that
|
|
||||||
* goggles of revealing can apart from view nodes which is handled by IRevealer.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface IGoggles {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If this method returns true things like block essentia contents will be shown.
|
|
||||||
*/
|
|
||||||
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Azanor
|
|
||||||
* Items, armor and tools with this interface can receive the Repair enchantment.
|
|
||||||
* Repairs 1 point of durability every 10 seconds (2 for repair II)
|
|
||||||
*/
|
|
||||||
public interface IRepairable {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Azanor
|
|
||||||
* Items, armor and tools with this interface can receive the Repair enchantment.
|
|
||||||
* Repairs 1 point of durability every 10 seconds (2 for repair II)
|
|
||||||
*/
|
|
||||||
public interface IRepairableExtended extends IRepairable {
|
|
||||||
|
|
||||||
public boolean doRepair(ItemStack stack, EntityPlayer player, int enchantlevel);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* Armor or bauble slot items that implement this interface can provide runic shielding.
|
|
||||||
* Recharging, hardening, etc. is handled internally by thaumcraft.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface IRunicArmor {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns how much charge this item can provide. This is the base shielding value - any hardening is stored and calculated internally.
|
|
||||||
*/
|
|
||||||
public int getRunicCharge(ItemStack itemstack);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* Interface used to identify scribing tool items used in research table
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface IScribeTools {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Azanor
|
|
||||||
* ItemArmor with this interface will grant a discount to the vis cost of actions the wearer performs with casting wands.
|
|
||||||
* The amount returned is the percentage by which the cost is discounted. There is a built-int max discount of 50%, but
|
|
||||||
* individual items really shouldn't have a discount more than 5%
|
|
||||||
*/
|
|
||||||
public interface IVisDiscountGear {
|
|
||||||
|
|
||||||
int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* Armor, held items or bauble slot items that implement this interface add warp when equipped or held.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface IWarpingGear {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns how much warp this item adds while worn or held.
|
|
||||||
*/
|
|
||||||
public int getWarp(ItemStack itemstack, EntityPlayer player);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* This is used to gain access to the items in my mod.
|
|
||||||
* I only give some examples and it will probably still
|
|
||||||
* require a bit of work for you to get hold of everything you need.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ItemApi {
|
|
||||||
|
|
||||||
public static ItemStack getItem(String itemString, int meta) {
|
|
||||||
ItemStack item = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
String itemClass = "thaumcraft.common.config.ConfigItems";
|
|
||||||
Object obj = Class.forName(itemClass).getField(itemString).get(null);
|
|
||||||
if (obj instanceof Item) {
|
|
||||||
item = new ItemStack((Item) obj,1,meta);
|
|
||||||
} else if (obj instanceof ItemStack) {
|
|
||||||
item = (ItemStack) obj;
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FMLLog.warning("[Thaumcraft] Could not retrieve item identified by: " + itemString);
|
|
||||||
}
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getBlock(String itemString, int meta) {
|
|
||||||
ItemStack item = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
String itemClass = "thaumcraft.common.config.ConfigBlocks";
|
|
||||||
Object obj = Class.forName(itemClass).getField(itemString).get(null);
|
|
||||||
if (obj instanceof Block) {
|
|
||||||
item = new ItemStack((Block) obj,1,meta);
|
|
||||||
} else if (obj instanceof ItemStack) {
|
|
||||||
item = (ItemStack) obj;
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FMLLog.warning("[Thaumcraft] Could not retrieve block identified by: " + itemString);
|
|
||||||
}
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Some examples
|
|
||||||
*
|
|
||||||
* Casting Wands:
|
|
||||||
* itemWandCasting
|
|
||||||
*
|
|
||||||
* Resources:
|
|
||||||
* itemEssence, itemWispEssence, itemResource, itemShard, itemNugget,
|
|
||||||
* itemNuggetChicken, itemNuggetBeef, itemNuggetPork, itemTripleMeatTreat
|
|
||||||
*
|
|
||||||
* Research:
|
|
||||||
* itemResearchNotes, itemInkwell, itemThaumonomicon
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class ItemRunic extends Item implements IRunicArmor {
|
|
||||||
|
|
||||||
int charge;
|
|
||||||
|
|
||||||
public ItemRunic (int charge)
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
this.charge = charge;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRunicCharge(ItemStack itemstack) {
|
|
||||||
return charge;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,588 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
|
||||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.common.util.EnumHelper;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
import thaumcraft.api.crafting.CrucibleRecipe;
|
|
||||||
import thaumcraft.api.crafting.InfusionEnchantmentRecipe;
|
|
||||||
import thaumcraft.api.crafting.InfusionRecipe;
|
|
||||||
import thaumcraft.api.crafting.ShapedArcaneRecipe;
|
|
||||||
import thaumcraft.api.crafting.ShapelessArcaneRecipe;
|
|
||||||
import thaumcraft.api.internal.DummyInternalMethodHandler;
|
|
||||||
import thaumcraft.api.internal.IInternalMethodHandler;
|
|
||||||
import thaumcraft.api.internal.WeightedRandomLoot;
|
|
||||||
import thaumcraft.api.research.IScanEventHandler;
|
|
||||||
import thaumcraft.api.research.ResearchCategories;
|
|
||||||
import thaumcraft.api.research.ResearchCategoryList;
|
|
||||||
import thaumcraft.api.research.ResearchItem;
|
|
||||||
import thaumcraft.api.research.ResearchPage;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* IMPORTANT: If you are adding your own aspects to items it is a good idea to do it AFTER Thaumcraft adds its aspects, otherwise odd things may happen.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ThaumcraftApi {
|
|
||||||
|
|
||||||
//Materials
|
|
||||||
public static ToolMaterial toolMatThaumium = EnumHelper.addToolMaterial("THAUMIUM", 3, 400, 7F, 2, 22);
|
|
||||||
public static ToolMaterial toolMatVoid = EnumHelper.addToolMaterial("VOID", 4, 150, 8F, 3, 10);
|
|
||||||
public static ToolMaterial toolMatElemental = EnumHelper.addToolMaterial("THAUMIUM_ELEMENTAL", 3, 1500, 10F, 3, 18);
|
|
||||||
public static ArmorMaterial armorMatThaumium = EnumHelper.addArmorMaterial("THAUMIUM", 25, new int[] { 2, 6, 5, 2 }, 25);
|
|
||||||
public static ArmorMaterial armorMatSpecial = EnumHelper.addArmorMaterial("SPECIAL", 25, new int[] { 1, 3, 2, 1 }, 25);
|
|
||||||
public static ArmorMaterial armorMatThaumiumFortress = EnumHelper.addArmorMaterial("FORTRESS", 40, new int[] { 3, 7, 6, 3 }, 25);
|
|
||||||
public static ArmorMaterial armorMatVoid = EnumHelper.addArmorMaterial("VOID", 10, new int[] { 3, 7, 6, 3 }, 10);
|
|
||||||
public static ArmorMaterial armorMatVoidFortress = EnumHelper.addArmorMaterial("VOIDFORTRESS", 18, new int[] { 4, 8, 7, 4 }, 10);
|
|
||||||
|
|
||||||
//Enchantment references
|
|
||||||
public static int enchantFrugal;
|
|
||||||
public static int enchantPotency;
|
|
||||||
public static int enchantWandFortune;
|
|
||||||
public static int enchantHaste;
|
|
||||||
public static int enchantRepair;
|
|
||||||
|
|
||||||
//Miscellaneous
|
|
||||||
/**
|
|
||||||
* Portable Hole Block-id Blacklist.
|
|
||||||
* Simply add the block-id's of blocks you don't want the portable hole to go through.
|
|
||||||
*/
|
|
||||||
public static ArrayList<Block> portableHoleBlackList = new ArrayList<Block>();
|
|
||||||
|
|
||||||
//Internal (Do not alter this unless you like pretty explosions)
|
|
||||||
//Calling methods from this will only work properly once Thaumcraft is past the FMLPreInitializationEvent phase.
|
|
||||||
public static IInternalMethodHandler internalMethods = new DummyInternalMethodHandler();
|
|
||||||
|
|
||||||
//RESEARCH/////////////////////////////////////////
|
|
||||||
public static ArrayList<IScanEventHandler> scanEventhandlers = new ArrayList<IScanEventHandler>();
|
|
||||||
public static ArrayList<EntityTags> scanEntities = new ArrayList<EntityTags>();
|
|
||||||
public static class EntityTagsNBT {
|
|
||||||
public EntityTagsNBT(String name, Object value) {
|
|
||||||
this.name = name;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
public String name;
|
|
||||||
public Object value;
|
|
||||||
}
|
|
||||||
public static class EntityTags {
|
|
||||||
public EntityTags(String entityName, AspectList aspects, EntityTagsNBT... nbts) {
|
|
||||||
this.entityName = entityName;
|
|
||||||
this.nbts = nbts;
|
|
||||||
this.aspects = aspects;
|
|
||||||
}
|
|
||||||
public String entityName;
|
|
||||||
public EntityTagsNBT[] nbts;
|
|
||||||
public AspectList aspects;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* not really working atm, so ignore it for now
|
|
||||||
* @param scanEventHandler
|
|
||||||
*/
|
|
||||||
public static void registerScanEventhandler(IScanEventHandler scanEventHandler) {
|
|
||||||
scanEventhandlers.add(scanEventHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is used to add aspects to entities which you can then scan using a thaumometer.
|
|
||||||
* Also used to calculate vis drops from mobs.
|
|
||||||
* @param entityName
|
|
||||||
* @param aspects
|
|
||||||
* @param nbt you can specify certain nbt keys and their values
|
|
||||||
* to differentiate between mobs. <br>For example the normal and wither skeleton:
|
|
||||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 5));
|
|
||||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 8), new NBTTagByte("SkeletonType",(byte) 1));
|
|
||||||
*/
|
|
||||||
public static void registerEntityTag(String entityName, AspectList aspects, EntityTagsNBT... nbt ) {
|
|
||||||
scanEntities.add(new EntityTags(entityName,aspects,nbt));
|
|
||||||
}
|
|
||||||
|
|
||||||
//RECIPES/////////////////////////////////////////
|
|
||||||
private static ArrayList craftingRecipes = new ArrayList();
|
|
||||||
private static HashMap<Object,ItemStack> smeltingBonus = new HashMap<Object,ItemStack>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is used to determine what bonus items are generated when the infernal furnace smelts items
|
|
||||||
* @param in The input of the smelting operation. e.g. new ItemStack(Block.oreGold)
|
|
||||||
* @param out The bonus item that can be produced from the smelting operation e.g. new ItemStack(nuggetGold,0,0).
|
|
||||||
* Stacksize should be 0 unless you want to guarantee that at least 1 item is always produced.
|
|
||||||
*/
|
|
||||||
public static void addSmeltingBonus(ItemStack in, ItemStack out) {
|
|
||||||
smeltingBonus.put(
|
|
||||||
Arrays.asList(in.getItem(),in.getItemDamage()),
|
|
||||||
new ItemStack(out.getItem(),0,out.getItemDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is used to determine what bonus items are generated when the infernal furnace smelts items
|
|
||||||
* @param in The ore dictionary input of the smelting operation. e.g. "oreGold"
|
|
||||||
* @param out The bonus item that can be produced from the smelting operation e.g. new ItemStack(nuggetGold,0,0).
|
|
||||||
* Stacksize should be 0 unless you want to guarantee that at least 1 item is always produced.
|
|
||||||
*/
|
|
||||||
public static void addSmeltingBonus(String in, ItemStack out) {
|
|
||||||
smeltingBonus.put( in, new ItemStack(out.getItem(),0,out.getItemDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the bonus item produced from a smelting operation in the infernal furnace
|
|
||||||
* @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
|
|
||||||
* @return the The bonus item that can be produced
|
|
||||||
*/
|
|
||||||
public static ItemStack getSmeltingBonus(ItemStack in) {
|
|
||||||
ItemStack out = smeltingBonus.get(Arrays.asList(in.getItem(),in.getItemDamage()));
|
|
||||||
if (out==null) {
|
|
||||||
out = smeltingBonus.get(Arrays.asList(in.getItem(),OreDictionary.WILDCARD_VALUE));
|
|
||||||
}
|
|
||||||
if (out==null) {
|
|
||||||
String od = OreDictionary.getOreName( OreDictionary.getOreID(in));
|
|
||||||
out = smeltingBonus.get(od);
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List getCraftingRecipes() {
|
|
||||||
return craftingRecipes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
|
||||||
* @param result the recipe output
|
|
||||||
* @param aspects the vis cost per aspect.
|
|
||||||
* @param recipe The recipe. Format is exactly the same as vanilla recipes. Input itemstacks are NBT sensitive.
|
|
||||||
*/
|
|
||||||
public static ShapedArcaneRecipe addArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
|
|
||||||
{
|
|
||||||
ShapedArcaneRecipe r= new ShapedArcaneRecipe(research, result, aspects, recipe);
|
|
||||||
craftingRecipes.add(r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
|
||||||
* @param result the recipe output
|
|
||||||
* @param aspects the vis cost per aspect
|
|
||||||
* @param recipe The recipe. Format is exactly the same as vanilla shapeless recipes. Input itemstacks are NBT sensitive.
|
|
||||||
*/
|
|
||||||
public static ShapelessArcaneRecipe addShapelessArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
|
|
||||||
{
|
|
||||||
ShapelessArcaneRecipe r = new ShapelessArcaneRecipe(research, result, aspects, recipe);
|
|
||||||
craftingRecipes.add(r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
|
||||||
* @param result the recipe output. It can either be an itemstack or an nbt compound tag that will be added to the central item
|
|
||||||
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
|
|
||||||
* instability effect each second while the crafting is in progress
|
|
||||||
* @param aspects the essentia cost per aspect.
|
|
||||||
* @param aspects input the central item to be infused
|
|
||||||
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
|
|
||||||
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static InfusionRecipe addInfusionCraftingRecipe(String research, Object result, int instability, AspectList aspects, ItemStack input,ItemStack[] recipe)
|
|
||||||
{
|
|
||||||
if (!(result instanceof ItemStack || result instanceof Object[])) return null;
|
|
||||||
InfusionRecipe r= new InfusionRecipe(research, result, instability, aspects, input, recipe);
|
|
||||||
craftingRecipes.add(r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
|
||||||
* @param enchantment the enchantment that will be applied to the item
|
|
||||||
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
|
|
||||||
* instability effect each second while the crafting is in progress
|
|
||||||
* @param aspects the essentia cost per aspect.
|
|
||||||
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
|
|
||||||
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static InfusionEnchantmentRecipe addInfusionEnchantmentRecipe(String research, Enchantment enchantment, int instability, AspectList aspects, ItemStack[] recipe)
|
|
||||||
{
|
|
||||||
InfusionEnchantmentRecipe r= new InfusionEnchantmentRecipe(research, enchantment, instability, aspects, recipe);
|
|
||||||
craftingRecipes.add(r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param stack the recipe result
|
|
||||||
* @return the recipe
|
|
||||||
*/
|
|
||||||
public static InfusionRecipe getInfusionRecipe(ItemStack res) {
|
|
||||||
for (Object r:getCraftingRecipes()) {
|
|
||||||
if (r instanceof InfusionRecipe) {
|
|
||||||
if (((InfusionRecipe)r).getRecipeOutput() instanceof ItemStack) {
|
|
||||||
if (((ItemStack) ((InfusionRecipe)r).getRecipeOutput()).isItemEqual(res))
|
|
||||||
return (InfusionRecipe)r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param key the research key required for this recipe to work.
|
|
||||||
* @param result the output result
|
|
||||||
* @param catalyst an itemstack of the catalyst or a string if it is an ore dictionary item
|
|
||||||
* @param cost the vis cost
|
|
||||||
* @param tags the aspects required to craft this
|
|
||||||
*/
|
|
||||||
public static CrucibleRecipe addCrucibleRecipe(String key, ItemStack result, Object catalyst, AspectList tags) {
|
|
||||||
CrucibleRecipe rc = new CrucibleRecipe(key, result, catalyst, tags);
|
|
||||||
getCraftingRecipes().add(rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param stack the recipe result
|
|
||||||
* @return the recipe
|
|
||||||
*/
|
|
||||||
public static CrucibleRecipe getCrucibleRecipe(ItemStack stack) {
|
|
||||||
for (Object r:getCraftingRecipes()) {
|
|
||||||
if (r instanceof CrucibleRecipe) {
|
|
||||||
if (((CrucibleRecipe)r).getRecipeOutput().isItemEqual(stack))
|
|
||||||
return (CrucibleRecipe)r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param hash the unique recipe code
|
|
||||||
* @return the recipe
|
|
||||||
*/
|
|
||||||
public static CrucibleRecipe getCrucibleRecipeFromHash(int hash) {
|
|
||||||
for (Object r:getCraftingRecipes()) {
|
|
||||||
if (r instanceof CrucibleRecipe) {
|
|
||||||
if (((CrucibleRecipe)r).hash==hash)
|
|
||||||
return (CrucibleRecipe)r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used by the thaumonomicon drilldown feature.
|
|
||||||
* @param stack the item
|
|
||||||
* @return the thaumcraft recipe key that produces that item.
|
|
||||||
*/
|
|
||||||
private static HashMap<int[],Object[]> keyCache = new HashMap<int[],Object[]>();
|
|
||||||
|
|
||||||
public static Object[] getCraftingRecipeKey(EntityPlayer player, ItemStack stack) {
|
|
||||||
int[] key = new int[] {Item.getIdFromItem(stack.getItem()),stack.getItemDamage()};
|
|
||||||
if (keyCache.containsKey(key)) {
|
|
||||||
if (keyCache.get(key)==null) return null;
|
|
||||||
if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), (String)(keyCache.get(key))[0]))
|
|
||||||
return keyCache.get(key);
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (ResearchCategoryList rcl:ResearchCategories.researchCategories.values()) {
|
|
||||||
for (ResearchItem ri:rcl.research.values()) {
|
|
||||||
if (ri.getPages()==null) continue;
|
|
||||||
for (int a=0;a<ri.getPages().length;a++) {
|
|
||||||
ResearchPage page = ri.getPages()[a];
|
|
||||||
if (page.recipe!=null && page.recipe instanceof CrucibleRecipe[]) {
|
|
||||||
CrucibleRecipe[] crs = (CrucibleRecipe[]) page.recipe;
|
|
||||||
for (CrucibleRecipe cr:crs) {
|
|
||||||
if (cr.getRecipeOutput().isItemEqual(stack)) {
|
|
||||||
keyCache.put(key,new Object[] {ri.key,a});
|
|
||||||
if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), ri.key))
|
|
||||||
return new Object[] {ri.key,a};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
if (page.recipeOutput!=null && stack !=null && page.recipeOutput.isItemEqual(stack)) {
|
|
||||||
keyCache.put(key,new Object[] {ri.key,a});
|
|
||||||
if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), ri.key))
|
|
||||||
return new Object[] {ri.key,a};
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
keyCache.put(key,null);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ASPECTS////////////////////////////////////////
|
|
||||||
|
|
||||||
public static ConcurrentHashMap<List,AspectList> objectTags = new ConcurrentHashMap<List,AspectList>();
|
|
||||||
public static ConcurrentHashMap<List,int[]> groupedObjectTags = new ConcurrentHashMap<List,int[]>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks to see if the passed item/block already has aspects associated with it.
|
|
||||||
* @param id
|
|
||||||
* @param meta
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean exists(Item item, int meta) {
|
|
||||||
AspectList tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,meta));
|
|
||||||
if (tmp==null) {
|
|
||||||
tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,OreDictionary.WILDCARD_VALUE));
|
|
||||||
if (meta==OreDictionary.WILDCARD_VALUE && tmp==null) {
|
|
||||||
int index=0;
|
|
||||||
do {
|
|
||||||
tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,index));
|
|
||||||
index++;
|
|
||||||
} while (index<16 && tmp==null);
|
|
||||||
}
|
|
||||||
if (tmp==null) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
|
|
||||||
* <i>ThaumcraftApi.registerObjectTag(new ItemStack(Blocks.cobblestone), (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));</i>
|
|
||||||
* @param item the item passed. Pass OreDictionary.WILDCARD_VALUE if all damage values of this item/block should have the same aspects
|
|
||||||
* @param aspects A ObjectTags object of the associated aspects
|
|
||||||
*/
|
|
||||||
public static void registerObjectTag(ItemStack item, AspectList aspects) {
|
|
||||||
if (aspects==null) aspects=new AspectList();
|
|
||||||
try {
|
|
||||||
objectTags.put(Arrays.asList(item.getItem(),item.getItemDamage()), aspects);
|
|
||||||
} catch (Exception e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
|
|
||||||
* <i>ThaumcraftApi.registerObjectTag(new ItemStack(Blocks.cobblestone), new int[]{0,1}, (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));</i>
|
|
||||||
* @param item
|
|
||||||
* @param meta A range of meta values if you wish to lump several item meta's together as being the "same" item (i.e. stair orientations)
|
|
||||||
* @param aspects A ObjectTags object of the associated aspects
|
|
||||||
*/
|
|
||||||
public static void registerObjectTag(ItemStack item, int[] meta, AspectList aspects) {
|
|
||||||
if (aspects==null) aspects=new AspectList();
|
|
||||||
try {
|
|
||||||
objectTags.put(Arrays.asList(item.getItem(),meta[0]), aspects);
|
|
||||||
for (int m:meta) {
|
|
||||||
groupedObjectTags.put(Arrays.asList(item.getItem(),m), meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to assign apsects to the given ore dictionary item.
|
|
||||||
* @param oreDict the ore dictionary name
|
|
||||||
* @param aspects A ObjectTags object of the associated aspects
|
|
||||||
*/
|
|
||||||
public static void registerObjectTag(String oreDict, AspectList aspects) {
|
|
||||||
if (aspects==null) aspects=new AspectList();
|
|
||||||
ArrayList<ItemStack> ores = OreDictionary.getOres(oreDict);
|
|
||||||
if (ores!=null && ores.size()>0) {
|
|
||||||
for (ItemStack ore:ores) {
|
|
||||||
try {
|
|
||||||
objectTags.put(Arrays.asList(ore.getItem(), ore.getItemDamage()), aspects);
|
|
||||||
} catch (Exception e) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to assign aspects to the given item/block.
|
|
||||||
* Attempts to automatically generate aspect tags by checking registered recipes.
|
|
||||||
* Here is an example of the declaration for pistons:<p>
|
|
||||||
* <i>ThaumcraftApi.registerComplexObjectTag(new ItemStack(Blocks.cobblestone), (new AspectList()).add(Aspect.MECHANISM, 2).add(Aspect.MOTION, 4));</i>
|
|
||||||
* IMPORTANT - this should only be used if you are not happy with the default aspects the object would be assigned.
|
|
||||||
* @param item, pass OreDictionary.WILDCARD_VALUE to meta if all damage values of this item/block should have the same aspects
|
|
||||||
* @param aspects A ObjectTags object of the associated aspects
|
|
||||||
*/
|
|
||||||
public static void registerComplexObjectTag(ItemStack item, AspectList aspects ) {
|
|
||||||
if (!exists(item.getItem(),item.getItemDamage())) {
|
|
||||||
AspectList tmp = ThaumcraftApiHelper.generateTags(item.getItem(), item.getItemDamage());
|
|
||||||
if (tmp != null && tmp.size()>0) {
|
|
||||||
for(Aspect tag:tmp.getAspects()) {
|
|
||||||
aspects.add(tag, tmp.getAmount(tag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
registerObjectTag(item,aspects);
|
|
||||||
} else {
|
|
||||||
AspectList tmp = ThaumcraftApiHelper.getObjectAspects(item);
|
|
||||||
for(Aspect tag:aspects.getAspects()) {
|
|
||||||
tmp.merge(tag, tmp.getAmount(tag));
|
|
||||||
}
|
|
||||||
registerObjectTag(item,tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//WARP ///////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
private static HashMap<Object,Integer> warpMap = new HashMap<Object,Integer>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is used to determine how much warp is gained if the item is crafted. The warp
|
|
||||||
* added is "sticky" warp
|
|
||||||
* @param craftresult The item crafted
|
|
||||||
* @param amount how much warp is gained
|
|
||||||
*/
|
|
||||||
public static void addWarpToItem(ItemStack craftresult, int amount) {
|
|
||||||
warpMap.put(Arrays.asList(craftresult.getItem(),craftresult.getItemDamage()),amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is used to determine how much permanent warp is gained if the research is completed
|
|
||||||
* @param in The item crafted
|
|
||||||
* @param amount how much warp is gained
|
|
||||||
*/
|
|
||||||
public static void addWarpToResearch(String research, int amount) {
|
|
||||||
warpMap.put(research, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns how much warp is gained from the item or research passed in
|
|
||||||
* @param in itemstack or string
|
|
||||||
* @return how much warp it will give
|
|
||||||
*/
|
|
||||||
public static int getWarp(Object in) {
|
|
||||||
if (in==null) return 0;
|
|
||||||
if (in instanceof ItemStack && warpMap.containsKey(Arrays.asList(((ItemStack)in).getItem(),((ItemStack)in).getItemDamage()))) {
|
|
||||||
return warpMap.get(Arrays.asList(((ItemStack)in).getItem(),((ItemStack)in).getItemDamage()));
|
|
||||||
} else
|
|
||||||
if (in instanceof String && warpMap.containsKey((String)in)) {
|
|
||||||
return warpMap.get((String)in);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//LOOT BAGS //////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to add possible loot to treasure bags. As a reference, the weight of gold coins are 2000
|
|
||||||
* and a diamond is 50.
|
|
||||||
* The weights are the same for all loot bag types - the only difference is how many items the bag
|
|
||||||
* contains.
|
|
||||||
* @param item
|
|
||||||
* @param weight
|
|
||||||
* @param bagTypes array of which type of bag to add this loot to. Multiple types can be specified
|
|
||||||
* 0 = common, 1 = uncommon, 2 = rare
|
|
||||||
*/
|
|
||||||
public static void addLootBagItem(ItemStack item, int weight, int... bagTypes) {
|
|
||||||
if (bagTypes==null || bagTypes.length==0)
|
|
||||||
WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item,weight));
|
|
||||||
else {
|
|
||||||
for (int rarity:bagTypes) {
|
|
||||||
switch(rarity) {
|
|
||||||
case 0: WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item,weight)); break;
|
|
||||||
case 1: WeightedRandomLoot.lootBagUncommon.add(new WeightedRandomLoot(item,weight)); break;
|
|
||||||
case 2: WeightedRandomLoot.lootBagRare.add(new WeightedRandomLoot(item,weight)); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//CROPS //////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To define mod crops you need to use FMLInterModComms in your @Mod.Init method.
|
|
||||||
* There are two 'types' of crops you can add. Standard crops and clickable crops.
|
|
||||||
*
|
|
||||||
* Standard crops work like normal vanilla crops - they grow until a certain metadata
|
|
||||||
* value is reached and you harvest them by destroying the block and collecting the blocks.
|
|
||||||
* You need to create and ItemStack that tells the golem what block id and metadata represents
|
|
||||||
* the crop when fully grown. Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get
|
|
||||||
* checked.
|
|
||||||
* Example for vanilla wheat:
|
|
||||||
* FMLInterModComms.sendMessage("Thaumcraft", "harvestStandardCrop", new ItemStack(Block.crops,1,7));
|
|
||||||
*
|
|
||||||
* Clickable crops are crops that you right click to gather their bounty instead of destroying them.
|
|
||||||
* As for standard crops, you need to create and ItemStack that tells the golem what block id
|
|
||||||
* and metadata represents the crop when fully grown. The golem will trigger the blocks onBlockActivated method.
|
|
||||||
* Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get checked.
|
|
||||||
* Example (this will technically do nothing since clicking wheat does nothing, but you get the idea):
|
|
||||||
* FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(Block.crops,1,7));
|
|
||||||
*
|
|
||||||
* Stacked crops (like reeds) are crops that you wish the bottom block should remain after harvesting.
|
|
||||||
* As for standard crops, you need to create and ItemStack that tells the golem what block id
|
|
||||||
* and metadata represents the crop when fully grown. Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the actualy md won't get
|
|
||||||
* checked. If it has the order upgrade it will only harvest if the crop is more than one block high.
|
|
||||||
* Example:
|
|
||||||
* FMLInterModComms.sendMessage("Thaumcraft", "harvestStackedCrop", new ItemStack(Block.reed,1,7));
|
|
||||||
*/
|
|
||||||
|
|
||||||
//NATIVE CLUSTERS //////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/**
|
|
||||||
* You can define certain ores that will have a chance to produce native clusters via FMLInterModComms
|
|
||||||
* in your @Mod.Init method using the "nativeCluster" string message.
|
|
||||||
* The format should be:
|
|
||||||
* "[ore item/block id],[ore item/block metadata],[cluster item/block id],[cluster item/block metadata],[chance modifier float]"
|
|
||||||
*
|
|
||||||
* NOTE: The chance modifier is a multiplier applied to the default chance for that cluster to be produced (default 27.5% for a pickaxe of the core)
|
|
||||||
*
|
|
||||||
* Example for vanilla iron ore to produce one of my own native iron clusters (assuming default id's) at double the default chance:
|
|
||||||
* FMLInterModComms.sendMessage("Thaumcraft", "nativeCluster","15,0,25016,16,2.0");
|
|
||||||
*/
|
|
||||||
|
|
||||||
//LAMP OF GROWTH BLACKLIST ///////////////////////////////////////////////////////////////////////////
|
|
||||||
/**
|
|
||||||
* You can blacklist crops that should not be effected by the Lamp of Growth via FMLInterModComms
|
|
||||||
* in your @Mod.Init method using the "lampBlacklist" itemstack message.
|
|
||||||
* Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get checked.
|
|
||||||
* Example for vanilla wheat:
|
|
||||||
* FMLInterModComms.sendMessage("Thaumcraft", "lampBlacklist", new ItemStack(Block.crops,1,OreDictionary.WILDCARD_VALUE));
|
|
||||||
*/
|
|
||||||
|
|
||||||
//DIMENSION BLACKLIST ///////////////////////////////////////////////////////////////////////////
|
|
||||||
/**
|
|
||||||
* You can blacklist a dimension to not spawn certain thaumcraft features
|
|
||||||
* in your @Mod.Init method using the "dimensionBlacklist" string message in the format "[dimension]:[level]"
|
|
||||||
* The level values are as follows:
|
|
||||||
* [0] stop all tc spawning and generation
|
|
||||||
* [1] allow ore and node generation (and node special features)
|
|
||||||
* [2] allow mob spawning
|
|
||||||
* [3] allow ore and node gen + mob spawning (and node special features)
|
|
||||||
* Example:
|
|
||||||
* FMLInterModComms.sendMessage("Thaumcraft", "dimensionBlacklist", "15:1");
|
|
||||||
*/
|
|
||||||
|
|
||||||
//BIOME BLACKLIST ///////////////////////////////////////////////////////////////////////////
|
|
||||||
/**
|
|
||||||
* You can blacklist a biome to not spawn certain thaumcraft features
|
|
||||||
* in your @Mod.Init method using the "biomeBlacklist" string message in the format "[biome id]:[level]"
|
|
||||||
* The level values are as follows:
|
|
||||||
* [0] stop all tc spawning and generation
|
|
||||||
* [1] allow ore and node generation (and node special features)
|
|
||||||
* [2] allow mob spawning
|
|
||||||
* [3] allow ore and node gen + mob spawning (and node special features)
|
|
||||||
* Example:
|
|
||||||
* FMLInterModComms.sendMessage("Thaumcraft", "biomeBlacklist", "180:2");
|
|
||||||
*/
|
|
||||||
|
|
||||||
//CHAMPION MOB WHITELIST ///////////////////////////////////////////////////////////////////////////
|
|
||||||
/**
|
|
||||||
* You can whitelist an entity class so it can rarely spawn champion versions in your @Mod.Init method using
|
|
||||||
* the "championWhiteList" string message in the format "[Entity]:[level]"
|
|
||||||
* The entity must extend EntityMob.
|
|
||||||
* [Entity] is in a similar format to what is used for mob spawners and such (see EntityList.class for vanilla examples).
|
|
||||||
* The [level] value indicate how rare the champion version will be - the higher the number the more common.
|
|
||||||
* The number roughly equals the [n] in 100 chance of a mob being a champion version.
|
|
||||||
* You can give 0 or negative numbers to allow champions to spawn with a very low chance only in particularly dangerous places.
|
|
||||||
* However anything less than about -2 will probably result in no spawns at all.
|
|
||||||
* Example:
|
|
||||||
* FMLInterModComms.sendMessage("Thaumcraft", "championWhiteList", "Thaumcraft.Wisp:1");
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -1,467 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
|
||||||
|
|
||||||
public class ThaumcraftApiHelper {
|
|
||||||
|
|
||||||
public static AspectList cullTags(AspectList temp) {
|
|
||||||
AspectList temp2 = new AspectList();
|
|
||||||
for (Aspect tag:temp.getAspects()) {
|
|
||||||
if (tag!=null)
|
|
||||||
temp2.add(tag, temp.getAmount(tag));
|
|
||||||
}
|
|
||||||
while (temp2!=null && temp2.size()>6) {
|
|
||||||
Aspect lowest = null;
|
|
||||||
float low = Short.MAX_VALUE;
|
|
||||||
for (Aspect tag:temp2.getAspects()) {
|
|
||||||
if (tag==null) continue;
|
|
||||||
float ta=temp2.getAmount(tag);
|
|
||||||
if (tag.isPrimal()) {
|
|
||||||
ta *= .9f;
|
|
||||||
} else {
|
|
||||||
if (!tag.getComponents()[0].isPrimal()) {
|
|
||||||
ta *= 1.1f;
|
|
||||||
if (!tag.getComponents()[0].getComponents()[0].isPrimal()) {
|
|
||||||
ta *= 1.05f;
|
|
||||||
}
|
|
||||||
if (!tag.getComponents()[0].getComponents()[1].isPrimal()) {
|
|
||||||
ta *= 1.05f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!tag.getComponents()[1].isPrimal()) {
|
|
||||||
ta *= 1.1f;
|
|
||||||
if (!tag.getComponents()[1].getComponents()[0].isPrimal()) {
|
|
||||||
ta *= 1.05f;
|
|
||||||
}
|
|
||||||
if (!tag.getComponents()[1].getComponents()[1].isPrimal()) {
|
|
||||||
ta *= 1.05f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ta<low) {
|
|
||||||
low = ta;
|
|
||||||
lowest = tag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
temp2.aspects.remove(lowest);
|
|
||||||
}
|
|
||||||
return temp2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean areItemsEqual(ItemStack s1,ItemStack s2)
|
|
||||||
{
|
|
||||||
if (s1.isItemStackDamageable() && s2.isItemStackDamageable())
|
|
||||||
{
|
|
||||||
return s1.getItem() == s2.getItem();
|
|
||||||
} else
|
|
||||||
return s1.getItem() == s2.getItem() && s1.getItemDamage() == s2.getItemDamage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isResearchComplete(String username, String researchkey) {
|
|
||||||
return ThaumcraftApi.internalMethods.isResearchComplete(username, researchkey);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasDiscoveredAspect(String username, Aspect aspect) {
|
|
||||||
return ThaumcraftApi.internalMethods.hasDiscoveredAspect(username, aspect);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AspectList getDiscoveredAspects(String username) {
|
|
||||||
return ThaumcraftApi.internalMethods.getDiscoveredAspects(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getStackInRowAndColumn(Object instance, int row, int column) {
|
|
||||||
return ThaumcraftApi.internalMethods.getStackInRowAndColumn(instance, row, column);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AspectList getObjectAspects(ItemStack is) {
|
|
||||||
return ThaumcraftApi.internalMethods.getObjectAspects(is);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AspectList getBonusObjectTags(ItemStack is,AspectList ot) {
|
|
||||||
return ThaumcraftApi.internalMethods.getBonusObjectTags(is, ot);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AspectList generateTags(Item item, int meta) {
|
|
||||||
return ThaumcraftApi.internalMethods.generateTags(item, meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets)
|
|
||||||
{
|
|
||||||
for (ItemStack input : inputs)
|
|
||||||
{
|
|
||||||
for (ItemStack target : targets)
|
|
||||||
{
|
|
||||||
if (itemMatches(target, input, strict))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean areItemStackTagsEqualForCrafting(ItemStack slotItem,ItemStack recipeItem)
|
|
||||||
{
|
|
||||||
if (recipeItem == null || slotItem == null) return false;
|
|
||||||
if (recipeItem.stackTagCompound!=null && slotItem.stackTagCompound==null ) return false;
|
|
||||||
if (recipeItem.stackTagCompound==null ) return true;
|
|
||||||
|
|
||||||
Iterator iterator = recipeItem.stackTagCompound.func_150296_c().iterator();
|
|
||||||
while (iterator.hasNext())
|
|
||||||
{
|
|
||||||
String s = (String)iterator.next();
|
|
||||||
if (slotItem.stackTagCompound.hasKey(s)) {
|
|
||||||
if (!slotItem.stackTagCompound.getTag(s).toString().equals(
|
|
||||||
recipeItem.stackTagCompound.getTag(s).toString())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
|
|
||||||
{
|
|
||||||
if (input == null && target != null || input != null && target == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (target.getItem() == input.getItem() &&
|
|
||||||
((target.getItemDamage() == OreDictionary.WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
|
|
||||||
TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
|
|
||||||
if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite()))
|
|
||||||
return te;
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
|
||||||
TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
|
|
||||||
if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite()))
|
|
||||||
return te;
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static HashMap<Integer, AspectList> allAspects= new HashMap<Integer, AspectList>();
|
|
||||||
private static HashMap<Integer, AspectList> allCompoundAspects= new HashMap<Integer, AspectList>();
|
|
||||||
|
|
||||||
public static AspectList getAllAspects(int amount) {
|
|
||||||
if (allAspects.get(amount)==null) {
|
|
||||||
AspectList al = new AspectList();
|
|
||||||
for (Aspect aspect:Aspect.aspects.values()) {
|
|
||||||
al.add(aspect, amount);
|
|
||||||
}
|
|
||||||
allAspects.put(amount, al);
|
|
||||||
}
|
|
||||||
return allAspects.get(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AspectList getAllCompoundAspects(int amount) {
|
|
||||||
if (allCompoundAspects.get(amount)==null) {
|
|
||||||
AspectList al = new AspectList();
|
|
||||||
for (Aspect aspect:Aspect.getCompoundAspects()) {
|
|
||||||
al.add(aspect, amount);
|
|
||||||
}
|
|
||||||
allCompoundAspects.put(amount, al);
|
|
||||||
}
|
|
||||||
return allCompoundAspects.get(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use to subtract vis from a wand for most operations
|
|
||||||
* Wands store vis differently so "real" vis costs need to be multiplied by 100 before calling this method
|
|
||||||
* @param wand the wand itemstack
|
|
||||||
* @param player the player using the wand
|
|
||||||
* @param cost the cost of the operation.
|
|
||||||
* @param doit actually subtract the vis from the wand if true - if false just simulate the result
|
|
||||||
* @param crafting is this a crafting operation or not - if
|
|
||||||
* false then things like frugal and potency will apply to the costs
|
|
||||||
* @return was the vis successfully subtracted
|
|
||||||
*/
|
|
||||||
public static boolean consumeVisFromWand(ItemStack wand, EntityPlayer player,
|
|
||||||
AspectList cost, boolean doit, boolean crafting) {
|
|
||||||
return ThaumcraftApi.internalMethods.consumeVisFromWand(wand, player, cost, doit, crafting);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subtract vis for use by a crafting mechanic. Costs are calculated slightly
|
|
||||||
* differently and things like the frugal enchant is ignored
|
|
||||||
* Must NOT be multiplied by 100 - send the actual vis cost
|
|
||||||
* @param wand the wand itemstack
|
|
||||||
* @param player the player using the wand
|
|
||||||
* @param cost the cost of the operation.
|
|
||||||
* @param doit actually subtract the vis from the wand if true - if false just simulate the result
|
|
||||||
* @return was the vis successfully subtracted
|
|
||||||
*/
|
|
||||||
public static boolean consumeVisFromWandCrafting(ItemStack wand, EntityPlayer player,
|
|
||||||
AspectList cost, boolean doit) {
|
|
||||||
return ThaumcraftApi.internalMethods.consumeVisFromWandCrafting(wand, player, cost, doit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subtract vis from a wand the player is carrying. Works like consumeVisFromWand in that actual vis
|
|
||||||
* costs should be multiplied by 100. The costs are handled like crafting however and things like
|
|
||||||
* frugal don't effect them
|
|
||||||
* @param player the player using the wand
|
|
||||||
* @param cost the cost of the operation.
|
|
||||||
* @return was the vis successfully subtracted
|
|
||||||
*/
|
|
||||||
public static boolean consumeVisFromInventory(EntityPlayer player, AspectList cost) {
|
|
||||||
return ThaumcraftApi.internalMethods.consumeVisFromInventory(player, cost);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This adds permanents or temporary warp to a player. It will automatically be synced clientside
|
|
||||||
* @param player the player using the wand
|
|
||||||
* @param amount how much warp to add. Negative amounts are only valid for temporary warp
|
|
||||||
* @param temporary add temporary warp instead of permanent
|
|
||||||
*/
|
|
||||||
public static void addWarpToPlayer(EntityPlayer player, int amount, boolean temporary) {
|
|
||||||
ThaumcraftApi.internalMethods.addWarpToPlayer(player, amount, temporary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This "sticky" warp to a player. Sticky warp is permanent warp that can be removed.
|
|
||||||
* It will automatically be synced clientside
|
|
||||||
* @param player the player using the wand
|
|
||||||
* @param amount how much warp to add. Can have negative amounts.
|
|
||||||
*/
|
|
||||||
public static void addStickyWarpToPlayer(EntityPlayer player, int amount) {
|
|
||||||
ThaumcraftApi.internalMethods.addStickyWarpToPlayer(player, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MovingObjectPosition rayTraceIgnoringSource(World world, Vec3 v1, Vec3 v2,
|
|
||||||
boolean bool1, boolean bool2, boolean bool3)
|
|
||||||
{
|
|
||||||
if (!Double.isNaN(v1.xCoord) && !Double.isNaN(v1.yCoord) && !Double.isNaN(v1.zCoord))
|
|
||||||
{
|
|
||||||
if (!Double.isNaN(v2.xCoord) && !Double.isNaN(v2.yCoord) && !Double.isNaN(v2.zCoord))
|
|
||||||
{
|
|
||||||
int i = MathHelper.floor_double(v2.xCoord);
|
|
||||||
int j = MathHelper.floor_double(v2.yCoord);
|
|
||||||
int k = MathHelper.floor_double(v2.zCoord);
|
|
||||||
int l = MathHelper.floor_double(v1.xCoord);
|
|
||||||
int i1 = MathHelper.floor_double(v1.yCoord);
|
|
||||||
int j1 = MathHelper.floor_double(v1.zCoord);
|
|
||||||
Block block = world.getBlock(l, i1, j1);
|
|
||||||
int k1 = world.getBlockMetadata(l, i1, j1);
|
|
||||||
|
|
||||||
MovingObjectPosition movingobjectposition2 = null;
|
|
||||||
k1 = 200;
|
|
||||||
|
|
||||||
while (k1-- >= 0)
|
|
||||||
{
|
|
||||||
if (Double.isNaN(v1.xCoord) || Double.isNaN(v1.yCoord) || Double.isNaN(v1.zCoord))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == i && i1 == j && j1 == k)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean flag6 = true;
|
|
||||||
boolean flag3 = true;
|
|
||||||
boolean flag4 = true;
|
|
||||||
double d0 = 999.0D;
|
|
||||||
double d1 = 999.0D;
|
|
||||||
double d2 = 999.0D;
|
|
||||||
|
|
||||||
if (i > l)
|
|
||||||
{
|
|
||||||
d0 = (double)l + 1.0D;
|
|
||||||
}
|
|
||||||
else if (i < l)
|
|
||||||
{
|
|
||||||
d0 = (double)l + 0.0D;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
flag6 = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (j > i1)
|
|
||||||
{
|
|
||||||
d1 = (double)i1 + 1.0D;
|
|
||||||
}
|
|
||||||
else if (j < i1)
|
|
||||||
{
|
|
||||||
d1 = (double)i1 + 0.0D;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
flag3 = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (k > j1)
|
|
||||||
{
|
|
||||||
d2 = (double)j1 + 1.0D;
|
|
||||||
}
|
|
||||||
else if (k < j1)
|
|
||||||
{
|
|
||||||
d2 = (double)j1 + 0.0D;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
flag4 = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
double d3 = 999.0D;
|
|
||||||
double d4 = 999.0D;
|
|
||||||
double d5 = 999.0D;
|
|
||||||
double d6 = v2.xCoord - v1.xCoord;
|
|
||||||
double d7 = v2.yCoord - v1.yCoord;
|
|
||||||
double d8 = v2.zCoord - v1.zCoord;
|
|
||||||
|
|
||||||
if (flag6)
|
|
||||||
{
|
|
||||||
d3 = (d0 - v1.xCoord) / d6;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag3)
|
|
||||||
{
|
|
||||||
d4 = (d1 - v1.yCoord) / d7;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag4)
|
|
||||||
{
|
|
||||||
d5 = (d2 - v1.zCoord) / d8;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean flag5 = false;
|
|
||||||
byte b0;
|
|
||||||
|
|
||||||
if (d3 < d4 && d3 < d5)
|
|
||||||
{
|
|
||||||
if (i > l)
|
|
||||||
{
|
|
||||||
b0 = 4;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
b0 = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
v1.xCoord = d0;
|
|
||||||
v1.yCoord += d7 * d3;
|
|
||||||
v1.zCoord += d8 * d3;
|
|
||||||
}
|
|
||||||
else if (d4 < d5)
|
|
||||||
{
|
|
||||||
if (j > i1)
|
|
||||||
{
|
|
||||||
b0 = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
b0 = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
v1.xCoord += d6 * d4;
|
|
||||||
v1.yCoord = d1;
|
|
||||||
v1.zCoord += d8 * d4;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (k > j1)
|
|
||||||
{
|
|
||||||
b0 = 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
b0 = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
v1.xCoord += d6 * d5;
|
|
||||||
v1.yCoord += d7 * d5;
|
|
||||||
v1.zCoord = d2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vec3 vec32 = Vec3.createVectorHelper(v1.xCoord, v1.yCoord, v1.zCoord);
|
|
||||||
l = (int)(vec32.xCoord = (double)MathHelper.floor_double(v1.xCoord));
|
|
||||||
|
|
||||||
if (b0 == 5)
|
|
||||||
{
|
|
||||||
--l;
|
|
||||||
++vec32.xCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
i1 = (int)(vec32.yCoord = (double)MathHelper.floor_double(v1.yCoord));
|
|
||||||
|
|
||||||
if (b0 == 1)
|
|
||||||
{
|
|
||||||
--i1;
|
|
||||||
++vec32.yCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
j1 = (int)(vec32.zCoord = (double)MathHelper.floor_double(v1.zCoord));
|
|
||||||
|
|
||||||
if (b0 == 3)
|
|
||||||
{
|
|
||||||
--j1;
|
|
||||||
++vec32.zCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
Block block1 = world.getBlock(l, i1, j1);
|
|
||||||
int l1 = world.getBlockMetadata(l, i1, j1);
|
|
||||||
|
|
||||||
if (!bool2 || block1.getCollisionBoundingBoxFromPool(world, l, i1, j1) != null)
|
|
||||||
{
|
|
||||||
if (block1.canCollideCheck(l1, bool1))
|
|
||||||
{
|
|
||||||
MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(world, l, i1, j1, v1, v2);
|
|
||||||
|
|
||||||
if (movingobjectposition1 != null)
|
|
||||||
{
|
|
||||||
return movingobjectposition1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
movingobjectposition2 = new MovingObjectPosition(l, i1, j1, b0, v1, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bool3 ? movingobjectposition2 : null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.network.NetworkManager;
|
|
||||||
import net.minecraft.network.Packet;
|
|
||||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author azanor
|
|
||||||
*
|
|
||||||
* Custom tile entity class I use for most of my tile entities. Setup in such a way that only
|
|
||||||
* the nbt data within readCustomNBT / writeCustomNBT will be sent to the client when the tile
|
|
||||||
* updates. Apart from all the normal TE data that gets sent that is.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TileThaumcraft extends TileEntity {
|
|
||||||
|
|
||||||
//NBT stuff
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
|
||||||
{
|
|
||||||
super.readFromNBT(nbttagcompound);
|
|
||||||
readCustomNBT(nbttagcompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readCustomNBT(NBTTagCompound nbttagcompound)
|
|
||||||
{
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
|
||||||
{
|
|
||||||
super.writeToNBT(nbttagcompound);
|
|
||||||
writeCustomNBT(nbttagcompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeCustomNBT(NBTTagCompound nbttagcompound)
|
|
||||||
{
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
//Client Packet stuff
|
|
||||||
@Override
|
|
||||||
public Packet getDescriptionPacket() {
|
|
||||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
|
||||||
this.writeCustomNBT(nbttagcompound);
|
|
||||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, nbttagcompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
|
||||||
super.onDataPacket(net, pkt);
|
|
||||||
this.readCustomNBT(pkt.func_148857_g());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
|
|
||||||
public class WorldCoordinates implements Comparable
|
|
||||||
{
|
|
||||||
public int x;
|
|
||||||
|
|
||||||
/** the y coordinate */
|
|
||||||
public int y;
|
|
||||||
|
|
||||||
/** the z coordinate */
|
|
||||||
public int z;
|
|
||||||
|
|
||||||
public int dim;
|
|
||||||
|
|
||||||
public WorldCoordinates() {}
|
|
||||||
|
|
||||||
public WorldCoordinates(int par1, int par2, int par3, int d)
|
|
||||||
{
|
|
||||||
this.x = par1;
|
|
||||||
this.y = par2;
|
|
||||||
this.z = par3;
|
|
||||||
this.dim = d;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorldCoordinates(TileEntity tile)
|
|
||||||
{
|
|
||||||
this.x = tile.xCoord;
|
|
||||||
this.y = tile.yCoord;
|
|
||||||
this.z = tile.zCoord;
|
|
||||||
this.dim = tile.getWorldObj().provider.dimensionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorldCoordinates(WorldCoordinates par1ChunkCoordinates)
|
|
||||||
{
|
|
||||||
this.x = par1ChunkCoordinates.x;
|
|
||||||
this.y = par1ChunkCoordinates.y;
|
|
||||||
this.z = par1ChunkCoordinates.z;
|
|
||||||
this.dim = par1ChunkCoordinates.dim;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object par1Obj)
|
|
||||||
{
|
|
||||||
if (!(par1Obj instanceof WorldCoordinates))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WorldCoordinates coordinates = (WorldCoordinates)par1Obj;
|
|
||||||
return this.x == coordinates.x && this.y == coordinates.y && this.z == coordinates.z && this.dim == coordinates.dim ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return this.x + this.y << 8 + this.z << 16 + this.dim << 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compare the coordinate with another coordinate
|
|
||||||
*/
|
|
||||||
public int compareWorldCoordinate(WorldCoordinates par1)
|
|
||||||
{
|
|
||||||
return this.dim == par1.dim ? (
|
|
||||||
this.y == par1.y ? (this.z == par1.z ? this.x - par1.x : this.z - par1.z) : this.y - par1.y) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set(int par1, int par2, int par3, int d)
|
|
||||||
{
|
|
||||||
this.x = par1;
|
|
||||||
this.y = par2;
|
|
||||||
this.z = par3;
|
|
||||||
this.dim = d;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the squared distance between this coordinates and the coordinates given as argument.
|
|
||||||
*/
|
|
||||||
public float getDistanceSquared(int par1, int par2, int par3)
|
|
||||||
{
|
|
||||||
float f = (float)(this.x - par1);
|
|
||||||
float f1 = (float)(this.y - par2);
|
|
||||||
float f2 = (float)(this.z - par3);
|
|
||||||
return f * f + f1 * f1 + f2 * f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the squared distance between this coordinates and the ChunkCoordinates given as argument.
|
|
||||||
*/
|
|
||||||
public float getDistanceSquaredToWorldCoordinates(WorldCoordinates par1ChunkCoordinates)
|
|
||||||
{
|
|
||||||
return this.getDistanceSquared(par1ChunkCoordinates.x, par1ChunkCoordinates.y, par1ChunkCoordinates.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int compareTo(Object par1Obj)
|
|
||||||
{
|
|
||||||
return this.compareWorldCoordinate((WorldCoordinates)par1Obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readNBT(NBTTagCompound nbt) {
|
|
||||||
this.x = nbt.getInteger("w_x");
|
|
||||||
this.y = nbt.getInteger("w_y");
|
|
||||||
this.z = nbt.getInteger("w_z");
|
|
||||||
this.dim = nbt.getInteger("w_d");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeNBT(NBTTagCompound nbt) {
|
|
||||||
nbt.setInteger("w_x",x);
|
|
||||||
nbt.setInteger("w_y",y);
|
|
||||||
nbt.setInteger("w_z",z);
|
|
||||||
nbt.setInteger("w_d",dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,201 +0,0 @@
|
|||||||
package thaumcraft.api.aspects;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
|
||||||
|
|
||||||
public class Aspect {
|
|
||||||
|
|
||||||
String tag;
|
|
||||||
Aspect[] components;
|
|
||||||
int color;
|
|
||||||
private String chatcolor;
|
|
||||||
ResourceLocation image;
|
|
||||||
int blend;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this constructor to register your own aspects.
|
|
||||||
* @param tag the key that will be used to reference this aspect, as well as its latin display name
|
|
||||||
* @param color color to display the tag in
|
|
||||||
* @param components the aspects this one is formed from
|
|
||||||
* @param image ResourceLocation pointing to a 32x32 icon of the aspect
|
|
||||||
* @param blend GL11 blendmode (1 or 771). Used for rendering nodes. Default is 1
|
|
||||||
*/
|
|
||||||
public Aspect(String tag, int color, Aspect[] components, ResourceLocation image, int blend) {
|
|
||||||
if (aspects.containsKey(tag)) throw new IllegalArgumentException(tag+" already registered!");
|
|
||||||
this.tag = tag;
|
|
||||||
this.components = components;
|
|
||||||
this.color = color;
|
|
||||||
this.image = image;
|
|
||||||
this.blend = blend;
|
|
||||||
aspects.put(tag, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shortcut constructor I use for the default aspects - you shouldn't be using this.
|
|
||||||
*/
|
|
||||||
public Aspect(String tag, int color, Aspect[] components) {
|
|
||||||
this(tag,color,components,new ResourceLocation("thaumcraft","textures/aspects/"+tag.toLowerCase()+".png"),1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shortcut constructor I use for the default aspects - you shouldn't be using this.
|
|
||||||
*/
|
|
||||||
public Aspect(String tag, int color, Aspect[] components, int blend) {
|
|
||||||
this(tag,color,components,new ResourceLocation("thaumcraft","textures/aspects/"+tag.toLowerCase()+".png"),blend);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shortcut constructor I use for the primal aspects -
|
|
||||||
* you shouldn't use this as making your own primal aspects will break all the things.
|
|
||||||
*/
|
|
||||||
public Aspect(String tag, int color, String chatcolor, int blend) {
|
|
||||||
this(tag,color,(Aspect[])null, blend);
|
|
||||||
this.setChatcolor(chatcolor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return WordUtils.capitalizeFully(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLocalizedDescription() {
|
|
||||||
return StatCollector.translateToLocal("tc.aspect."+tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTag() {
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTag(String tag) {
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Aspect[] getComponents() {
|
|
||||||
return components;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComponents(Aspect[] components) {
|
|
||||||
this.components = components;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResourceLocation getImage() {
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Aspect getAspect(String tag) {
|
|
||||||
return aspects.get(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBlend() {
|
|
||||||
return blend;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBlend(int blend) {
|
|
||||||
this.blend = blend;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPrimal() {
|
|
||||||
return getComponents()==null || getComponents().length!=2;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////
|
|
||||||
public static ArrayList<Aspect> getPrimalAspects() {
|
|
||||||
ArrayList<Aspect> primals = new ArrayList<Aspect>();
|
|
||||||
Collection<Aspect> pa = aspects.values();
|
|
||||||
for (Aspect aspect:pa) {
|
|
||||||
if (aspect.isPrimal()) primals.add(aspect);
|
|
||||||
}
|
|
||||||
return primals;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Aspect> getCompoundAspects() {
|
|
||||||
ArrayList<Aspect> compounds = new ArrayList<Aspect>();
|
|
||||||
Collection<Aspect> pa = aspects.values();
|
|
||||||
for (Aspect aspect:pa) {
|
|
||||||
if (!aspect.isPrimal()) compounds.add(aspect);
|
|
||||||
}
|
|
||||||
return compounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getChatcolor() {
|
|
||||||
return chatcolor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChatcolor(String chatcolor) {
|
|
||||||
this.chatcolor = chatcolor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////
|
|
||||||
public static LinkedHashMap<String,Aspect> aspects = new LinkedHashMap<String,Aspect>();
|
|
||||||
|
|
||||||
//PRIMAL
|
|
||||||
public static final Aspect AIR = new Aspect("aer",0xffff7e,"e",1);
|
|
||||||
public static final Aspect EARTH = new Aspect("terra",0x56c000,"2",1);
|
|
||||||
public static final Aspect FIRE = new Aspect("ignis",0xff5a01,"c",1);
|
|
||||||
public static final Aspect WATER = new Aspect("aqua",0x3cd4fc,"3",1);
|
|
||||||
public static final Aspect ORDER = new Aspect("ordo",0xd5d4ec,"7",1);
|
|
||||||
public static final Aspect ENTROPY = new Aspect("perditio",0x404040,"8",771);
|
|
||||||
|
|
||||||
//SECONDARY
|
|
||||||
public static final Aspect VOID = new Aspect("vacuos",0x888888, new Aspect[] {AIR, ENTROPY},771);
|
|
||||||
public static final Aspect LIGHT = new Aspect("lux",0xfff663, new Aspect[] {AIR, FIRE});
|
|
||||||
public static final Aspect WEATHER = new Aspect("tempestas",0xFFFFFF, new Aspect[] {AIR, WATER});
|
|
||||||
public static final Aspect MOTION = new Aspect("motus",0xcdccf4, new Aspect[] {AIR, ORDER});
|
|
||||||
public static final Aspect COLD = new Aspect("gelum",0xe1ffff, new Aspect[] {FIRE, ENTROPY});
|
|
||||||
public static final Aspect CRYSTAL = new Aspect("vitreus",0x80ffff, new Aspect[] {EARTH, ORDER});
|
|
||||||
public static final Aspect LIFE = new Aspect("victus",0xde0005, new Aspect[] {WATER, EARTH});
|
|
||||||
public static final Aspect POISON = new Aspect("venenum",0x89f000, new Aspect[] {WATER, ENTROPY});
|
|
||||||
public static final Aspect ENERGY = new Aspect("potentia",0xc0ffff, new Aspect[] {ORDER, FIRE});
|
|
||||||
public static final Aspect EXCHANGE = new Aspect("permutatio",0x578357, new Aspect[] {ENTROPY, ORDER});
|
|
||||||
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {AIR, EARTH});
|
|
||||||
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {FIRE, EARTH});
|
|
||||||
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {FIRE, WATER});
|
|
||||||
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {ORDER, WATER});
|
|
||||||
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {EARTH, ENTROPY});
|
|
||||||
|
|
||||||
//TERTIARY
|
|
||||||
public static final Aspect METAL = new Aspect("metallum",0xb5b5cd, new Aspect[] {EARTH, CRYSTAL});
|
|
||||||
public static final Aspect DEATH = new Aspect("mortuus",0x887788, new Aspect[] {LIFE, ENTROPY});
|
|
||||||
public static final Aspect FLIGHT = new Aspect("volatus",0xe7e7d7, new Aspect[] {AIR, MOTION});
|
|
||||||
public static final Aspect DARKNESS = new Aspect("tenebrae",0x222222, new Aspect[] {VOID, LIGHT});
|
|
||||||
public static final Aspect SOUL = new Aspect("spiritus",0xebebfb, new Aspect[] {LIFE, DEATH});
|
|
||||||
public static final Aspect HEAL = new Aspect("sano",0xff2f34, new Aspect[] {LIFE, ORDER});
|
|
||||||
public static final Aspect TRAVEL = new Aspect("iter",0xe0585b, new Aspect[] {MOTION, EARTH});
|
|
||||||
public static final Aspect ELDRITCH = new Aspect("alienis",0x805080, new Aspect[] {VOID, DARKNESS});
|
|
||||||
public static final Aspect MAGIC = new Aspect("praecantatio",0x9700c0, new Aspect[] {VOID, ENERGY});
|
|
||||||
public static final Aspect AURA = new Aspect("auram",0xffc0ff, new Aspect[] {MAGIC, AIR});
|
|
||||||
public static final Aspect TAINT = new Aspect("vitium",0x800080, new Aspect[] {MAGIC, ENTROPY});
|
|
||||||
public static final Aspect SLIME = new Aspect("limus",0x01f800, new Aspect[] {LIFE, WATER});
|
|
||||||
public static final Aspect PLANT = new Aspect("herba",0x01ac00, new Aspect[] {LIFE, EARTH});
|
|
||||||
public static final Aspect TREE = new Aspect("arbor",0x876531, new Aspect[] {AIR, PLANT});
|
|
||||||
public static final Aspect BEAST = new Aspect("bestia",0x9f6409, new Aspect[] {MOTION, LIFE});
|
|
||||||
public static final Aspect FLESH = new Aspect("corpus",0xee478d, new Aspect[] {DEATH, BEAST});
|
|
||||||
public static final Aspect UNDEAD = new Aspect("exanimis",0x3a4000, new Aspect[] {MOTION, DEATH});
|
|
||||||
public static final Aspect MIND = new Aspect("cognitio",0xffc2b3, new Aspect[] {EARTH, SOUL});
|
|
||||||
public static final Aspect SENSES = new Aspect("sensus",0x0fd9ff, new Aspect[] {AIR, SOUL});
|
|
||||||
public static final Aspect MAN = new Aspect("humanus",0xffd7c0, new Aspect[] {BEAST, MIND});
|
|
||||||
public static final Aspect CROP = new Aspect("messis",0xe1b371, new Aspect[] {PLANT, MAN});
|
|
||||||
public static final Aspect MINE = new Aspect("perfodio",0xdcd2d8, new Aspect[] {MAN, EARTH});
|
|
||||||
public static final Aspect TOOL = new Aspect("instrumentum",0x4040ee, new Aspect[] {MAN, ORDER});
|
|
||||||
public static final Aspect HARVEST = new Aspect("meto",0xeead82, new Aspect[] {CROP, TOOL});
|
|
||||||
public static final Aspect WEAPON = new Aspect("telum",0xc05050, new Aspect[] {TOOL, ENTROPY});
|
|
||||||
public static final Aspect ARMOR = new Aspect("tutamen",0x00c0c0, new Aspect[] {TOOL, EARTH});
|
|
||||||
public static final Aspect HUNGER = new Aspect("fames",0x9a0305, new Aspect[] {LIFE, VOID});
|
|
||||||
public static final Aspect GREED = new Aspect("lucrum",0xe6be44, new Aspect[] {MAN, HUNGER});
|
|
||||||
public static final Aspect CRAFT = new Aspect("fabrico",0x809d80, new Aspect[] {MAN, TOOL});
|
|
||||||
public static final Aspect CLOTH = new Aspect("pannus",0xeaeac2, new Aspect[] {TOOL, BEAST});
|
|
||||||
public static final Aspect MECHANISM = new Aspect("machina",0x8080a0, new Aspect[] {MOTION, TOOL});
|
|
||||||
public static final Aspect TRAP = new Aspect("vinculum",0x9a8080, new Aspect[] {MOTION, ENTROPY});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,292 +0,0 @@
|
|||||||
package thaumcraft.api.aspects;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import thaumcraft.api.ThaumcraftApiHelper;
|
|
||||||
|
|
||||||
public class AspectList implements Serializable {
|
|
||||||
|
|
||||||
public LinkedHashMap<Aspect,Integer> aspects = new LinkedHashMap<Aspect,Integer>();//aspects associated with this object
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this creates a new aspect list with preloaded values based off the aspects of the given item.
|
|
||||||
* @param the itemstack of the given item
|
|
||||||
*/
|
|
||||||
public AspectList(ItemStack stack) {
|
|
||||||
try {
|
|
||||||
AspectList temp = ThaumcraftApiHelper.getObjectAspects(stack);
|
|
||||||
if (temp!=null)
|
|
||||||
for (Aspect tag:temp.getAspects()) {
|
|
||||||
add(tag,temp.getAmount(tag));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspectList() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspectList copy() {
|
|
||||||
AspectList out = new AspectList();
|
|
||||||
for (Aspect a:this.getAspects())
|
|
||||||
out.add(a, this.getAmount(a));
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the amount of different aspects in this collection
|
|
||||||
*/
|
|
||||||
public int size() {
|
|
||||||
return aspects.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the amount of total vis in this collection
|
|
||||||
*/
|
|
||||||
public int visSize() {
|
|
||||||
int q = 0;
|
|
||||||
|
|
||||||
for (Aspect as:aspects.keySet()) {
|
|
||||||
q+=this.getAmount(as);
|
|
||||||
}
|
|
||||||
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return an array of all the aspects in this collection
|
|
||||||
*/
|
|
||||||
public Aspect[] getAspects() {
|
|
||||||
Aspect[] q = new Aspect[1];
|
|
||||||
return aspects.keySet().toArray(q);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return an array of all the aspects in this collection
|
|
||||||
*/
|
|
||||||
public Aspect[] getPrimalAspects() {
|
|
||||||
AspectList t = new AspectList();
|
|
||||||
for (Aspect as:aspects.keySet()) {
|
|
||||||
if (as.isPrimal()) {
|
|
||||||
t.add(as,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Aspect[] q = new Aspect[1];
|
|
||||||
return t.aspects.keySet().toArray(q);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return an array of all the aspects in this collection sorted by name
|
|
||||||
*/
|
|
||||||
public Aspect[] getAspectsSorted() {
|
|
||||||
try {
|
|
||||||
Aspect[] out = aspects.keySet().toArray(new Aspect[]{});
|
|
||||||
boolean change=false;
|
|
||||||
do {
|
|
||||||
change=false;
|
|
||||||
for(int a=0;a<out.length-1;a++) {
|
|
||||||
Aspect e1 = out[a];
|
|
||||||
Aspect e2 = out[a+1];
|
|
||||||
if (e1!=null && e2!=null && e1.getTag().compareTo(e2.getTag())>0) {
|
|
||||||
out[a] = e2;
|
|
||||||
out[a+1] = e1;
|
|
||||||
change = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (change==true);
|
|
||||||
return out;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return this.getAspects();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return an array of all the aspects in this collection sorted by amount
|
|
||||||
*/
|
|
||||||
public Aspect[] getAspectsSortedAmount() {
|
|
||||||
try {
|
|
||||||
Aspect[] out = aspects.keySet().toArray(new Aspect[1]);
|
|
||||||
boolean change=false;
|
|
||||||
do {
|
|
||||||
change=false;
|
|
||||||
for(int a=0;a<out.length-1;a++) {
|
|
||||||
int e1 = getAmount(out[a]);
|
|
||||||
int e2 = getAmount(out[a+1]);
|
|
||||||
if (e1>0 && e2>0 && e2>e1) {
|
|
||||||
Aspect ea = out[a];
|
|
||||||
Aspect eb = out[a+1];
|
|
||||||
out[a] = eb;
|
|
||||||
out[a+1] = ea;
|
|
||||||
change = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (change==true);
|
|
||||||
return out;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return this.getAspects();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param key
|
|
||||||
* @return the amount associated with the given aspect in this collection
|
|
||||||
*/
|
|
||||||
public int getAmount(Aspect key) {
|
|
||||||
return aspects.get(key)==null?0:aspects.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reduces the amount of an aspect in this collection by the given amount.
|
|
||||||
* @param key
|
|
||||||
* @param amount
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean reduce(Aspect key, int amount) {
|
|
||||||
if (getAmount(key)>=amount) {
|
|
||||||
int am = getAmount(key)-amount;
|
|
||||||
aspects.put(key, am);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reduces the amount of an aspect in this collection by the given amount.
|
|
||||||
* If reduced to 0 or less the aspect will be removed completely.
|
|
||||||
* @param key
|
|
||||||
* @param amount
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public AspectList remove(Aspect key, int amount) {
|
|
||||||
int am = getAmount(key)-amount;
|
|
||||||
if (am<=0) aspects.remove(key); else
|
|
||||||
this.aspects.put(key, am);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simply removes the aspect from the list
|
|
||||||
* @param key
|
|
||||||
* @param amount
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public AspectList remove(Aspect key) {
|
|
||||||
aspects.remove(key);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds this aspect and amount to the collection.
|
|
||||||
* If the aspect exists then its value will be increased by the given amount.
|
|
||||||
* @param aspect
|
|
||||||
* @param amount
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public AspectList add(Aspect aspect, int amount) {
|
|
||||||
if (this.aspects.containsKey(aspect)) {
|
|
||||||
int oldamount = this.aspects.get(aspect);
|
|
||||||
amount+=oldamount;
|
|
||||||
}
|
|
||||||
this.aspects.put( aspect, amount );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds this aspect and amount to the collection.
|
|
||||||
* If the aspect exists then only the highest of the old or new amount will be used.
|
|
||||||
* @param aspect
|
|
||||||
* @param amount
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public AspectList merge(Aspect aspect, int amount) {
|
|
||||||
if (this.aspects.containsKey(aspect)) {
|
|
||||||
int oldamount = this.aspects.get(aspect);
|
|
||||||
if (amount<oldamount) amount=oldamount;
|
|
||||||
|
|
||||||
}
|
|
||||||
this.aspects.put( aspect, amount );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspectList add(AspectList in) {
|
|
||||||
for (Aspect a:in.getAspects())
|
|
||||||
this.add(a, in.getAmount(a));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspectList merge(AspectList in) {
|
|
||||||
for (Aspect a:in.getAspects())
|
|
||||||
this.merge(a, in.getAmount(a));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the list of aspects from nbt
|
|
||||||
* @param nbttagcompound
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
|
||||||
{
|
|
||||||
aspects.clear();
|
|
||||||
NBTTagList tlist = nbttagcompound.getTagList("Aspects",(byte)10);
|
|
||||||
for (int j = 0; j < tlist.tagCount(); j++) {
|
|
||||||
NBTTagCompound rs = (NBTTagCompound) tlist.getCompoundTagAt(j);
|
|
||||||
if (rs.hasKey("key")) {
|
|
||||||
add( Aspect.getAspect(rs.getString("key")),
|
|
||||||
rs.getInteger("amount"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound, String label)
|
|
||||||
{
|
|
||||||
aspects.clear();
|
|
||||||
NBTTagList tlist = nbttagcompound.getTagList(label,(byte)10);
|
|
||||||
for (int j = 0; j < tlist.tagCount(); j++) {
|
|
||||||
NBTTagCompound rs = (NBTTagCompound) tlist.getCompoundTagAt(j);
|
|
||||||
if (rs.hasKey("key")) {
|
|
||||||
add( Aspect.getAspect(rs.getString("key")),
|
|
||||||
rs.getInteger("amount"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the list of aspects to nbt
|
|
||||||
* @param nbttagcompound
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
|
||||||
{
|
|
||||||
NBTTagList tlist = new NBTTagList();
|
|
||||||
nbttagcompound.setTag("Aspects", tlist);
|
|
||||||
for (Aspect aspect : getAspects())
|
|
||||||
if (aspect != null) {
|
|
||||||
NBTTagCompound f = new NBTTagCompound();
|
|
||||||
f.setString("key", aspect.getTag());
|
|
||||||
f.setInteger("amount", getAmount(aspect));
|
|
||||||
tlist.appendTag(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound nbttagcompound, String label)
|
|
||||||
{
|
|
||||||
NBTTagList tlist = new NBTTagList();
|
|
||||||
nbttagcompound.setTag(label, tlist);
|
|
||||||
for (Aspect aspect : getAspects())
|
|
||||||
if (aspect != null) {
|
|
||||||
NBTTagCompound f = new NBTTagCompound();
|
|
||||||
f.setString("key", aspect.getTag());
|
|
||||||
f.setInteger("amount", getAmount(aspect));
|
|
||||||
tlist.appendTag(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package thaumcraft.api.aspects;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
|
|
||||||
public class AspectSourceHelper {
|
|
||||||
|
|
||||||
static Method drainEssentia;
|
|
||||||
static Method findEssentia;
|
|
||||||
/**
|
|
||||||
* This method is what is used to drain essentia from jars and other sources for things like
|
|
||||||
* infusion crafting or powering the arcane furnace. A record of possible sources are kept track of
|
|
||||||
* and refreshed as needed around the calling tile entity. This also renders the essentia trail particles.
|
|
||||||
* Only 1 essentia is drained at a time
|
|
||||||
* @param tile the tile entity that is draining the essentia
|
|
||||||
* @param aspect the aspect that you are looking for
|
|
||||||
* @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions.
|
|
||||||
* @param range how many blocks you wish to search for essentia sources.
|
|
||||||
* @return boolean returns true if essentia was found and removed from a source.
|
|
||||||
*/
|
|
||||||
public static boolean drainEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
|
|
||||||
try {
|
|
||||||
if(drainEssentia == null) {
|
|
||||||
Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
|
|
||||||
drainEssentia = fake.getMethod("drainEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
|
|
||||||
}
|
|
||||||
return (Boolean) drainEssentia.invoke(null, tile, aspect, direction, range);
|
|
||||||
} catch(Exception ex) {
|
|
||||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method drainEssentia");
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method returns if there is any essentia of the passed type that can be drained. It in no way checks how
|
|
||||||
* much there is, only if an essentia container nearby contains at least 1 point worth.
|
|
||||||
* @param tile the tile entity that is checking the essentia
|
|
||||||
* @param aspect the aspect that you are looking for
|
|
||||||
* @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions.
|
|
||||||
* @param range how many blocks you wish to search for essentia sources.
|
|
||||||
* @return boolean returns true if essentia was found and removed from a source.
|
|
||||||
*/
|
|
||||||
public static boolean findEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
|
|
||||||
try {
|
|
||||||
if(findEssentia == null) {
|
|
||||||
Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
|
|
||||||
findEssentia = fake.getMethod("findEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
|
|
||||||
}
|
|
||||||
return (Boolean) findEssentia.invoke(null, tile, aspect, direction, range);
|
|
||||||
} catch(Exception ex) {
|
|
||||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method findEssentia");
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
package thaumcraft.api.aspects;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author azanor
|
|
||||||
*
|
|
||||||
* Used by blocks like the crucible and alembic to hold their aspects.
|
|
||||||
* Tiles extending this interface will have their aspects show up when viewed by goggles of revealing
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IAspectContainer {
|
|
||||||
public AspectList getAspects();
|
|
||||||
|
|
||||||
|
|
||||||
public void setAspects(AspectList aspects);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is used to determine of a specific aspect can be added to this container.
|
|
||||||
* @param tag
|
|
||||||
* @return true or false
|
|
||||||
*/
|
|
||||||
public boolean doesContainerAccept(Aspect tag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is used to add a certain amount of an aspect to the tile entity.
|
|
||||||
* @param tag
|
|
||||||
* @param amount
|
|
||||||
* @return the amount of aspect left over that could not be added.
|
|
||||||
*/
|
|
||||||
public int addToContainer(Aspect tag, int amount);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes a certain amount of a specific aspect from the tile entity
|
|
||||||
* @param tag
|
|
||||||
* @param amount
|
|
||||||
* @return true if that amount of aspect was available and was removed
|
|
||||||
*/
|
|
||||||
public boolean takeFromContainer(Aspect tag, int amount);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* removes a bunch of different aspects and amounts from the tile entity.
|
|
||||||
* @param ot the ObjectTags object that contains the aspects and their amounts.
|
|
||||||
* @return true if all the aspects and their amounts were available and successfully removed
|
|
||||||
*
|
|
||||||
* Going away in the next major patch
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public boolean takeFromContainer(AspectList ot);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the tile entity contains the listed amount (or more) of the aspect
|
|
||||||
* @param tag
|
|
||||||
* @param amount
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean doesContainerContainAmount(Aspect tag,int amount);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the tile entity contains all the listed aspects and their amounts
|
|
||||||
* @param ot the ObjectTags object that contains the aspects and their amounts.
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* Going away in the next major patch
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public boolean doesContainerContain(AspectList ot);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns how much of the aspect this tile entity contains
|
|
||||||
* @param tag
|
|
||||||
* @return the amount of that aspect found
|
|
||||||
*/
|
|
||||||
public int containerContains(Aspect tag);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package thaumcraft.api.aspects;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* This interface is implemented by tile entites (or possibly anything else) like jars
|
|
||||||
* so that they can act as an essentia source for blocks like the infusion altar.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IAspectSource extends IAspectContainer {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package thaumcraft.api.aspects;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author azanor
|
|
||||||
*
|
|
||||||
* Used by wispy essences and essentia phials to hold their aspects.
|
|
||||||
* Useful for similar item containers that store their aspect information in nbt form so TC
|
|
||||||
* automatically picks up the aspects they contain
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IEssentiaContainerItem {
|
|
||||||
public AspectList getAspects(ItemStack itemstack);
|
|
||||||
public void setAspects(ItemStack itemstack, AspectList aspects);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Example implementation
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public AspectList getAspects(ItemStack itemstack) {
|
|
||||||
if (itemstack.hasTagCompound()) {
|
|
||||||
AspectList aspects = new AspectList();
|
|
||||||
aspects.readFromNBT(itemstack.getTagCompound());
|
|
||||||
return aspects.size()>0?aspects:null;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAspects(ItemStack itemstack, AspectList aspects) {
|
|
||||||
if (!itemstack.hasTagCompound()) itemstack.setTagCompound(new NBTTagCompound());
|
|
||||||
aspects.writeToNBT(itemstack.getTagCompound());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
package thaumcraft.api.aspects;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Azanor
|
|
||||||
* This interface is used by tiles that use or transport vis.
|
|
||||||
* Only tiles that implement this interface will be able to connect to vis conduits or other thaumic devices
|
|
||||||
*/
|
|
||||||
public interface IEssentiaTransport {
|
|
||||||
/**
|
|
||||||
* Is this tile able to connect to other vis users/sources on the specified side?
|
|
||||||
* @param face
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isConnectable(ForgeDirection face);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is this side used to input essentia?
|
|
||||||
* @param face
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean canInputFrom(ForgeDirection face);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is this side used to output essentia?
|
|
||||||
* @param face
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean canOutputTo(ForgeDirection face);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the amount of suction this block will apply
|
|
||||||
* @param suction
|
|
||||||
*/
|
|
||||||
public void setSuction(Aspect aspect, int amount);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the type of suction this block is applying.
|
|
||||||
* @param loc
|
|
||||||
* the location from where the suction is being checked
|
|
||||||
* @return
|
|
||||||
* a return type of null indicates the suction is untyped and the first thing available will be drawn
|
|
||||||
*/
|
|
||||||
public Aspect getSuctionType(ForgeDirection face);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the strength of suction this block is applying.
|
|
||||||
* @param loc
|
|
||||||
* the location from where the suction is being checked
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int getSuctionAmount(ForgeDirection face);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* remove the specified amount of essentia from this transport tile
|
|
||||||
* @return how much was actually taken
|
|
||||||
*/
|
|
||||||
public int takeEssentia(Aspect aspect, int amount, ForgeDirection face);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add the specified amount of essentia to this transport tile
|
|
||||||
* @return how much was actually added
|
|
||||||
*/
|
|
||||||
public int addEssentia(Aspect aspect, int amount, ForgeDirection face);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What type of essentia this contains
|
|
||||||
* @param face
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Aspect getEssentiaType(ForgeDirection face);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How much essentia this block contains
|
|
||||||
* @param face
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int getEssentiaAmount(ForgeDirection face);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Essentia will not be drawn from this container unless the suction exceeds this amount.
|
|
||||||
* @return the amount
|
|
||||||
*/
|
|
||||||
public int getMinimumSuction();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if you want the conduit to extend a little further into the block.
|
|
||||||
* Used by jars and alembics that have smaller than normal hitboxes
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean renderExtendedTube();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
package thaumcraft.api.crafting;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import thaumcraft.api.ThaumcraftApiHelper;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class CrucibleRecipe {
|
|
||||||
|
|
||||||
private ItemStack recipeOutput;
|
|
||||||
|
|
||||||
public Object catalyst;
|
|
||||||
public AspectList aspects;
|
|
||||||
public String key;
|
|
||||||
|
|
||||||
public int hash;
|
|
||||||
|
|
||||||
public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) {
|
|
||||||
recipeOutput = result;
|
|
||||||
this.aspects = tags;
|
|
||||||
this.key = researchKey;
|
|
||||||
this.catalyst = cat;
|
|
||||||
if (cat instanceof String) {
|
|
||||||
this.catalyst = OreDictionary.getOres((String) cat);
|
|
||||||
}
|
|
||||||
String hc = researchKey + result.toString();
|
|
||||||
for (Aspect tag:tags.getAspects()) {
|
|
||||||
hc += tag.getTag()+tags.getAmount(tag);
|
|
||||||
}
|
|
||||||
if (cat instanceof ItemStack) {
|
|
||||||
hc += ((ItemStack)cat).toString();
|
|
||||||
} else
|
|
||||||
if (cat instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
|
|
||||||
for (ItemStack is :(ArrayList<ItemStack>)catalyst) {
|
|
||||||
hc += is.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hash = hc.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean matches(AspectList itags, ItemStack cat) {
|
|
||||||
if (catalyst instanceof ItemStack &&
|
|
||||||
!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
|
|
||||||
return false;
|
|
||||||
} else
|
|
||||||
if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
|
|
||||||
ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
|
|
||||||
if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
|
|
||||||
}
|
|
||||||
if (itags==null) return false;
|
|
||||||
for (Aspect tag:aspects.getAspects()) {
|
|
||||||
if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean catalystMatches(ItemStack cat) {
|
|
||||||
if (catalyst instanceof ItemStack && ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
|
|
||||||
return true;
|
|
||||||
} else
|
|
||||||
if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
|
|
||||||
ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
|
|
||||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspectList removeMatching(AspectList itags) {
|
|
||||||
AspectList temptags = new AspectList();
|
|
||||||
temptags.aspects.putAll(itags.aspects);
|
|
||||||
|
|
||||||
for (Aspect tag:aspects.getAspects()) {
|
|
||||||
temptags.remove(tag, aspects.getAmount(tag));
|
|
||||||
}
|
|
||||||
|
|
||||||
itags = temptags;
|
|
||||||
return itags;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getRecipeOutput() {
|
|
||||||
return recipeOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package thaumcraft.api.crafting;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public interface IArcaneRecipe
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to check if a recipe matches current crafting inventory
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
boolean matches(IInventory var1, World world, EntityPlayer player);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an Item that is the result of this recipe
|
|
||||||
*/
|
|
||||||
ItemStack getCraftingResult(IInventory var1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the size of the recipe area
|
|
||||||
*/
|
|
||||||
int getRecipeSize();
|
|
||||||
|
|
||||||
ItemStack getRecipeOutput();
|
|
||||||
AspectList getAspects();
|
|
||||||
AspectList getAspects(IInventory var1);
|
|
||||||
String getResearch();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package thaumcraft.api.crafting;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* Blocks that implement this interface act as infusion crafting stabilisers like candles and skulls
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IInfusionStabiliser {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns true if the block can stabilise things
|
|
||||||
*/
|
|
||||||
public boolean canStabaliseInfusion(World world, int x, int y, int z);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
package thaumcraft.api.crafting;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import thaumcraft.api.ThaumcraftApiHelper;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class InfusionEnchantmentRecipe
|
|
||||||
{
|
|
||||||
|
|
||||||
public AspectList aspects;
|
|
||||||
public String research;
|
|
||||||
public ItemStack[] components;
|
|
||||||
public Enchantment enchantment;
|
|
||||||
public int recipeXP;
|
|
||||||
public int instability;
|
|
||||||
|
|
||||||
public InfusionEnchantmentRecipe(String research, Enchantment input, int inst,
|
|
||||||
AspectList aspects2, ItemStack[] recipe) {
|
|
||||||
this.research = research;
|
|
||||||
this.enchantment = input;
|
|
||||||
this.aspects = aspects2;
|
|
||||||
this.components = recipe;
|
|
||||||
this.instability = inst;
|
|
||||||
this.recipeXP = Math.max(1, input.getMinEnchantability(1)/3);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to check if a recipe matches current crafting inventory
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) {
|
|
||||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!enchantment.canApply(central) || !central.getItem().isItemTool(central)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map map1 = EnchantmentHelper.getEnchantments(central);
|
|
||||||
Iterator iterator = map1.keySet().iterator();
|
|
||||||
while (iterator.hasNext())
|
|
||||||
{
|
|
||||||
int j1 = ((Integer)iterator.next()).intValue();
|
|
||||||
Enchantment ench = Enchantment.enchantmentsList[j1];
|
|
||||||
if (j1 == enchantment.effectId &&
|
|
||||||
EnchantmentHelper.getEnchantmentLevel(j1, central)>=ench.getMaxLevel())
|
|
||||||
return false;
|
|
||||||
if (enchantment.effectId != ench.effectId &&
|
|
||||||
(!enchantment.canApplyTogether(ench) ||
|
|
||||||
!ench.canApplyTogether(enchantment))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack i2 = null;
|
|
||||||
|
|
||||||
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
|
|
||||||
for (ItemStack is:input) {
|
|
||||||
ii.add(is.copy());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ItemStack comp:components) {
|
|
||||||
boolean b=false;
|
|
||||||
for (int a=0;a<ii.size();a++) {
|
|
||||||
i2 = ii.get(a).copy();
|
|
||||||
if (comp.getItemDamage()==OreDictionary.WILDCARD_VALUE) {
|
|
||||||
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
|
|
||||||
}
|
|
||||||
if (areItemStacksEqual(i2, comp,true)) {
|
|
||||||
ii.remove(a);
|
|
||||||
b=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!b) return false;
|
|
||||||
}
|
|
||||||
// System.out.println(ii.size());
|
|
||||||
return ii.size()==0?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
|
|
||||||
{
|
|
||||||
if (stack0==null && stack1!=null) return false;
|
|
||||||
if (stack0!=null && stack1==null) return false;
|
|
||||||
if (stack0==null && stack1==null) return true;
|
|
||||||
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
|
|
||||||
if (!t1) return false;
|
|
||||||
if (fuzzy) {
|
|
||||||
Integer od = OreDictionary.getOreID(stack0);
|
|
||||||
if (od!=-1) {
|
|
||||||
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
|
|
||||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.stackSize <= stack0.getMaxStackSize() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Enchantment getEnchantment() {
|
|
||||||
return enchantment;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspectList getAspects() {
|
|
||||||
return aspects;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResearch() {
|
|
||||||
return research;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int calcInstability(ItemStack recipeInput) {
|
|
||||||
int i = 0;
|
|
||||||
Map map1 = EnchantmentHelper.getEnchantments(recipeInput);
|
|
||||||
Iterator iterator = map1.keySet().iterator();
|
|
||||||
while (iterator.hasNext())
|
|
||||||
{
|
|
||||||
int j1 = ((Integer)iterator.next()).intValue();
|
|
||||||
i += EnchantmentHelper.getEnchantmentLevel(j1, recipeInput);
|
|
||||||
}
|
|
||||||
return (i/2) + instability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int calcXP(ItemStack recipeInput) {
|
|
||||||
return recipeXP * (1+EnchantmentHelper.getEnchantmentLevel(enchantment.effectId, recipeInput));
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getEssentiaMod(ItemStack recipeInput) {
|
|
||||||
float mod = EnchantmentHelper.getEnchantmentLevel(enchantment.effectId, recipeInput);
|
|
||||||
Map map1 = EnchantmentHelper.getEnchantments(recipeInput);
|
|
||||||
Iterator iterator = map1.keySet().iterator();
|
|
||||||
while (iterator.hasNext())
|
|
||||||
{
|
|
||||||
int j1 = ((Integer)iterator.next()).intValue();
|
|
||||||
if (j1 != enchantment.effectId)
|
|
||||||
mod += EnchantmentHelper.getEnchantmentLevel(j1, recipeInput) * .1f;
|
|
||||||
}
|
|
||||||
return mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
package thaumcraft.api.crafting;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import thaumcraft.api.ThaumcraftApiHelper;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class InfusionRecipe
|
|
||||||
{
|
|
||||||
protected AspectList aspects;
|
|
||||||
protected String research;
|
|
||||||
private ItemStack[] components;
|
|
||||||
private ItemStack recipeInput;
|
|
||||||
protected Object recipeOutput;
|
|
||||||
protected int instability;
|
|
||||||
|
|
||||||
public InfusionRecipe(String research, Object output, int inst,
|
|
||||||
AspectList aspects2, ItemStack input, ItemStack[] recipe) {
|
|
||||||
this.research = research;
|
|
||||||
this.recipeOutput = output;
|
|
||||||
this.recipeInput = input;
|
|
||||||
this.aspects = aspects2;
|
|
||||||
this.components = recipe;
|
|
||||||
this.instability = inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to check if a recipe matches current crafting inventory
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) {
|
|
||||||
if (getRecipeInput()==null) return false;
|
|
||||||
|
|
||||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack i2 = central.copy();
|
|
||||||
if (getRecipeInput().getItemDamage()==OreDictionary.WILDCARD_VALUE) {
|
|
||||||
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!areItemStacksEqual(i2, getRecipeInput(), true)) return false;
|
|
||||||
|
|
||||||
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
|
|
||||||
for (ItemStack is:input) {
|
|
||||||
ii.add(is.copy());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ItemStack comp:getComponents()) {
|
|
||||||
boolean b=false;
|
|
||||||
for (int a=0;a<ii.size();a++) {
|
|
||||||
i2 = ii.get(a).copy();
|
|
||||||
if (comp.getItemDamage()==OreDictionary.WILDCARD_VALUE) {
|
|
||||||
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
|
|
||||||
}
|
|
||||||
if (areItemStacksEqual(i2, comp,true)) {
|
|
||||||
ii.remove(a);
|
|
||||||
b=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!b) return false;
|
|
||||||
}
|
|
||||||
return ii.size()==0?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
|
|
||||||
{
|
|
||||||
if (stack0==null && stack1!=null) return false;
|
|
||||||
if (stack0!=null && stack1==null) return false;
|
|
||||||
if (stack0==null && stack1==null) return true;
|
|
||||||
|
|
||||||
//nbt
|
|
||||||
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
|
|
||||||
if (!t1) return false;
|
|
||||||
|
|
||||||
if (fuzzy) {
|
|
||||||
Integer od = OreDictionary.getOreID(stack0);
|
|
||||||
if (od!=-1) {
|
|
||||||
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
|
|
||||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//damage
|
|
||||||
boolean damage = stack0.getItemDamage() == stack1.getItemDamage() ||
|
|
||||||
stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE;
|
|
||||||
|
|
||||||
return stack0.getItem() != stack1.getItem() ? false : (!damage ? false : stack0.stackSize <= stack0.getMaxStackSize() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getRecipeOutput() {
|
|
||||||
return getRecipeOutput(this.getRecipeInput());
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspectList getAspects() {
|
|
||||||
return getAspects(this.getRecipeInput());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInstability() {
|
|
||||||
return getInstability(this.getRecipeInput());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResearch() {
|
|
||||||
return research;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getRecipeInput() {
|
|
||||||
return recipeInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack[] getComponents() {
|
|
||||||
return components;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getRecipeOutput(ItemStack input) {
|
|
||||||
return recipeOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AspectList getAspects(ItemStack input) {
|
|
||||||
return aspects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInstability(ItemStack input) {
|
|
||||||
return instability;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,261 +0,0 @@
|
|||||||
package thaumcraft.api.crafting;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import thaumcraft.api.ThaumcraftApiHelper;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class ShapedArcaneRecipe implements IArcaneRecipe
|
|
||||||
{
|
|
||||||
//Added in for future ease of change, but hard coded for now.
|
|
||||||
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
|
||||||
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
|
||||||
|
|
||||||
public ItemStack output = null;
|
|
||||||
public Object[] input = null;
|
|
||||||
public AspectList aspects = null;
|
|
||||||
public String research;
|
|
||||||
public int width = 0;
|
|
||||||
public int height = 0;
|
|
||||||
private boolean mirrored = true;
|
|
||||||
|
|
||||||
public ShapedArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe){ this(research, new ItemStack(result), aspects, recipe); }
|
|
||||||
public ShapedArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe){ this(research, new ItemStack(result), aspects, recipe); }
|
|
||||||
public ShapedArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
|
||||||
{
|
|
||||||
output = result.copy();
|
|
||||||
this.research = research;
|
|
||||||
this.aspects = aspects;
|
|
||||||
String shape = "";
|
|
||||||
|
|
||||||
int idx = 0;
|
|
||||||
|
|
||||||
if (recipe[idx] instanceof Boolean)
|
|
||||||
{
|
|
||||||
mirrored = (Boolean)recipe[idx];
|
|
||||||
if (recipe[idx+1] instanceof Object[])
|
|
||||||
{
|
|
||||||
recipe = (Object[])recipe[idx+1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
idx = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (recipe[idx] instanceof String[])
|
|
||||||
{
|
|
||||||
String[] parts = ((String[])recipe[idx++]);
|
|
||||||
|
|
||||||
for (String s : parts)
|
|
||||||
{
|
|
||||||
width = s.length();
|
|
||||||
shape += s;
|
|
||||||
}
|
|
||||||
|
|
||||||
height = parts.length;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (recipe[idx] instanceof String)
|
|
||||||
{
|
|
||||||
String s = (String)recipe[idx++];
|
|
||||||
shape += s;
|
|
||||||
width = s.length();
|
|
||||||
height++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (width * height != shape.length())
|
|
||||||
{
|
|
||||||
String ret = "Invalid shaped ore recipe: ";
|
|
||||||
for (Object tmp : recipe)
|
|
||||||
{
|
|
||||||
ret += tmp + ", ";
|
|
||||||
}
|
|
||||||
ret += output;
|
|
||||||
throw new RuntimeException(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
|
||||||
|
|
||||||
for (; idx < recipe.length; idx += 2)
|
|
||||||
{
|
|
||||||
Character chr = (Character)recipe[idx];
|
|
||||||
Object in = recipe[idx + 1];
|
|
||||||
|
|
||||||
if (in instanceof ItemStack)
|
|
||||||
{
|
|
||||||
itemMap.put(chr, ((ItemStack)in).copy());
|
|
||||||
}
|
|
||||||
else if (in instanceof Item)
|
|
||||||
{
|
|
||||||
itemMap.put(chr, new ItemStack((Item)in));
|
|
||||||
}
|
|
||||||
else if (in instanceof Block)
|
|
||||||
{
|
|
||||||
itemMap.put(chr, new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE));
|
|
||||||
}
|
|
||||||
else if (in instanceof String)
|
|
||||||
{
|
|
||||||
itemMap.put(chr, OreDictionary.getOres((String)in));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
String ret = "Invalid shaped ore recipe: ";
|
|
||||||
for (Object tmp : recipe)
|
|
||||||
{
|
|
||||||
ret += tmp + ", ";
|
|
||||||
}
|
|
||||||
ret += output;
|
|
||||||
throw new RuntimeException(ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
input = new Object[width * height];
|
|
||||||
int x = 0;
|
|
||||||
for (char chr : shape.toCharArray())
|
|
||||||
{
|
|
||||||
input[x++] = itemMap.get(chr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getCraftingResult(IInventory var1){ return output.copy(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRecipeSize(){ return input.length; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRecipeOutput(){ return output; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches(IInventory inv, World world, EntityPlayer player)
|
|
||||||
{
|
|
||||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
|
|
||||||
{
|
|
||||||
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
|
|
||||||
{
|
|
||||||
if (checkMatch(inv, x, y, false))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mirrored && checkMatch(inv, x, y, true))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
|
|
||||||
{
|
|
||||||
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
|
|
||||||
{
|
|
||||||
int subX = x - startX;
|
|
||||||
int subY = y - startY;
|
|
||||||
Object target = null;
|
|
||||||
|
|
||||||
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
|
|
||||||
{
|
|
||||||
if (mirror)
|
|
||||||
{
|
|
||||||
target = input[width - subX - 1 + subY * width];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
target = input[subX + subY * width];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
|
|
||||||
|
|
||||||
if (target instanceof ItemStack)
|
|
||||||
{
|
|
||||||
if (!checkItemEquals((ItemStack)target, slot))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (target instanceof ArrayList)
|
|
||||||
{
|
|
||||||
boolean matched = false;
|
|
||||||
|
|
||||||
for (ItemStack item : (ArrayList<ItemStack>)target)
|
|
||||||
{
|
|
||||||
matched = matched || checkItemEquals(item, slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!matched)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (target == null && slot != null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkItemEquals(ItemStack target, ItemStack input)
|
|
||||||
{
|
|
||||||
if (input == null && target != null || input != null && target == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (target.getItem() == input.getItem() &&
|
|
||||||
(!target.hasTagCompound() || ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(input,target)) &&
|
|
||||||
(target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShapedArcaneRecipe setMirrored(boolean mirror)
|
|
||||||
{
|
|
||||||
mirrored = mirror;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the input for this recipe, any mod accessing this value should never
|
|
||||||
* manipulate the values in this array as it will effect the recipe itself.
|
|
||||||
* @return The recipes input vales.
|
|
||||||
*/
|
|
||||||
public Object[] getInput()
|
|
||||||
{
|
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList getAspects() {
|
|
||||||
return aspects;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList getAspects(IInventory inv) {
|
|
||||||
return aspects;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getResearch() {
|
|
||||||
return research;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
package thaumcraft.api.crafting;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import thaumcraft.api.ThaumcraftApiHelper;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class ShapelessArcaneRecipe implements IArcaneRecipe
|
|
||||||
{
|
|
||||||
private ItemStack output = null;
|
|
||||||
private ArrayList input = new ArrayList();
|
|
||||||
|
|
||||||
public AspectList aspects = null;
|
|
||||||
public String research;
|
|
||||||
|
|
||||||
public ShapelessArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe){ this(research,new ItemStack(result),aspects, recipe); }
|
|
||||||
public ShapelessArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe){ this(research,new ItemStack(result),aspects, recipe); }
|
|
||||||
|
|
||||||
public ShapelessArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
|
||||||
{
|
|
||||||
output = result.copy();
|
|
||||||
this.research = research;
|
|
||||||
this.aspects = aspects;
|
|
||||||
for (Object in : recipe)
|
|
||||||
{
|
|
||||||
if (in instanceof ItemStack)
|
|
||||||
{
|
|
||||||
input.add(((ItemStack)in).copy());
|
|
||||||
}
|
|
||||||
else if (in instanceof Item)
|
|
||||||
{
|
|
||||||
input.add(new ItemStack((Item)in));
|
|
||||||
}
|
|
||||||
else if (in instanceof Block)
|
|
||||||
{
|
|
||||||
input.add(new ItemStack((Block)in));
|
|
||||||
}
|
|
||||||
else if (in instanceof String)
|
|
||||||
{
|
|
||||||
input.add(OreDictionary.getOres((String)in));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
String ret = "Invalid shapeless ore recipe: ";
|
|
||||||
for (Object tmp : recipe)
|
|
||||||
{
|
|
||||||
ret += tmp + ", ";
|
|
||||||
}
|
|
||||||
ret += output;
|
|
||||||
throw new RuntimeException(ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRecipeSize(){ return input.size(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRecipeOutput(){ return output; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getCraftingResult(IInventory var1){ return output.copy(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches(IInventory var1, World world, EntityPlayer player)
|
|
||||||
{
|
|
||||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList required = new ArrayList(input);
|
|
||||||
|
|
||||||
for (int x = 0; x < 9; x++)
|
|
||||||
{
|
|
||||||
ItemStack slot = var1.getStackInSlot(x);
|
|
||||||
|
|
||||||
if (slot != null)
|
|
||||||
{
|
|
||||||
boolean inRecipe = false;
|
|
||||||
Iterator req = required.iterator();
|
|
||||||
|
|
||||||
while (req.hasNext())
|
|
||||||
{
|
|
||||||
boolean match = false;
|
|
||||||
|
|
||||||
Object next = req.next();
|
|
||||||
|
|
||||||
if (next instanceof ItemStack)
|
|
||||||
{
|
|
||||||
match = checkItemEquals((ItemStack)next, slot);
|
|
||||||
}
|
|
||||||
else if (next instanceof ArrayList)
|
|
||||||
{
|
|
||||||
for (ItemStack item : (ArrayList<ItemStack>)next)
|
|
||||||
{
|
|
||||||
match = match || checkItemEquals(item, slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match)
|
|
||||||
{
|
|
||||||
inRecipe = true;
|
|
||||||
required.remove(next);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inRecipe)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return required.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkItemEquals(ItemStack target, ItemStack input)
|
|
||||||
{
|
|
||||||
if (input == null && target != null || input != null && target == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (target.getItem() == input.getItem() &&
|
|
||||||
(!target.hasTagCompound() || ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(input,target)) &&
|
|
||||||
(target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the input for this recipe, any mod accessing this value should never
|
|
||||||
* manipulate the values in this array as it will effect the recipe itself.
|
|
||||||
* @return The recipes input vales.
|
|
||||||
*/
|
|
||||||
public ArrayList getInput()
|
|
||||||
{
|
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList getAspects() {
|
|
||||||
return aspects;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList getAspects(IInventory inv) {
|
|
||||||
return aspects;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getResearch() {
|
|
||||||
return research;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package thaumcraft.api.damagesource;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.util.DamageSource;
|
|
||||||
import net.minecraft.util.EntityDamageSourceIndirect;
|
|
||||||
|
|
||||||
public class DamageSourceIndirectThaumcraftEntity extends EntityDamageSourceIndirect {
|
|
||||||
|
|
||||||
private boolean fireDamage;
|
|
||||||
private float hungerDamage;
|
|
||||||
private boolean isUnblockable;
|
|
||||||
|
|
||||||
|
|
||||||
public DamageSourceIndirectThaumcraftEntity(String par1Str,
|
|
||||||
Entity par2Entity, Entity par3Entity) {
|
|
||||||
super(par1Str, par2Entity, par3Entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DamageSource setFireDamage()
|
|
||||||
{
|
|
||||||
this.fireDamage = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DamageSource setDamageBypassesArmor()
|
|
||||||
{
|
|
||||||
this.isUnblockable = true;
|
|
||||||
this.hungerDamage = 0.0F;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
package thaumcraft.api.damagesource;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.util.DamageSource;
|
|
||||||
import net.minecraft.util.EntityDamageSource;
|
|
||||||
|
|
||||||
public class DamageSourceThaumcraft extends DamageSource
|
|
||||||
{
|
|
||||||
|
|
||||||
public static DamageSource taint = new DamageSourceThaumcraft("taint").setDamageBypassesArmor().setMagicDamage();
|
|
||||||
public static DamageSource tentacle = new DamageSourceThaumcraft("tentacle");
|
|
||||||
public static DamageSource swarm = new DamageSourceThaumcraft("swarm");
|
|
||||||
public static DamageSource dissolve = new DamageSourceThaumcraft("dissolve").setDamageBypassesArmor();
|
|
||||||
|
|
||||||
protected DamageSourceThaumcraft(String par1Str) {
|
|
||||||
super(par1Str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This kind of damage can be blocked or not. */
|
|
||||||
private boolean isUnblockable = false;
|
|
||||||
private boolean isDamageAllowedInCreativeMode = false;
|
|
||||||
private float hungerDamage = 0.3F;
|
|
||||||
|
|
||||||
/** This kind of damage is based on fire or not. */
|
|
||||||
private boolean fireDamage;
|
|
||||||
|
|
||||||
/** This kind of damage is based on a projectile or not. */
|
|
||||||
private boolean projectile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether this damage source will have its damage amount scaled based on the current difficulty.
|
|
||||||
*/
|
|
||||||
private boolean difficultyScaled;
|
|
||||||
private boolean magicDamage = false;
|
|
||||||
private boolean explosion = false;
|
|
||||||
|
|
||||||
public static DamageSource causeSwarmDamage(EntityLivingBase par0EntityLiving)
|
|
||||||
{
|
|
||||||
return new EntityDamageSource("swarm", par0EntityLiving);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DamageSource causeTentacleDamage(EntityLivingBase par0EntityLiving)
|
|
||||||
{
|
|
||||||
return new EntityDamageSource("tentacle", par0EntityLiving);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package thaumcraft.api.entities;
|
|
||||||
|
|
||||||
public interface IEldritchMob {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package thaumcraft.api.entities;
|
|
||||||
|
|
||||||
public interface ITaintedMob {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
package thaumcraft.api.internal;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class DummyInternalMethodHandler implements IInternalMethodHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void generateVisEffect(int dim, int x, int y, int z, int x2, int y2, int z2, int color) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isResearchComplete(String username, String researchkey) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasDiscoveredAspect(String username, Aspect aspect) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList getDiscoveredAspects(String username) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInRowAndColumn(Object instance, int row, int column) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList getObjectAspects(ItemStack is) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList getBonusObjectTags(ItemStack is, AspectList ot) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList generateTags(Item item, int meta) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumeVisFromWand(ItemStack wand, EntityPlayer player,
|
|
||||||
AspectList cost, boolean doit, boolean crafting) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumeVisFromWandCrafting(ItemStack wand,
|
|
||||||
EntityPlayer player, AspectList cost, boolean doit) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumeVisFromInventory(EntityPlayer player, AspectList cost) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addWarpToPlayer(EntityPlayer player, int amount, boolean temporary) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addStickyWarpToPlayer(EntityPlayer player, int amount) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package thaumcraft.api.internal;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public interface IInternalMethodHandler {
|
|
||||||
|
|
||||||
public void generateVisEffect(int dim, int x, int y, int z, int x2, int y2, int z2, int color);
|
|
||||||
public boolean isResearchComplete(String username, String researchkey);
|
|
||||||
public ItemStack getStackInRowAndColumn(Object instance, int row, int column);
|
|
||||||
public AspectList getObjectAspects(ItemStack is);
|
|
||||||
public AspectList getBonusObjectTags(ItemStack is,AspectList ot);
|
|
||||||
public AspectList generateTags(Item item, int meta);
|
|
||||||
public boolean consumeVisFromWand(ItemStack wand, EntityPlayer player, AspectList cost, boolean doit, boolean crafting);
|
|
||||||
public boolean consumeVisFromWandCrafting(ItemStack wand,EntityPlayer player, AspectList cost, boolean doit);
|
|
||||||
public boolean consumeVisFromInventory(EntityPlayer player, AspectList cost);
|
|
||||||
public void addWarpToPlayer(EntityPlayer player, int amount,boolean temporary);
|
|
||||||
public void addStickyWarpToPlayer(EntityPlayer player, int amount);
|
|
||||||
public boolean hasDiscoveredAspect(String username, Aspect aspect);
|
|
||||||
public AspectList getDiscoveredAspects(String username);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package thaumcraft.api.internal;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.WeightedRandom;
|
|
||||||
|
|
||||||
|
|
||||||
public class WeightedRandomLoot extends WeightedRandom.Item {
|
|
||||||
|
|
||||||
/** The Item/Block ID to generate in the bag. */
|
|
||||||
public ItemStack item;
|
|
||||||
|
|
||||||
public WeightedRandomLoot(ItemStack stack, int weight)
|
|
||||||
{
|
|
||||||
super(weight);
|
|
||||||
this.item = stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<WeightedRandomLoot> lootBagCommon = new ArrayList<WeightedRandomLoot>();
|
|
||||||
public static ArrayList<WeightedRandomLoot> lootBagUncommon = new ArrayList<WeightedRandomLoot>();
|
|
||||||
public static ArrayList<WeightedRandomLoot> lootBagRare = new ArrayList<WeightedRandomLoot>();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
package thaumcraft.api.nodes;
|
|
||||||
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
import thaumcraft.api.aspects.IAspectContainer;
|
|
||||||
|
|
||||||
public interface INode extends IAspectContainer {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unique identifier to distinguish nodes. Normal node id's are based on world id and coordinates
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getId();
|
|
||||||
|
|
||||||
public AspectList getAspectsBase();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the type of node
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public NodeType getNodeType();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the type of node
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public void setNodeType(NodeType nodeType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the node modifier
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public void setNodeModifier(NodeModifier nodeModifier);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the node modifier
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public NodeModifier getNodeModifier();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the maximum capacity of each aspect the node can hold
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int getNodeVisBase(Aspect aspect);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the maximum capacity of each aspect the node can hold
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public void setNodeVisBase(Aspect aspect, short nodeVisBase);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package thaumcraft.api.nodes;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* Equipped head slot items that extend this class will make nodes visible in world.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface IRevealer {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If this method returns true the nodes will be visible.
|
|
||||||
*/
|
|
||||||
public boolean showNodes(ItemStack itemstack, EntityLivingBase player);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package thaumcraft.api.nodes;
|
|
||||||
|
|
||||||
public enum NodeModifier
|
|
||||||
{
|
|
||||||
BRIGHT, PALE, FADING
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package thaumcraft.api.nodes;
|
|
||||||
|
|
||||||
public enum NodeType
|
|
||||||
{
|
|
||||||
NORMAL, UNSTABLE, DARK, TAINTED, HUNGRY, PURE
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
@API(owner = "Thaumcraft", apiVersion = "4.2.0.0", provides = "Thaumcraft|API")
|
|
||||||
package thaumcraft.api;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package thaumcraft.api.potions;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.potion.Potion;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import thaumcraft.api.damagesource.DamageSourceThaumcraft;
|
|
||||||
import thaumcraft.api.entities.ITaintedMob;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class PotionFluxTaint extends Potion
|
|
||||||
{
|
|
||||||
public static PotionFluxTaint instance = null; // will be instantiated at runtime
|
|
||||||
private int statusIconIndex = -1;
|
|
||||||
|
|
||||||
public PotionFluxTaint(int par1, boolean par2, int par3)
|
|
||||||
{
|
|
||||||
super(par1,par2,par3);
|
|
||||||
setIconIndex(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init()
|
|
||||||
{
|
|
||||||
instance.setPotionName("potion.fluxtaint");
|
|
||||||
instance.setIconIndex(3, 1);
|
|
||||||
instance.setEffectiveness(0.25D);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBadEffect() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getStatusIconIndex() {
|
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(rl);
|
|
||||||
return super.getStatusIconIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
static final ResourceLocation rl = new ResourceLocation("thaumcraft","textures/misc/potions.png");
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void performEffect(EntityLivingBase target, int par2) {
|
|
||||||
if (target instanceof ITaintedMob) {
|
|
||||||
target.heal(1);
|
|
||||||
} else
|
|
||||||
if (!target.isEntityUndead() && !(target instanceof EntityPlayer))
|
|
||||||
{
|
|
||||||
target.attackEntityFrom(DamageSourceThaumcraft.taint, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (!target.isEntityUndead() && (target.getMaxHealth() > 1 || (target instanceof EntityPlayer)))
|
|
||||||
{
|
|
||||||
target.attackEntityFrom(DamageSourceThaumcraft.taint, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isReady(int par1, int par2)
|
|
||||||
{
|
|
||||||
int k = 40 >> par2;
|
|
||||||
return k > 0 ? par1 % k == 0 : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package thaumcraft.api.potions;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.potion.Potion;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class PotionVisExhaust extends Potion
|
|
||||||
{
|
|
||||||
public static PotionVisExhaust instance = null; // will be instantiated at runtime
|
|
||||||
private int statusIconIndex = -1;
|
|
||||||
|
|
||||||
public PotionVisExhaust(int par1, boolean par2, int par3)
|
|
||||||
{
|
|
||||||
super(par1,par2,par3);
|
|
||||||
setIconIndex(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init()
|
|
||||||
{
|
|
||||||
instance.setPotionName("potion.visexhaust");
|
|
||||||
instance.setIconIndex(5, 1);
|
|
||||||
instance.setEffectiveness(0.25D);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBadEffect() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getStatusIconIndex() {
|
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(rl);
|
|
||||||
return super.getStatusIconIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
static final ResourceLocation rl = new ResourceLocation("thaumcraft","textures/misc/potions.png");
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void performEffect(EntityLivingBase target, int par2) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package thaumcraft.api.research;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IScanEventHandler {
|
|
||||||
ScanResult scanPhenomena(ItemStack stack, World world, EntityPlayer player);
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
package thaumcraft.api.research;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
|
|
||||||
public class ResearchCategories {
|
|
||||||
|
|
||||||
//Research
|
|
||||||
public static LinkedHashMap <String, ResearchCategoryList> researchCategories = new LinkedHashMap <String,ResearchCategoryList>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param key
|
|
||||||
* @return the research item linked to this key
|
|
||||||
*/
|
|
||||||
public static ResearchCategoryList getResearchList(String key) {
|
|
||||||
return researchCategories.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param key
|
|
||||||
* @return the name of the research category linked to this key.
|
|
||||||
* Must be stored as localization information in the LanguageRegistry.
|
|
||||||
*/
|
|
||||||
public static String getCategoryName(String key) {
|
|
||||||
return StatCollector.translateToLocal("tc.research_category."+key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param key the research key
|
|
||||||
* @return the ResearchItem object.
|
|
||||||
*/
|
|
||||||
public static ResearchItem getResearch(String key) {
|
|
||||||
Collection rc = researchCategories.values();
|
|
||||||
for (Object cat:rc) {
|
|
||||||
Collection rl = ((ResearchCategoryList)cat).research.values();
|
|
||||||
for (Object ri:rl) {
|
|
||||||
if ((((ResearchItem)ri).key).equals(key)) return (ResearchItem)ri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This should only be done at the PostInit stage
|
|
||||||
* @param key the key used for this category
|
|
||||||
* @param icon the icon to be used for the research category tab
|
|
||||||
* @param background the resource location of the background image to use for this category
|
|
||||||
* @return the name of the research linked to this key
|
|
||||||
*/
|
|
||||||
public static void registerCategory(String key, ResourceLocation icon, ResourceLocation background) {
|
|
||||||
if (getResearchList(key)==null) {
|
|
||||||
ResearchCategoryList rl = new ResearchCategoryList(icon, background);
|
|
||||||
researchCategories.put(key, rl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addResearch(ResearchItem ri) {
|
|
||||||
ResearchCategoryList rl = getResearchList(ri.category);
|
|
||||||
if (rl!=null && !rl.research.containsKey(ri.key)) {
|
|
||||||
|
|
||||||
if (!ri.isVirtual()) {
|
|
||||||
for (ResearchItem rr:rl.research.values()) {
|
|
||||||
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
|
|
||||||
FMLLog.log(Level.FATAL, "[Thaumcraft] Research ["+ri.getName()+"] not added as it overlaps with existing research ["+rr.getName()+"]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
rl.research.put(ri.key, ri);
|
|
||||||
|
|
||||||
if (ri.displayColumn < rl.minDisplayColumn)
|
|
||||||
{
|
|
||||||
rl.minDisplayColumn = ri.displayColumn;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ri.displayRow < rl.minDisplayRow)
|
|
||||||
{
|
|
||||||
rl.minDisplayRow = ri.displayRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ri.displayColumn > rl.maxDisplayColumn)
|
|
||||||
{
|
|
||||||
rl.maxDisplayColumn = ri.displayColumn;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ri.displayRow > rl.maxDisplayRow)
|
|
||||||
{
|
|
||||||
rl.maxDisplayRow = ri.displayRow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package thaumcraft.api.research;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class ResearchCategoryList {
|
|
||||||
|
|
||||||
/** Is the smallest column used on the GUI. */
|
|
||||||
public int minDisplayColumn;
|
|
||||||
|
|
||||||
/** Is the smallest row used on the GUI. */
|
|
||||||
public int minDisplayRow;
|
|
||||||
|
|
||||||
/** Is the biggest column used on the GUI. */
|
|
||||||
public int maxDisplayColumn;
|
|
||||||
|
|
||||||
/** Is the biggest row used on the GUI. */
|
|
||||||
public int maxDisplayRow;
|
|
||||||
|
|
||||||
/** display variables **/
|
|
||||||
public ResourceLocation icon;
|
|
||||||
public ResourceLocation background;
|
|
||||||
|
|
||||||
public ResearchCategoryList(ResourceLocation icon, ResourceLocation background) {
|
|
||||||
this.icon = icon;
|
|
||||||
this.background = background;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Research
|
|
||||||
public Map<String, ResearchItem> research = new HashMap<String,ResearchItem>();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,369 +0,0 @@
|
|||||||
package thaumcraft.api.research;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class ResearchItem
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A short string used as a key for this research. Must be unique
|
|
||||||
*/
|
|
||||||
public final String key;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A short string used as a reference to the research category to which this must be added.
|
|
||||||
*/
|
|
||||||
public final String category;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The aspect tags and their values required to complete this research
|
|
||||||
*/
|
|
||||||
public final AspectList tags;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This links to any research that needs to be completed before this research can be discovered or learnt.
|
|
||||||
*/
|
|
||||||
public String[] parents = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like parent above, but a line will not be displayed in the thaumonomicon linking them. Just used to prevent clutter.
|
|
||||||
*/
|
|
||||||
public String[] parentsHidden = null;
|
|
||||||
/**
|
|
||||||
* any research linked to this that will be unlocked automatically when this research is complete
|
|
||||||
*/
|
|
||||||
public String[] siblings = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the horizontal position of the research icon
|
|
||||||
*/
|
|
||||||
public final int displayColumn;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the vertical position of the research icon
|
|
||||||
*/
|
|
||||||
public final int displayRow;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the icon to be used for this research
|
|
||||||
*/
|
|
||||||
public final ItemStack icon_item;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the icon to be used for this research
|
|
||||||
*/
|
|
||||||
public final ResourceLocation icon_resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How large the research grid is. Valid values are 1 to 3.
|
|
||||||
*/
|
|
||||||
private int complexity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Special research has a spiky border. Used for important research milestones.
|
|
||||||
*/
|
|
||||||
private boolean isSpecial;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Research that can be directly purchased with RP in normal research difficulty.
|
|
||||||
*/
|
|
||||||
private boolean isSecondary;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This indicates if the research should use a circular icon border. Usually used for "passive" research
|
|
||||||
* that doesn't have recipes and grants passive effects, or that unlock automatically.
|
|
||||||
*/
|
|
||||||
private boolean isRound;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stub research cannot be discovered by normal means, but can be unlocked via the sibling system.
|
|
||||||
*/
|
|
||||||
private boolean isStub;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This indicated that the research is completely hidden and cannot be discovered by any
|
|
||||||
* player-controlled means. The recipes will never show up in the thaumonomicon.
|
|
||||||
* Usually used to unlock "hidden" recipes via sibling unlocking, like
|
|
||||||
* the various cap and rod combos for wands.
|
|
||||||
*/
|
|
||||||
private boolean isVirtual;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Concealed research does not display in the thaumonomicon until parent researches are discovered.
|
|
||||||
*/
|
|
||||||
private boolean isConcealed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hidden research can only be discovered via scanning or knowledge fragments
|
|
||||||
*/
|
|
||||||
private boolean isHidden;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the same as isHidden, except it cannot be discovered with knowledge fragments, only scanning.
|
|
||||||
*/
|
|
||||||
private boolean isLost;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* These research items will automatically unlock for all players on game start
|
|
||||||
*/
|
|
||||||
private boolean isAutoUnlock;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scanning these items will have a chance of revealing hidden knowledge in the thaumonomicon
|
|
||||||
*/
|
|
||||||
private ItemStack[] itemTriggers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scanning these entities will have a chance of revealing hidden knowledge in the thaumonomicon
|
|
||||||
*/
|
|
||||||
private String[] entityTriggers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scanning things with these aspects will have a chance of revealing hidden knowledge in the thaumonomicon
|
|
||||||
*/
|
|
||||||
private Aspect[] aspectTriggers;
|
|
||||||
|
|
||||||
private ResearchPage[] pages = null;
|
|
||||||
|
|
||||||
public ResearchItem(String key, String category)
|
|
||||||
{
|
|
||||||
this.key = key;
|
|
||||||
this.category = category;
|
|
||||||
this.tags = new AspectList();
|
|
||||||
this.icon_resource = null;
|
|
||||||
this.icon_item = null;
|
|
||||||
this.displayColumn = 0;
|
|
||||||
this.displayRow = 0;
|
|
||||||
this.setVirtual();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ResourceLocation icon)
|
|
||||||
{
|
|
||||||
this.key = key;
|
|
||||||
this.category = category;
|
|
||||||
this.tags = tags;
|
|
||||||
this.icon_resource = icon;
|
|
||||||
this.icon_item = null;
|
|
||||||
this.displayColumn = col;
|
|
||||||
this.displayRow = row;
|
|
||||||
this.complexity = complex;
|
|
||||||
if (complexity < 1) this.complexity = 1;
|
|
||||||
if (complexity > 3) this.complexity = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ItemStack icon)
|
|
||||||
{
|
|
||||||
this.key = key;
|
|
||||||
this.category = category;
|
|
||||||
this.tags = tags;
|
|
||||||
this.icon_item = icon;
|
|
||||||
this.icon_resource = null;
|
|
||||||
this.displayColumn = col;
|
|
||||||
this.displayRow = row;
|
|
||||||
this.complexity = complex;
|
|
||||||
if (complexity < 1) this.complexity = 1;
|
|
||||||
if (complexity > 3) this.complexity = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setSpecial()
|
|
||||||
{
|
|
||||||
this.isSpecial = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setStub()
|
|
||||||
{
|
|
||||||
this.isStub = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setLost()
|
|
||||||
{
|
|
||||||
this.isLost = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setConcealed()
|
|
||||||
{
|
|
||||||
this.isConcealed = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setHidden()
|
|
||||||
{
|
|
||||||
this.isHidden = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setVirtual()
|
|
||||||
{
|
|
||||||
this.isVirtual = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setParents(String... par)
|
|
||||||
{
|
|
||||||
this.parents = par;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ResearchItem setParentsHidden(String... par)
|
|
||||||
{
|
|
||||||
this.parentsHidden = par;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setSiblings(String... sib)
|
|
||||||
{
|
|
||||||
this.siblings = sib;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setPages(ResearchPage... par)
|
|
||||||
{
|
|
||||||
this.pages = par;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchPage[] getPages() {
|
|
||||||
return pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setItemTriggers(ItemStack... par)
|
|
||||||
{
|
|
||||||
this.itemTriggers = par;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setEntityTriggers(String... par)
|
|
||||||
{
|
|
||||||
this.entityTriggers = par;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setAspectTriggers(Aspect... par)
|
|
||||||
{
|
|
||||||
this.aspectTriggers = par;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack[] getItemTriggers() {
|
|
||||||
return itemTriggers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getEntityTriggers() {
|
|
||||||
return entityTriggers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Aspect[] getAspectTriggers() {
|
|
||||||
return aspectTriggers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem registerResearchItem()
|
|
||||||
{
|
|
||||||
ResearchCategories.addResearch(this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return StatCollector.translateToLocal("tc.research_name."+key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText()
|
|
||||||
{
|
|
||||||
return StatCollector.translateToLocal("tc.research_text."+key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSpecial()
|
|
||||||
{
|
|
||||||
return this.isSpecial;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isStub()
|
|
||||||
{
|
|
||||||
return this.isStub;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLost()
|
|
||||||
{
|
|
||||||
return this.isLost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isConcealed()
|
|
||||||
{
|
|
||||||
return this.isConcealed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isHidden()
|
|
||||||
{
|
|
||||||
return this.isHidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isVirtual()
|
|
||||||
{
|
|
||||||
return this.isVirtual;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoUnlock() {
|
|
||||||
return isAutoUnlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setAutoUnlock()
|
|
||||||
{
|
|
||||||
this.isAutoUnlock = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRound() {
|
|
||||||
return isRound;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setRound() {
|
|
||||||
this.isRound = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSecondary() {
|
|
||||||
return isSecondary;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setSecondary() {
|
|
||||||
this.isSecondary = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getComplexity() {
|
|
||||||
return complexity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchItem setComplexity(int complexity) {
|
|
||||||
this.complexity = complexity;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the aspect aspects ordinal with the highest value. Used to determine scroll color and similar things
|
|
||||||
*/
|
|
||||||
public Aspect getResearchPrimaryTag() {
|
|
||||||
Aspect aspect=null;
|
|
||||||
int highest=0;
|
|
||||||
if (tags!=null)
|
|
||||||
for (Aspect tag:tags.getAspects()) {
|
|
||||||
if (tags.getAmount(tag)>highest) {
|
|
||||||
aspect=tag;
|
|
||||||
highest=tags.getAmount(tag);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return aspect;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
package thaumcraft.api.research;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
import thaumcraft.api.crafting.CrucibleRecipe;
|
|
||||||
import thaumcraft.api.crafting.IArcaneRecipe;
|
|
||||||
import thaumcraft.api.crafting.InfusionEnchantmentRecipe;
|
|
||||||
import thaumcraft.api.crafting.InfusionRecipe;
|
|
||||||
|
|
||||||
public class ResearchPage {
|
|
||||||
public static enum PageType
|
|
||||||
{
|
|
||||||
TEXT,
|
|
||||||
TEXT_CONCEALED,
|
|
||||||
IMAGE,
|
|
||||||
CRUCIBLE_CRAFTING,
|
|
||||||
ARCANE_CRAFTING,
|
|
||||||
ASPECTS,
|
|
||||||
NORMAL_CRAFTING,
|
|
||||||
INFUSION_CRAFTING,
|
|
||||||
COMPOUND_CRAFTING,
|
|
||||||
INFUSION_ENCHANTMENT,
|
|
||||||
SMELTING
|
|
||||||
}
|
|
||||||
|
|
||||||
public PageType type = PageType.TEXT;
|
|
||||||
|
|
||||||
public String text=null;
|
|
||||||
public String research=null;
|
|
||||||
public ResourceLocation image=null;
|
|
||||||
public AspectList aspects=null;
|
|
||||||
public Object recipe=null;
|
|
||||||
public ItemStack recipeOutput=null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param text this can (but does not have to) be a reference to a localization variable, not the actual text.
|
|
||||||
*/
|
|
||||||
public ResearchPage(String text) {
|
|
||||||
this.type = PageType.TEXT;
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param research this page will only be displayed if the player has discovered this research
|
|
||||||
* @param text this can (but does not have to) be a reference to a localization variable, not the actual text.
|
|
||||||
*/
|
|
||||||
public ResearchPage(String research, String text) {
|
|
||||||
this.type = PageType.TEXT_CONCEALED;
|
|
||||||
this.research = research;
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe a vanilla crafting recipe.
|
|
||||||
*/
|
|
||||||
public ResearchPage(IRecipe recipe) {
|
|
||||||
this.type = PageType.NORMAL_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
this.recipeOutput = recipe.getRecipeOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe a collection of vanilla crafting recipes.
|
|
||||||
*/
|
|
||||||
public ResearchPage(IRecipe[] recipe) {
|
|
||||||
this.type = PageType.NORMAL_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe a collection of arcane crafting recipes.
|
|
||||||
*/
|
|
||||||
public ResearchPage(IArcaneRecipe[] recipe) {
|
|
||||||
this.type = PageType.ARCANE_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe a collection of arcane crafting recipes.
|
|
||||||
*/
|
|
||||||
public ResearchPage(CrucibleRecipe[] recipe) {
|
|
||||||
this.type = PageType.CRUCIBLE_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe a collection of infusion crafting recipes.
|
|
||||||
*/
|
|
||||||
public ResearchPage(InfusionRecipe[] recipe) {
|
|
||||||
this.type = PageType.INFUSION_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe a compound crafting recipe.
|
|
||||||
*/
|
|
||||||
public ResearchPage(List recipe) {
|
|
||||||
this.type = PageType.COMPOUND_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe an arcane worktable crafting recipe.
|
|
||||||
*/
|
|
||||||
public ResearchPage(IArcaneRecipe recipe) {
|
|
||||||
this.type = PageType.ARCANE_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
this.recipeOutput = recipe.getRecipeOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe an alchemy crafting recipe.
|
|
||||||
*/
|
|
||||||
public ResearchPage(CrucibleRecipe recipe) {
|
|
||||||
this.type = PageType.CRUCIBLE_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
this.recipeOutput = recipe.getRecipeOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe a furnace smelting crafting recipe.
|
|
||||||
*/
|
|
||||||
public ResearchPage(ItemStack input) {
|
|
||||||
this.type = PageType.SMELTING;
|
|
||||||
this.recipe = input;
|
|
||||||
this.recipeOutput = FurnaceRecipes.smelting().getSmeltingResult(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe an infusion crafting recipe.
|
|
||||||
*/
|
|
||||||
public ResearchPage(InfusionRecipe recipe) {
|
|
||||||
this.type = PageType.INFUSION_CRAFTING;
|
|
||||||
this.recipe = recipe;
|
|
||||||
if (recipe.getRecipeOutput() instanceof ItemStack) {
|
|
||||||
this.recipeOutput = (ItemStack) recipe.getRecipeOutput();
|
|
||||||
} else {
|
|
||||||
this.recipeOutput = recipe.getRecipeInput();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recipe an infusion crafting recipe.
|
|
||||||
*/
|
|
||||||
public ResearchPage(InfusionEnchantmentRecipe recipe) {
|
|
||||||
this.type = PageType.INFUSION_ENCHANTMENT;
|
|
||||||
this.recipe = recipe;
|
|
||||||
// if (recipe.recipeOutput instanceof ItemStack) {
|
|
||||||
// this.recipeOutput = (ItemStack) recipe.recipeOutput;
|
|
||||||
// } else {
|
|
||||||
// this.recipeOutput = recipe.recipeInput;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param image
|
|
||||||
* @param caption this can (but does not have to) be a reference to a localization variable, not the actual text.
|
|
||||||
*/
|
|
||||||
public ResearchPage(ResourceLocation image, String caption) {
|
|
||||||
this.type = PageType.IMAGE;
|
|
||||||
this.image = image;
|
|
||||||
this.text = caption;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function should really not be called directly - used internally
|
|
||||||
*/
|
|
||||||
public ResearchPage(AspectList as) {
|
|
||||||
this.type = PageType.ASPECTS;
|
|
||||||
this.aspects = as;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns a localized text of the text field (if one exists). Returns the text field itself otherwise.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getTranslatedText() {
|
|
||||||
String ret="";
|
|
||||||
if (text != null) {
|
|
||||||
ret = StatCollector.translateToLocal(text);
|
|
||||||
if (ret.isEmpty()) ret = text;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package thaumcraft.api.research;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
|
|
||||||
public class ScanResult {
|
|
||||||
public byte type = 0; //1=blocks,2=entities,3=phenomena
|
|
||||||
public int id;
|
|
||||||
public int meta;
|
|
||||||
public Entity entity;
|
|
||||||
public String phenomena;
|
|
||||||
|
|
||||||
public ScanResult(byte type, int blockId, int blockMeta, Entity entity,
|
|
||||||
String phenomena) {
|
|
||||||
super();
|
|
||||||
this.type = type;
|
|
||||||
this.id = blockId;
|
|
||||||
this.meta = blockMeta;
|
|
||||||
this.entity = entity;
|
|
||||||
this.phenomena = phenomena;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof ScanResult) {
|
|
||||||
ScanResult sr = (ScanResult) obj;
|
|
||||||
if (type != sr.type)
|
|
||||||
return false;
|
|
||||||
if (type == 1
|
|
||||||
&& (id != sr.id || meta != sr.meta))
|
|
||||||
return false;
|
|
||||||
if (type == 2 && entity.getEntityId() != sr.entity.getEntityId())
|
|
||||||
return false;
|
|
||||||
if (type == 3 && !phenomena.equals(sr.phenomena))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
package thaumcraft.api.visnet;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import thaumcraft.api.TileThaumcraft;
|
|
||||||
import thaumcraft.api.WorldCoordinates;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* The tile entity used by nodes in the vis energy network. A node is either a source (like an aura node),
|
|
||||||
* a transport relay or vis receiver (like the infernal furnace).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public abstract class TileVisNode extends TileThaumcraft {
|
|
||||||
|
|
||||||
WeakReference<TileVisNode> parent = null;
|
|
||||||
ArrayList<WeakReference<TileVisNode>> children = new ArrayList<WeakReference<TileVisNode>>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the WorldCoordinates location of where this node is located
|
|
||||||
*/
|
|
||||||
public WorldCoordinates getLocation() {
|
|
||||||
return new WorldCoordinates(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the number of blocks away this node will check for parent nodes to connect to.
|
|
||||||
*/
|
|
||||||
public abstract int getRange();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if this is the source or root node of the vis network.
|
|
||||||
*/
|
|
||||||
public abstract boolean isSource();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method should never be called directly. Use VisNetHandler.drainVis() instead
|
|
||||||
* @param aspect what aspect to drain
|
|
||||||
* @param vis how much to drain
|
|
||||||
* @return how much was actually drained
|
|
||||||
*/
|
|
||||||
public int consumeVis(Aspect aspect, int vis) {
|
|
||||||
if (VisNetHandler.isNodeValid(getParent())) {
|
|
||||||
int out = getParent().get().consumeVis(aspect, vis);
|
|
||||||
if (out>0) {
|
|
||||||
triggerConsumeEffect(aspect);
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeThisNode() {
|
|
||||||
for (WeakReference<TileVisNode> n:getChildren()) {
|
|
||||||
if (n!=null && n.get()!=null) {
|
|
||||||
n.get().removeThisNode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
children = new ArrayList<WeakReference<TileVisNode>>();
|
|
||||||
if (VisNetHandler.isNodeValid(this.getParent())) {
|
|
||||||
this.getParent().get().nodeRefresh=true;
|
|
||||||
}
|
|
||||||
this.setParent(null);
|
|
||||||
this.parentChanged();
|
|
||||||
|
|
||||||
if (this.isSource()) {
|
|
||||||
HashMap<WorldCoordinates, WeakReference<TileVisNode>> sourcelist = VisNetHandler.sources.get(worldObj.provider.dimensionId);
|
|
||||||
if (sourcelist==null) {
|
|
||||||
sourcelist = new HashMap<WorldCoordinates, WeakReference<TileVisNode>>();
|
|
||||||
}
|
|
||||||
sourcelist.remove(getLocation());
|
|
||||||
VisNetHandler.sources.put( worldObj.provider.dimensionId, sourcelist );
|
|
||||||
}
|
|
||||||
|
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invalidate() {
|
|
||||||
removeThisNode();
|
|
||||||
super.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void triggerConsumeEffect(Aspect aspect) { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public WeakReference<TileVisNode> getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public WeakReference<TileVisNode> getRootSource() {
|
|
||||||
return VisNetHandler.isNodeValid(getParent()) ?
|
|
||||||
getParent().get().getRootSource() : this.isSource() ?
|
|
||||||
new WeakReference(this) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
public void setParent(WeakReference<TileVisNode> parent) {
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public ArrayList<WeakReference<TileVisNode>> getChildren() {
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canUpdate() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int nodeCounter = 0;
|
|
||||||
private boolean nodeRegged = false;
|
|
||||||
public boolean nodeRefresh = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity() {
|
|
||||||
|
|
||||||
if (!worldObj.isRemote && ((nodeCounter++) % 40==0 || nodeRefresh)) {
|
|
||||||
//check for changes
|
|
||||||
if (!nodeRefresh && children.size()>0) {
|
|
||||||
for (WeakReference<TileVisNode> n:children) {
|
|
||||||
if (n==null || n.get()==null || !VisNetHandler.canNodeBeSeen(this, n.get())) {
|
|
||||||
nodeRefresh=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//refresh linked nodes
|
|
||||||
if (nodeRefresh) {
|
|
||||||
for (WeakReference<TileVisNode> n:children) {
|
|
||||||
if (n.get()!=null) {
|
|
||||||
n.get().nodeRefresh=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
children.clear();
|
|
||||||
parent=null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//redo stuff
|
|
||||||
if (isSource() && !nodeRegged) {
|
|
||||||
VisNetHandler.addSource(getWorldObj(), this);
|
|
||||||
nodeRegged = true;
|
|
||||||
} else
|
|
||||||
if (!isSource() && !VisNetHandler.isNodeValid(getParent())) {
|
|
||||||
setParent(VisNetHandler.addNode(getWorldObj(), this));
|
|
||||||
nodeRefresh=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nodeRefresh) {
|
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
|
||||||
parentChanged();
|
|
||||||
}
|
|
||||||
nodeRefresh=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void parentChanged() { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the type of shard this is attuned to:
|
|
||||||
* none -1, air 0, fire 1, water 2, earth 3, order 4, entropy 5
|
|
||||||
* Should return -1 for most implementations
|
|
||||||
*/
|
|
||||||
public byte getAttunement() {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,282 +0,0 @@
|
|||||||
package thaumcraft.api.visnet;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import thaumcraft.api.ThaumcraftApi;
|
|
||||||
import thaumcraft.api.ThaumcraftApiHelper;
|
|
||||||
import thaumcraft.api.WorldCoordinates;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
|
|
||||||
public class VisNetHandler {
|
|
||||||
|
|
||||||
// NODE DRAINING
|
|
||||||
/**
|
|
||||||
* This method drains vis from a relay or source near the passed in
|
|
||||||
* location. The amount received can be less than the amount requested so
|
|
||||||
* take that into account.
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x the x position of the draining block or entity
|
|
||||||
* @param y the y position of the draining block or entity
|
|
||||||
* @param z the z position of the draining block or entity
|
|
||||||
* @param aspect what aspect to drain
|
|
||||||
* @param amount how much to drain
|
|
||||||
* @return how much was actually drained
|
|
||||||
*/
|
|
||||||
public static int drainVis(World world, int x, int y, int z, Aspect aspect, int amount) {
|
|
||||||
|
|
||||||
int drainedAmount = 0;
|
|
||||||
|
|
||||||
WorldCoordinates drainer = new WorldCoordinates(x, y, z,
|
|
||||||
world.provider.dimensionId);
|
|
||||||
if (!nearbyNodes.containsKey(drainer)) {
|
|
||||||
calculateNearbyNodes(world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<WeakReference<TileVisNode>> nodes = nearbyNodes.get(drainer);
|
|
||||||
if (nodes!=null && nodes.size()>0)
|
|
||||||
for (WeakReference<TileVisNode> noderef : nodes) {
|
|
||||||
|
|
||||||
TileVisNode node = noderef.get();
|
|
||||||
|
|
||||||
if (node == null) continue;
|
|
||||||
|
|
||||||
int a = node.consumeVis(aspect, amount);
|
|
||||||
drainedAmount += a;
|
|
||||||
amount -= a;
|
|
||||||
if (a>0) {
|
|
||||||
int color = Aspect.getPrimalAspects().indexOf(aspect);
|
|
||||||
generateVisEffect(world.provider.dimensionId, x, y, z, node.xCoord, node.yCoord, node.zCoord, color);
|
|
||||||
}
|
|
||||||
if (amount <= 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return drainedAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void generateVisEffect(int dim, int x, int y, int z, int x2, int y2, int z2, int color) {
|
|
||||||
ThaumcraftApi.internalMethods.generateVisEffect(dim, x, y, z, x2, y2, z2, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashMap<Integer, HashMap<WorldCoordinates, WeakReference<TileVisNode>>> sources = new HashMap<Integer, HashMap<WorldCoordinates, WeakReference<TileVisNode>>>();
|
|
||||||
|
|
||||||
public static void addSource(World world, TileVisNode vs) {
|
|
||||||
HashMap<WorldCoordinates, WeakReference<TileVisNode>> sourcelist = sources
|
|
||||||
.get(world.provider.dimensionId);
|
|
||||||
if (sourcelist == null) {
|
|
||||||
sourcelist = new HashMap<WorldCoordinates, WeakReference<TileVisNode>>();
|
|
||||||
}
|
|
||||||
sourcelist.put(vs.getLocation(), new WeakReference(vs));
|
|
||||||
sources.put(world.provider.dimensionId, sourcelist);
|
|
||||||
nearbyNodes.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isNodeValid(WeakReference<TileVisNode> node) {
|
|
||||||
if (node == null || node.get() == null || node.get().isInvalid())
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WeakReference<TileVisNode> addNode(World world, TileVisNode vn) {
|
|
||||||
WeakReference ref = new WeakReference(vn);
|
|
||||||
|
|
||||||
HashMap<WorldCoordinates, WeakReference<TileVisNode>> sourcelist = sources
|
|
||||||
.get(world.provider.dimensionId);
|
|
||||||
if (sourcelist == null) {
|
|
||||||
sourcelist = new HashMap<WorldCoordinates, WeakReference<TileVisNode>>();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<Object[]> nearby = new ArrayList<Object[]>();
|
|
||||||
|
|
||||||
for (WeakReference<TileVisNode> root : sourcelist.values()) {
|
|
||||||
if (!isNodeValid(root))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TileVisNode source = root.get();
|
|
||||||
|
|
||||||
float r = inRange(world, vn.getLocation(), source.getLocation(),
|
|
||||||
vn.getRange());
|
|
||||||
if (r > 0) {
|
|
||||||
nearby.add(new Object[] { source, r - vn.getRange() * 2 });
|
|
||||||
}
|
|
||||||
|
|
||||||
nearby = findClosestNodes(vn, source, nearby);
|
|
||||||
cache.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
float dist = Float.MAX_VALUE;
|
|
||||||
TileVisNode closest = null;
|
|
||||||
if (nearby.size() > 0) {
|
|
||||||
for (Object[] o : nearby) {
|
|
||||||
if ((Float) o[1] < dist &&
|
|
||||||
(vn.getAttunement() == -1 || ((TileVisNode) o[0]).getAttunement() == -1 ||
|
|
||||||
vn.getAttunement() == ((TileVisNode) o[0]).getAttunement())//) {
|
|
||||||
&& canNodeBeSeen(vn,(TileVisNode)o[0])) {
|
|
||||||
dist = (Float) o[1];
|
|
||||||
closest = (TileVisNode) o[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (closest != null) {
|
|
||||||
closest.getChildren().add(ref);
|
|
||||||
nearbyNodes.clear();
|
|
||||||
return new WeakReference(closest);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ArrayList<WorldCoordinates> cache = new ArrayList<WorldCoordinates>();
|
|
||||||
public static ArrayList<Object[]> findClosestNodes(TileVisNode target,
|
|
||||||
TileVisNode parent, ArrayList<Object[]> in) {
|
|
||||||
|
|
||||||
if (cache.size() > 512 || cache.contains(new WorldCoordinates(parent))) return in;
|
|
||||||
cache.add(new WorldCoordinates(parent));
|
|
||||||
|
|
||||||
for (WeakReference<TileVisNode> childWR : parent.getChildren()) {
|
|
||||||
TileVisNode child = childWR.get();
|
|
||||||
|
|
||||||
if (child != null && !child.equals(target) && !child.equals(parent)) {
|
|
||||||
float r2 = inRange(child.getWorldObj(), child.getLocation(),
|
|
||||||
target.getLocation(), target.getRange());
|
|
||||||
if (r2 > 0) {
|
|
||||||
in.add(new Object[] { child, r2 });
|
|
||||||
}
|
|
||||||
|
|
||||||
in = findClosestNodes(target, child, in);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static float inRange(World world, WorldCoordinates cc1,
|
|
||||||
WorldCoordinates cc2, int range) {
|
|
||||||
float distance = cc1.getDistanceSquaredToWorldCoordinates(cc2);
|
|
||||||
return distance > range * range ? -1 : distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static HashMap<WorldCoordinates, ArrayList<WeakReference<TileVisNode>>> nearbyNodes = new HashMap<WorldCoordinates, ArrayList<WeakReference<TileVisNode>>>();
|
|
||||||
|
|
||||||
private static void calculateNearbyNodes(World world, int x, int y, int z) {
|
|
||||||
|
|
||||||
HashMap<WorldCoordinates, WeakReference<TileVisNode>> sourcelist = sources
|
|
||||||
.get(world.provider.dimensionId);
|
|
||||||
if (sourcelist == null) {
|
|
||||||
sourcelist = new HashMap<WorldCoordinates, WeakReference<TileVisNode>>();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<WeakReference<TileVisNode>> cn = new ArrayList<WeakReference<TileVisNode>>();
|
|
||||||
WorldCoordinates drainer = new WorldCoordinates(x, y, z,
|
|
||||||
world.provider.dimensionId);
|
|
||||||
|
|
||||||
ArrayList<Object[]> nearby = new ArrayList<Object[]>();
|
|
||||||
|
|
||||||
for (WeakReference<TileVisNode> root : sourcelist.values()) {
|
|
||||||
|
|
||||||
if (!isNodeValid(root))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TileVisNode source = root.get();
|
|
||||||
|
|
||||||
TileVisNode closest = null;
|
|
||||||
float range = Float.MAX_VALUE;
|
|
||||||
|
|
||||||
float r = inRange(world, drainer, source.getLocation(),
|
|
||||||
source.getRange());
|
|
||||||
if (r > 0) {
|
|
||||||
range = r;
|
|
||||||
closest = source;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<WeakReference<TileVisNode>> children = new ArrayList<WeakReference<TileVisNode>>();
|
|
||||||
children = getAllChildren(source,children);
|
|
||||||
|
|
||||||
for (WeakReference<TileVisNode> child : children) {
|
|
||||||
TileVisNode n = child.get();
|
|
||||||
if (n != null && !n.equals(root)) {
|
|
||||||
|
|
||||||
float r2 = inRange(n.getWorldObj(), n.getLocation(),
|
|
||||||
drainer, n.getRange());
|
|
||||||
if (r2 > 0 && r2 < range) {
|
|
||||||
range = r2;
|
|
||||||
closest = n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (closest != null) {
|
|
||||||
|
|
||||||
cn.add(new WeakReference(closest));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nearbyNodes.put(drainer, cn);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ArrayList<WeakReference<TileVisNode>> getAllChildren(TileVisNode source, ArrayList<WeakReference<TileVisNode>> list) {
|
|
||||||
for (WeakReference<TileVisNode> child : source.getChildren()) {
|
|
||||||
TileVisNode n = child.get();
|
|
||||||
|
|
||||||
if (n != null && n.getWorldObj()!=null && isChunkLoaded(n.getWorldObj(), n.xCoord, n.zCoord)) {
|
|
||||||
list.add(child);
|
|
||||||
list = getAllChildren(n,list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isChunkLoaded(World world, int x, int z) {
|
|
||||||
int xx = x >> 4;
|
|
||||||
int zz = z >> 4;
|
|
||||||
return world.getChunkProvider().chunkExists(xx, zz);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canNodeBeSeen(TileVisNode source,TileVisNode target)
|
|
||||||
{
|
|
||||||
MovingObjectPosition mop = ThaumcraftApiHelper.rayTraceIgnoringSource(source.getWorldObj(),
|
|
||||||
Vec3.createVectorHelper(source.xCoord+.5, source.yCoord+.5,source.zCoord+.5),
|
|
||||||
Vec3.createVectorHelper(target.xCoord+.5, target.yCoord+.5,target.zCoord+.5),
|
|
||||||
false, true, false);
|
|
||||||
return mop == null || (mop.typeOfHit==MovingObjectType.BLOCK &&
|
|
||||||
mop.blockX==target.xCoord && mop.blockY==target.yCoord && mop.blockZ==target.zCoord);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static HashMap<WorldCoordinates,WeakReference<TileVisNode>>
|
|
||||||
// noderef = new HashMap<WorldCoordinates,WeakReference<TileVisNode>>();
|
|
||||||
//
|
|
||||||
// public static TileVisNode getClosestNodeWithinRadius(World world, int x,
|
|
||||||
// int y, int z, int radius) {
|
|
||||||
// TileVisNode out = null;
|
|
||||||
// WorldCoordinates wc = null;
|
|
||||||
// float cd = Float.MAX_VALUE;
|
|
||||||
// for (int sx = x - radius; sx <= x + radius; sx++) {
|
|
||||||
// for (int sy = y - radius; sy <= y + radius; sy++) {
|
|
||||||
// for (int sz = z - radius; sz <= z + radius; sz++) {
|
|
||||||
// wc = new WorldCoordinates(sx,sy,sz,world.provider.dimensionId);
|
|
||||||
// if (noderef.containsKey(wc)) {
|
|
||||||
// float d = wc.getDistanceSquared(x, y, z);
|
|
||||||
// if (d<radius*radius && noderef.get(wc).get()!=null &&
|
|
||||||
// !noderef.get(wc).get().isReceiver() &&
|
|
||||||
// isNodeValid(noderef.get(wc).get().getParent())
|
|
||||||
// ) {
|
|
||||||
// out = noderef.get(wc).get();
|
|
||||||
// cd = d;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return out;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class FocusUpgradeType {
|
|
||||||
|
|
||||||
public static FocusUpgradeType[] types = new FocusUpgradeType[20];
|
|
||||||
|
|
||||||
public short id;
|
|
||||||
|
|
||||||
public ResourceLocation icon;
|
|
||||||
|
|
||||||
public String name;
|
|
||||||
|
|
||||||
public String text;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What aspects are used to calculate the cost of this upgrade. The amounts given is ignored, just the type is used for the calculation.
|
|
||||||
*/
|
|
||||||
public AspectList aspects;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FocusUpgradeType(int id, ResourceLocation icon, String name, String text, AspectList aspects) {
|
|
||||||
this.id = (short) id;
|
|
||||||
this.icon = icon;
|
|
||||||
this.name = name;
|
|
||||||
this.text = text;
|
|
||||||
this.aspects = aspects;
|
|
||||||
|
|
||||||
if (id<types.length && types[id]!=null) {
|
|
||||||
LogManager.getLogger("THAUMCRAFT").fatal("Focus Upgrade id "+id+" already occupied. Ignoring.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// allocate space
|
|
||||||
if (id>=types.length) {
|
|
||||||
FocusUpgradeType[] temp = new FocusUpgradeType[id+1];
|
|
||||||
System.arraycopy(types, 0, temp, 0, types.length);
|
|
||||||
types = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
types[id] = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLocalizedName() {
|
|
||||||
return StatCollector.translateToLocal(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLocalizedText() {
|
|
||||||
return StatCollector.translateToLocal(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof FocusUpgradeType) {
|
|
||||||
return this.id == ((FocusUpgradeType)obj).id;
|
|
||||||
} else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// basic upgrade types
|
|
||||||
public static FocusUpgradeType potency = new FocusUpgradeType( 0,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/potency.png"),
|
|
||||||
"focus.upgrade.potency.name","focus.upgrade.potency.text",
|
|
||||||
new AspectList().add(Aspect.WEAPON,1));
|
|
||||||
|
|
||||||
public static FocusUpgradeType frugal = new FocusUpgradeType( 1,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/frugal.png"),
|
|
||||||
"focus.upgrade.frugal.name","focus.upgrade.frugal.text",
|
|
||||||
new AspectList().add(Aspect.HUNGER,1));
|
|
||||||
|
|
||||||
public static FocusUpgradeType treasure = new FocusUpgradeType( 2,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/treasure.png"),
|
|
||||||
"focus.upgrade.treasure.name","focus.upgrade.treasure.text",
|
|
||||||
new AspectList().add(Aspect.GREED,1));
|
|
||||||
|
|
||||||
public static FocusUpgradeType enlarge = new FocusUpgradeType( 3,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/enlarge.png"),
|
|
||||||
"focus.upgrade.enlarge.name","focus.upgrade.enlarge.text",
|
|
||||||
new AspectList().add(Aspect.TRAVEL,1));
|
|
||||||
|
|
||||||
public static FocusUpgradeType alchemistsfire = new FocusUpgradeType( 4,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/alchemistsfire.png"),
|
|
||||||
"focus.upgrade.alchemistsfire.name","focus.upgrade.alchemistsfire.text",
|
|
||||||
new AspectList().add(Aspect.ENERGY,1).add(Aspect.SLIME,1));
|
|
||||||
|
|
||||||
public static FocusUpgradeType alchemistsfrost = new FocusUpgradeType( 5,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/alchemistsfrost.png"),
|
|
||||||
"focus.upgrade.alchemistsfrost.name","focus.upgrade.alchemistsfrost.text",
|
|
||||||
new AspectList().add(Aspect.COLD,1).add(Aspect.TRAP,1));
|
|
||||||
|
|
||||||
public static FocusUpgradeType architect = new FocusUpgradeType( 6,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/architect.png"),
|
|
||||||
"focus.upgrade.architect.name","focus.upgrade.architect.text",
|
|
||||||
new AspectList().add(Aspect.CRAFT,1));
|
|
||||||
|
|
||||||
public static FocusUpgradeType extend = new FocusUpgradeType( 7,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/extend.png"),
|
|
||||||
"focus.upgrade.extend.name","focus.upgrade.extend.text",
|
|
||||||
new AspectList().add(Aspect.EXCHANGE,1));
|
|
||||||
|
|
||||||
public static FocusUpgradeType silktouch = new FocusUpgradeType( 8,
|
|
||||||
new ResourceLocation("thaumcraft", "textures/foci/silktouch.png"),
|
|
||||||
"focus.upgrade.silktouch.name","focus.upgrade.silktouch.text",
|
|
||||||
new AspectList().add(Aspect.GREED,1));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author azanor
|
|
||||||
*
|
|
||||||
* Implemented by a class that you wish to be called whenever a wand with this rod performs its
|
|
||||||
* update tick.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IWandRodOnUpdate {
|
|
||||||
void onUpdate(ItemStack itemstack, EntityPlayer player);
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IWandTriggerManager {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class will be called by wands with the proper parameters. It is up to you to decide what to do with them.
|
|
||||||
*/
|
|
||||||
public boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
|
|
||||||
int x, int y, int z, int side, int event);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author azanor
|
|
||||||
*
|
|
||||||
* Add this to a tile entity that you wish wands to interact with in some way.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface IWandable {
|
|
||||||
|
|
||||||
public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md);
|
|
||||||
|
|
||||||
public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player);
|
|
||||||
|
|
||||||
public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count);
|
|
||||||
|
|
||||||
public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,276 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class ItemFocusBasic extends Item {
|
|
||||||
|
|
||||||
public ItemFocusBasic ()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
maxStackSize = 1;
|
|
||||||
canRepair=false;
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IIcon icon;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
@Override
|
|
||||||
public IIcon getIconFromDamage(int par1) {
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDamageable() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack,EntityPlayer player, List list, boolean par4) {
|
|
||||||
AspectList al = this.getVisCost(stack);
|
|
||||||
if (al!=null && al.size()>0) {
|
|
||||||
list.add(StatCollector.translateToLocal(isVisCostPerTick(stack)?"item.Focus.cost2":"item.Focus.cost1"));
|
|
||||||
for (Aspect aspect:al.getAspectsSorted()) {
|
|
||||||
DecimalFormat myFormatter = new DecimalFormat("#####.##");
|
|
||||||
String amount = myFormatter.format(al.getAmount(aspect)/100f);
|
|
||||||
list.add(" \u00A7"+aspect.getChatcolor()+aspect.getName()+"\u00A7r x "+ amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addFocusInformation(stack,player,list,par4);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addFocusInformation(ItemStack focusstack,EntityPlayer player, List list, boolean par4) {
|
|
||||||
LinkedHashMap<Short, Integer> map = new LinkedHashMap<Short, Integer>();
|
|
||||||
for (short id:this.getAppliedUpgrades(focusstack)) {
|
|
||||||
if (id>=0) {
|
|
||||||
int amt = 1;
|
|
||||||
if (map.containsKey(id)) {
|
|
||||||
amt = map.get(id) + 1;
|
|
||||||
}
|
|
||||||
map.put(id, amt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Short id:map.keySet()) {
|
|
||||||
list.add(EnumChatFormatting.DARK_PURPLE +FocusUpgradeType.types[id].getLocalizedName()+
|
|
||||||
(map.get(id)>1?" "+StatCollector.translateToLocal("enchantment.level." + map.get(id)):""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Purely for display on the focus tooltip (see addInformation method above)
|
|
||||||
*/
|
|
||||||
public boolean isVisCostPerTick(ItemStack focusstack) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack focusstack)
|
|
||||||
{
|
|
||||||
return EnumRarity.rare;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What color will the focus orb be rendered on the held wand
|
|
||||||
*/
|
|
||||||
public int getFocusColor(ItemStack focusstack) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does the focus have ornamentation like the focus of the nine hells. Ornamentation is a standard icon rendered in a cross around the focus
|
|
||||||
*/
|
|
||||||
public IIcon getOrnament(ItemStack focusstack) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An icon to be rendered inside the focus itself
|
|
||||||
*/
|
|
||||||
public IIcon getFocusDepthLayerIcon(ItemStack focusstack) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum WandFocusAnimation {
|
|
||||||
WAVE, CHARGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WandFocusAnimation getAnimation(ItemStack focusstack) {
|
|
||||||
return WandFocusAnimation.WAVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Just insert two alphanumeric characters before this string in your focus item class
|
|
||||||
*/
|
|
||||||
public String getSortingHelper(ItemStack focusstack) {
|
|
||||||
String out="";
|
|
||||||
for (short id:this.getAppliedUpgrades(focusstack)) {
|
|
||||||
out = out + id;
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How much vis does this focus consume per activation.
|
|
||||||
*/
|
|
||||||
public AspectList getVisCost(ItemStack focusstack) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This returns how many milliseconds must pass before the focus can be activated again.
|
|
||||||
*/
|
|
||||||
public int getActivationCooldown(ItemStack focusstack) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used by foci like equal trade to determine their area in artchitect mode
|
|
||||||
*/
|
|
||||||
public int getMaxAreaSize(ItemStack focusstack) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What upgrades can be applied to this focus for ranks 1 to 5
|
|
||||||
*/
|
|
||||||
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What upgrades does the focus currently have
|
|
||||||
*/
|
|
||||||
public short[] getAppliedUpgrades(ItemStack focusstack) {
|
|
||||||
short[] l = new short[] {-1,-1,-1,-1,-1};
|
|
||||||
NBTTagList nbttaglist = getFocusUpgradeTagList(focusstack);
|
|
||||||
if (nbttaglist == null)
|
|
||||||
{
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int j = 0; j < nbttaglist.tagCount(); ++j)
|
|
||||||
{
|
|
||||||
if (j>=5) break;
|
|
||||||
l[j] = nbttaglist.getCompoundTagAt(j).getShort("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean applyUpgrade(ItemStack focusstack, FocusUpgradeType type, int rank) {
|
|
||||||
short[] upgrades = getAppliedUpgrades(focusstack);
|
|
||||||
if (upgrades[rank-1]!=-1 || rank<1 || rank>5) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
upgrades[rank-1] = type.id;
|
|
||||||
setFocusUpgradeTagList(focusstack, upgrades);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this method to define custom logic about which upgrades can be applied. This can be used to set up upgrade "trees"
|
|
||||||
* that make certain upgrades available only when others are unlocked first, when certain research is completed, or similar logic.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public boolean canApplyUpgrade(ItemStack focusstack, EntityPlayer player, FocusUpgradeType type, int rank) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does this focus have the passed upgrade type
|
|
||||||
*/
|
|
||||||
public boolean isUpgradedWith(ItemStack focusstack, FocusUpgradeType focusUpgradetype) {
|
|
||||||
return getUpgradeLevel(focusstack,focusUpgradetype)>0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What level is the passed upgrade type on the focus. If it is not present it returns 0
|
|
||||||
*/
|
|
||||||
public int getUpgradeLevel(ItemStack focusstack, FocusUpgradeType focusUpgradetype) {
|
|
||||||
short[] list = getAppliedUpgrades(focusstack);
|
|
||||||
int level=0;
|
|
||||||
for (short id:list) {
|
|
||||||
if (id == focusUpgradetype.id)
|
|
||||||
{
|
|
||||||
level++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack onFocusRightClick(ItemStack wandstack, World world,EntityPlayer player, MovingObjectPosition movingobjectposition) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onUsingFocusTick(ItemStack wandstack, EntityPlayer player,int count) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPlayerStoppedUsingFocus(ItemStack wandstack, World world, EntityPlayer player, int count) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onFocusBlockStartBreak(ItemStack wandstack, int x, int y,int z, EntityPlayer player) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal helper methods
|
|
||||||
*/
|
|
||||||
private NBTTagList getFocusUpgradeTagList(ItemStack focusstack)
|
|
||||||
{
|
|
||||||
return focusstack.stackTagCompound == null ? null : focusstack.stackTagCompound.getTagList("upgrade", 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setFocusUpgradeTagList(ItemStack focusstack, short[] upgrades) {
|
|
||||||
if (!focusstack.hasTagCompound())
|
|
||||||
focusstack.setTagCompound(new NBTTagCompound());
|
|
||||||
NBTTagCompound nbttagcompound = focusstack.getTagCompound();
|
|
||||||
NBTTagList tlist = new NBTTagList();
|
|
||||||
nbttagcompound.setTag("upgrade", tlist);
|
|
||||||
for (short id : upgrades) {
|
|
||||||
NBTTagCompound f = new NBTTagCompound();
|
|
||||||
f.setShort("id", id);
|
|
||||||
tlist.appendTag(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(ItemStack stack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) {
|
|
||||||
if (stack.stackTagCompound !=null && stack.stackTagCompound.hasKey("ench")) {
|
|
||||||
stack.stackTagCompound.removeTag("ench");
|
|
||||||
}
|
|
||||||
super.onUpdate(stack, world, entity, p_77663_4_, p_77663_5_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* This class is used to keep the material information for the various rods.
|
|
||||||
* It is also used to generate the wand recipes ingame.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class StaffRod extends WandRod {
|
|
||||||
|
|
||||||
boolean runes=false;
|
|
||||||
|
|
||||||
public StaffRod(String tag, int capacity, ItemStack item, int craftCost) {
|
|
||||||
super(tag+"_staff", capacity, item, craftCost);
|
|
||||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+tag+".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
|
|
||||||
IWandRodOnUpdate onUpdate, ResourceLocation texture) {
|
|
||||||
super(tag+"_staff", capacity, item, craftCost, onUpdate, texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
|
|
||||||
IWandRodOnUpdate onUpdate) {
|
|
||||||
super(tag+"_staff", capacity, item, craftCost, onUpdate);
|
|
||||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+tag+".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
|
|
||||||
ResourceLocation texture) {
|
|
||||||
super(tag+"_staff", capacity, item, craftCost, texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasRunes() {
|
|
||||||
return runes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRunes(boolean hasRunes) {
|
|
||||||
this.runes = hasRunes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is used to keep the material information for the various caps.
|
|
||||||
* It is also used to generate the wand recipes ingame.
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class WandCap {
|
|
||||||
|
|
||||||
private String tag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cost to craft this wand. Combined with the rod cost.
|
|
||||||
*/
|
|
||||||
private int craftCost;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the amount by which all aspect costs are multiplied
|
|
||||||
*/
|
|
||||||
float baseCostModifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* specifies a list of primal aspects that use the special discount figure instead of the normal discount.
|
|
||||||
*/
|
|
||||||
List<Aspect> specialCostModifierAspects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the amount by which the specified aspect costs are multiplied
|
|
||||||
*/
|
|
||||||
float specialCostModifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The texture that will be used for the ingame wand cap
|
|
||||||
*/
|
|
||||||
ResourceLocation texture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the actual item that makes up this cap and will be used to generate the wand recipes
|
|
||||||
*/
|
|
||||||
ItemStack item;
|
|
||||||
|
|
||||||
public static LinkedHashMap<String,WandCap> caps = new LinkedHashMap<String,WandCap>();
|
|
||||||
|
|
||||||
public WandCap (String tag, float discount, ItemStack item, int craftCost) {
|
|
||||||
this.setTag(tag);
|
|
||||||
this.baseCostModifier = discount;
|
|
||||||
this.specialCostModifierAspects = null;
|
|
||||||
texture = new ResourceLocation("thaumcraft","textures/models/wand_cap_"+getTag()+".png");
|
|
||||||
this.item=item;
|
|
||||||
this.setCraftCost(craftCost);
|
|
||||||
caps.put(tag, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WandCap (String tag, float discount, List<Aspect> specialAspects, float discountSpecial, ItemStack item, int craftCost) {
|
|
||||||
this.setTag(tag);
|
|
||||||
this.baseCostModifier = discount;
|
|
||||||
this.specialCostModifierAspects = specialAspects;
|
|
||||||
this.specialCostModifier = discountSpecial;
|
|
||||||
texture = new ResourceLocation("thaumcraft","textures/models/wand_cap_"+getTag()+".png");
|
|
||||||
this.item=item;
|
|
||||||
this.setCraftCost(craftCost);
|
|
||||||
caps.put(tag, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getBaseCostModifier() {
|
|
||||||
return baseCostModifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Aspect> getSpecialCostModifierAspects() {
|
|
||||||
return specialCostModifierAspects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getSpecialCostModifier() {
|
|
||||||
return specialCostModifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResourceLocation getTexture() {
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTexture(ResourceLocation texture) {
|
|
||||||
this.texture = texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTag() {
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTag(String tag) {
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ItemStack getItem() {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItem(ItemStack item) {
|
|
||||||
this.item = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCraftCost() {
|
|
||||||
return craftCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftCost(int craftCost) {
|
|
||||||
this.craftCost = craftCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The research a player needs to have finished to be able to craft a wand with this cap.
|
|
||||||
*/
|
|
||||||
public String getResearch() {
|
|
||||||
return "CAP_"+getTag();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some examples:
|
|
||||||
// WandCap WAND_CAP_IRON = new WandCap("iron", 1.1f, Arrays.asList(Aspect.ORDER),1, new ItemStack(ConfigItems.itemWandCap,1,0),1);
|
|
||||||
// WandCap WAND_CAP_GOLD = new WandCap("gold", 1f, new ItemStack(ConfigItems.itemWandCap,1,1),3);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Azanor
|
|
||||||
*
|
|
||||||
* This class is used to keep the material information for the various rods.
|
|
||||||
* It is also used to generate the wand recipes ingame.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class WandRod {
|
|
||||||
|
|
||||||
|
|
||||||
private String tag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cost to craft this wand. Combined with the rod cost.
|
|
||||||
*/
|
|
||||||
private int craftCost;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The amount of vis that can be stored - this number is actually multiplied
|
|
||||||
* by 100 for use by the wands internals
|
|
||||||
*/
|
|
||||||
int capacity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The texture that will be used for the ingame wand rod
|
|
||||||
*/
|
|
||||||
protected ResourceLocation texture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the actual item that makes up this rod and will be used to generate the wand recipes
|
|
||||||
*/
|
|
||||||
ItemStack item;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class that will be called whenever the wand onUpdate tick is run
|
|
||||||
*/
|
|
||||||
IWandRodOnUpdate onUpdate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does the rod glow in the dark?
|
|
||||||
*/
|
|
||||||
boolean glow;
|
|
||||||
|
|
||||||
public static LinkedHashMap<String,WandRod> rods = new LinkedHashMap<String,WandRod>();
|
|
||||||
|
|
||||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, ResourceLocation texture) {
|
|
||||||
this.setTag(tag);
|
|
||||||
this.capacity = capacity;
|
|
||||||
this.texture = texture;
|
|
||||||
this.item=item;
|
|
||||||
this.setCraftCost(craftCost);
|
|
||||||
rods.put(tag, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate, ResourceLocation texture) {
|
|
||||||
this.setTag(tag);
|
|
||||||
this.capacity = capacity;
|
|
||||||
this.texture = texture;
|
|
||||||
this.item=item;
|
|
||||||
this.setCraftCost(craftCost);
|
|
||||||
rods.put(tag, this);
|
|
||||||
this.onUpdate = onUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost) {
|
|
||||||
this.setTag(tag);
|
|
||||||
this.capacity = capacity;
|
|
||||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
|
|
||||||
this.item=item;
|
|
||||||
this.setCraftCost(craftCost);
|
|
||||||
rods.put(tag, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate) {
|
|
||||||
this.setTag(tag);
|
|
||||||
this.capacity = capacity;
|
|
||||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
|
|
||||||
this.item=item;
|
|
||||||
this.setCraftCost(craftCost);
|
|
||||||
rods.put(tag, this);
|
|
||||||
this.onUpdate = onUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTag() {
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTag(String tag) {
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCapacity() {
|
|
||||||
return capacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCapacity(int capacity) {
|
|
||||||
this.capacity = capacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResourceLocation getTexture() {
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTexture(ResourceLocation texture) {
|
|
||||||
this.texture = texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getItem() {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItem(ItemStack item) {
|
|
||||||
this.item = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCraftCost() {
|
|
||||||
return craftCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftCost(int craftCost) {
|
|
||||||
this.craftCost = craftCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IWandRodOnUpdate getOnUpdate() {
|
|
||||||
return onUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnUpdate(IWandRodOnUpdate onUpdate) {
|
|
||||||
this.onUpdate = onUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGlowing() {
|
|
||||||
return glow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGlowing(boolean hasGlow) {
|
|
||||||
this.glow = hasGlow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The research a player needs to have finished to be able to craft a wand with this rod.
|
|
||||||
*/
|
|
||||||
public String getResearch() {
|
|
||||||
return "ROD_"+getTag();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some examples:
|
|
||||||
// WandRod WAND_ROD_WOOD = new WandRod("wood",25,new ItemStack(Item.stick),1);
|
|
||||||
// WandRod WAND_ROD_BLAZE = new WandRod("blaze",100,new ItemStack(Item.blazeRod),7,new WandRodBlazeOnUpdate());
|
|
||||||
}
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
package thaumcraft.api.wands;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class serves a similar function to IWandable in that it allows wands to interact
|
|
||||||
* with object in the world. In this case it is most useful for adding interaction with non-mod
|
|
||||||
* blocks where you can't control what happens in their code.
|
|
||||||
* Example where it is used is in crafting the thaumonomicon from a bookshelf and the
|
|
||||||
* crucible from a cauldron
|
|
||||||
*
|
|
||||||
* @author azanor
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class WandTriggerRegistry {
|
|
||||||
|
|
||||||
private static HashMap<String,HashMap<List,List>> triggers = new HashMap<String,HashMap<List,List>>();
|
|
||||||
private static final String DEFAULT = "default";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers an action to perform when a casting wand right clicks on a specific block.
|
|
||||||
* A manager class needs to be created that implements IWandTriggerManager.
|
|
||||||
* @param manager
|
|
||||||
* @param event a logical number that you can use to differentiate different events or actions
|
|
||||||
* @param block
|
|
||||||
* @param meta send -1 as a wildcard value for all possible meta values
|
|
||||||
* @param modid a unique identifier. It is best to register your own triggers using your mod id to avoid conflicts with mods that register triggers for the same block
|
|
||||||
*/
|
|
||||||
public static void registerWandBlockTrigger(IWandTriggerManager manager, int event, Block block, int meta, String modid) {
|
|
||||||
if (!triggers.containsKey(modid)) {
|
|
||||||
triggers.put(modid, new HashMap<List,List>());
|
|
||||||
}
|
|
||||||
HashMap<List,List> temp = triggers.get(modid);
|
|
||||||
temp.put(Arrays.asList(block,meta),Arrays.asList(manager,event));
|
|
||||||
triggers.put(modid, temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* for legacy support
|
|
||||||
*/
|
|
||||||
public static void registerWandBlockTrigger(IWandTriggerManager manager, int event, Block block, int meta) {
|
|
||||||
registerWandBlockTrigger(manager, event, block, meta, DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks all trigger registries if one exists for the given block and meta
|
|
||||||
* @param block
|
|
||||||
* @param meta
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean hasTrigger(Block block, int meta) {
|
|
||||||
for (String modid:triggers.keySet()) {
|
|
||||||
HashMap<List,List> temp = triggers.get(modid);
|
|
||||||
if (temp.containsKey(Arrays.asList(block,meta)) ||
|
|
||||||
temp.containsKey(Arrays.asList(block,-1))) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* modid sensitive version
|
|
||||||
*/
|
|
||||||
public static boolean hasTrigger(Block block, int meta, String modid) {
|
|
||||||
if (!triggers.containsKey(modid)) return false;
|
|
||||||
HashMap<List,List> temp = triggers.get(modid);
|
|
||||||
if (temp.containsKey(Arrays.asList(block,meta)) ||
|
|
||||||
temp.containsKey(Arrays.asList(block,-1))) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is called by the onItemUseFirst function in wands.
|
|
||||||
* Parameters and return value functions like you would expect for that function.
|
|
||||||
* @param world
|
|
||||||
* @param wand
|
|
||||||
* @param player
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param side
|
|
||||||
* @param block
|
|
||||||
* @param meta
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
|
|
||||||
int x, int y, int z, int side, Block block, int meta) {
|
|
||||||
|
|
||||||
for (String modid:triggers.keySet()) {
|
|
||||||
HashMap<List,List> temp = triggers.get(modid);
|
|
||||||
List l = temp.get(Arrays.asList(block,meta));
|
|
||||||
if (l==null) l = temp.get(Arrays.asList(block,-1));
|
|
||||||
if (l==null) continue;
|
|
||||||
|
|
||||||
IWandTriggerManager manager = (IWandTriggerManager) l.get(0);
|
|
||||||
int event = (Integer) l.get(1);
|
|
||||||
boolean result = manager.performTrigger(world, wand, player, x, y, z, side, event);
|
|
||||||
if (result) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* modid sensitive version
|
|
||||||
*/
|
|
||||||
public static boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
|
|
||||||
int x, int y, int z, int side, Block block, int meta, String modid) {
|
|
||||||
if (!triggers.containsKey(modid)) return false;
|
|
||||||
HashMap<List,List> temp = triggers.get(modid);
|
|
||||||
List l = temp.get(Arrays.asList(block,meta));
|
|
||||||
if (l==null) l = temp.get(Arrays.asList(block,-1));
|
|
||||||
if (l==null) return false;
|
|
||||||
|
|
||||||
IWandTriggerManager manager = (IWandTriggerManager) l.get(0);
|
|
||||||
int event = (Integer) l.get(1);
|
|
||||||
return manager.performTrigger(world, wand, player, x, y, z, side, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +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
|
|
||||||
@@ -59,7 +59,7 @@ public class Chisel {
|
|||||||
public static final String MOD_ID = "chisel";
|
public static final String MOD_ID = "chisel";
|
||||||
public static final BlockCarvable.SoundType soundTempleFootstep = new BlockCarvable.SoundType("dig.stone", MOD_ID + ":step.templeblock", 1.0f, 1.0f);
|
public static final BlockCarvable.SoundType soundTempleFootstep = new BlockCarvable.SoundType("dig.stone", MOD_ID + ":step.templeblock", 1.0f, 1.0f);
|
||||||
public static final String MOD_NAME = "Chisel";
|
public static final String MOD_NAME = "Chisel";
|
||||||
public static final String VERSION = "@VERSION@";
|
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
public static final BlockCarvable.SoundType soundHolystoneFootstep = new BlockCarvable.SoundType("holystone", 1.0f, 1.0f);
|
public static final BlockCarvable.SoundType soundHolystoneFootstep = new BlockCarvable.SoundType("holystone", 1.0f, 1.0f);
|
||||||
public static final BlockCarvable.SoundType soundMetalFootstep = new BlockCarvable.SoundType("metal", 1.0f, 1.0f);
|
public static final BlockCarvable.SoundType soundMetalFootstep = new BlockCarvable.SoundType("metal", 1.0f, 1.0f);
|
||||||
public static boolean multipartLoaded = false;
|
public static boolean multipartLoaded = false;
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public enum Features {
|
|||||||
void addBlocks() {
|
void addBlocks() {
|
||||||
BlockCarvable arcane = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabModdedChiselBlocks).setStepSound(Block.soundTypeStone);
|
BlockCarvable arcane = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabModdedChiselBlocks).setStepSound(Block.soundTypeStone);
|
||||||
Carving.chisel.addVariation("arcane", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 6, -5);
|
Carving.chisel.addVariation("arcane", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 6, -5);
|
||||||
Carving.chisel.addVariation("arcane", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 7, -4);
|
// Carving.chisel.addVariation("arcane", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 7, -4);
|
||||||
arcane.carverHelper.addVariation("tile.arcane.0.desc", 0, "arcane/moonEngrave");
|
arcane.carverHelper.addVariation("tile.arcane.0.desc", 0, "arcane/moonEngrave");
|
||||||
arcane.carverHelper.addVariation("tile.arcane.1.desc", 1, "arcane/moonGlowAnim");
|
arcane.carverHelper.addVariation("tile.arcane.1.desc", 1, "arcane/moonGlowAnim");
|
||||||
arcane.carverHelper.addVariation("tile.arcane.2.desc", 2, "arcane/arcaneTile");
|
arcane.carverHelper.addVariation("tile.arcane.2.desc", 2, "arcane/arcaneTile");
|
||||||
@@ -461,9 +461,11 @@ public enum Features {
|
|||||||
ItemChisel chisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.IRON).setCreativeTab(ChiselTabs.tabChisel);
|
ItemChisel chisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.IRON).setCreativeTab(ChiselTabs.tabChisel);
|
||||||
ItemChisel diamondChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.DIAMOND).setCreativeTab(ChiselTabs.tabChisel);
|
ItemChisel diamondChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.DIAMOND).setCreativeTab(ChiselTabs.tabChisel);
|
||||||
ItemChisel obsidianChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.OBSIDIAN).setCreativeTab(ChiselTabs.tabChisel);
|
ItemChisel obsidianChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.OBSIDIAN).setCreativeTab(ChiselTabs.tabChisel);
|
||||||
|
ItemChisel netherStarChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.NETHERSTAR).setCreativeTab(ChiselTabs.tabChisel);
|
||||||
GameRegistry.registerItem(chisel, "chisel");
|
GameRegistry.registerItem(chisel, "chisel");
|
||||||
GameRegistry.registerItem(diamondChisel, "diamondChisel");
|
GameRegistry.registerItem(diamondChisel, "diamondChisel");
|
||||||
GameRegistry.registerItem(obsidianChisel, "obsidianChisel");
|
GameRegistry.registerItem(obsidianChisel, "obsidianChisel");
|
||||||
|
GameRegistry.registerItem(netherStarChisel, "netherStarChisel");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -472,10 +474,12 @@ public enum Features {
|
|||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.chisel), " YY", " YY", "X ", 'X', "stickWood", 'Y', "ingotIron"));
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.chisel), " YY", " YY", "X ", 'X', "stickWood", 'Y', "ingotIron"));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.diamondChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', "gemDiamond"));
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.diamondChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', "gemDiamond"));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.obsidianChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', Blocks.obsidian));
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.obsidianChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', Blocks.obsidian));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.netherStarChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', "netherStar"));
|
||||||
} else {
|
} else {
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.chisel), " Y", "X ", 'X', "stickWood", 'Y', "ingotIron"));
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.chisel), " Y", "X ", 'X', "stickWood", 'Y', "ingotIron"));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.diamondChisel), " Y", "X ", 'X', "stickWood", 'Y', "gemDiamond"));
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.diamondChisel), " Y", "X ", 'X', "stickWood", 'Y', "gemDiamond"));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.obsidianChisel), " Y", "X ", 'X', "stickWood", 'Y', Blocks.obsidian));
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.obsidianChisel), " Y", "X ", 'X', "stickWood", 'Y', Blocks.obsidian));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.netherStarChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', "netherStar"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -109,7 +109,9 @@ public class BlockPresent extends Block implements ICarvable {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitX, float hitY, float hitZ, float p_149727_9_) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitX, float hitY, float hitZ, float p_149727_9_) {
|
||||||
if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
||||||
player.openGui(Chisel.instance, 2, world, x, y, z);
|
if (!world.isRemote) {
|
||||||
|
player.openGui(Chisel.instance, 2, world, x, y, z);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import team.chisel.client.gui.widgets.GuiButtonChiselMode;
|
import team.chisel.client.gui.widgets.GuiButtonChiselMode;
|
||||||
import team.chisel.inventory.ContainerChisel;
|
import team.chisel.inventory.ContainerChisel;
|
||||||
@@ -28,116 +29,149 @@ import static team.chisel.Chisel.MOD_ID;
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiChisel extends GuiContainer {
|
public class GuiChisel extends GuiContainer {
|
||||||
|
|
||||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(MOD_ID, "textures/chisel2GuiScroll.png");
|
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(MOD_ID, "textures/chisel2GuiScroll.png");
|
||||||
public static final int TEXTURE_WIDTH = 266;
|
public static final int TEXTURE_WIDTH = 266;
|
||||||
public static final int TEXTURE_HEIGHT = 250;
|
public static final int TEXTURE_HEIGHT = 250;
|
||||||
public static final int GUI_WIDTH = 266;
|
public static final int GUI_WIDTH = 266;
|
||||||
public static final int GUI_HEIGHT = 202;
|
public static final int GUI_HEIGHT = 202;
|
||||||
public static final int CHISEL_INPUT_SIZE = 48;
|
public static final int CHISEL_INPUT_SIZE = 48;
|
||||||
private EntityPlayer player;
|
private EntityPlayer player;
|
||||||
private ContainerChisel container;
|
private ContainerChisel container;
|
||||||
private IChiselMode currentMode;
|
private IChiselMode currentMode;
|
||||||
|
private GuiScrollbar scrollBar;
|
||||||
|
private InventoryChiselSelection menu;
|
||||||
|
|
||||||
public GuiChisel(InventoryPlayer iinventory, InventoryChiselSelection menu) {
|
public GuiChisel(InventoryPlayer iinventory, InventoryChiselSelection menu) {
|
||||||
super(new ContainerChisel(iinventory, menu));
|
super(new ContainerChisel(iinventory, menu));
|
||||||
player = iinventory.player;
|
scrollBar = new GuiScrollbar();
|
||||||
xSize = GUI_WIDTH;
|
this.menu = menu;
|
||||||
ySize = GUI_HEIGHT;
|
player = iinventory.player;
|
||||||
|
xSize = GUI_WIDTH;
|
||||||
|
ySize = GUI_HEIGHT;
|
||||||
|
|
||||||
container = (ContainerChisel) inventorySlots;
|
container = (ContainerChisel) inventorySlots;
|
||||||
}
|
scrollBar.setContainerChisel(container);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed() {
|
public void onGuiClosed() {
|
||||||
super.onGuiClosed();
|
super.onGuiClosed();
|
||||||
inventorySlots.onContainerClosed(player);
|
inventorySlots.onContainerClosed(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
super.initGui();
|
super.initGui();
|
||||||
currentMode = General.getChiselMode(container.chisel);
|
currentMode = General.getChiselMode(container.chisel);
|
||||||
|
|
||||||
if (showMode()) {
|
if (showMode()) {
|
||||||
buttonList.add(new GuiButtonChiselMode(0, guiLeft + 12, guiTop + 132, this));
|
buttonList.add(new GuiButtonChiselMode(0, guiLeft + 12, guiTop + 132, this));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
scrollBar.setLeft(246);
|
||||||
public void updateScreen() {
|
scrollBar.setTop(8);
|
||||||
super.updateScreen();
|
scrollBar.setScrollHeight(106);
|
||||||
final ItemStack held = player.getCurrentEquippedItem();
|
}
|
||||||
if (held == null || !(held.getItem() instanceof IChiselItem)) {
|
|
||||||
mc.displayGuiScreen(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean showMode() {
|
@Override
|
||||||
return container.chisel != null
|
public void updateScreen() {
|
||||||
&& container.chisel.getItem() instanceof IChiselItem
|
super.updateScreen();
|
||||||
&& ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel);
|
final ItemStack held = player.getCurrentEquippedItem();
|
||||||
}
|
if (held == null || !(held.getItem() instanceof IChiselItem)) {
|
||||||
|
mc.displayGuiScreen(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
private boolean showMode() {
|
||||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
return container.chisel != null
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
&& container.chisel.getItem() instanceof IChiselItem
|
||||||
|
&& ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel);
|
||||||
|
}
|
||||||
|
|
||||||
final String titleText = I18n.format(container.inventory.getInventoryName() + ".title");
|
@Override
|
||||||
fontRendererObj.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
|
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
if (showMode()) {
|
final String titleText = I18n.format(container.inventory.getInventoryName() + ".title");
|
||||||
final String modeText = I18n.format(container.inventory.getInventoryName() + ".mode");
|
fontRendererObj.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
|
||||||
fontRendererObj.drawString(modeText, 12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2, 122, 0x404040);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (showMode()) {
|
||||||
protected void drawGuiContainerBackgroundLayer(final float partialTicks, final int mouseX, final int mouseY) {
|
final String modeText = I18n.format(container.inventory.getInventoryName() + ".mode");
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
fontRendererObj.drawString(modeText, 12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2, 122, 0x404040);
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
}
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
scrollBar.draw(this);
|
||||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
}
|
||||||
func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
|
||||||
|
|
||||||
Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
|
@Override
|
||||||
if (main.getStack() == null) {
|
protected void drawGuiContainerBackgroundLayer(final float partialTicks, final int mouseX, final int mouseY) {
|
||||||
func_146110_a(guiLeft + 8, guiTop + 8, 0, GUI_HEIGHT, CHISEL_INPUT_SIZE, CHISEL_INPUT_SIZE, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||||
protected void actionPerformed(final GuiButton button) {
|
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||||
if (button.id == 0) {
|
func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||||
if (container.chisel != null && container.chisel.getItem() instanceof IAdvancedChisel) {
|
|
||||||
final IAdvancedChisel item = (IAdvancedChisel) container.chisel.getItem();
|
|
||||||
currentMode = item.getNextMode(container.chisel, currentMode);
|
|
||||||
} else {
|
|
||||||
currentMode = ChiselMode.next(currentMode);
|
|
||||||
}
|
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageChiselMode(currentMode));
|
|
||||||
}
|
|
||||||
super.actionPerformed(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
|
||||||
protected void func_146977_a(final Slot slot) {
|
if (main.getStack() == null) {
|
||||||
if (slot instanceof SlotChiselInput) {
|
func_146110_a(guiLeft + 8, guiTop + 8, 0, GUI_HEIGHT, CHISEL_INPUT_SIZE, CHISEL_INPUT_SIZE, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||||
GL11.glPushMatrix();
|
}
|
||||||
GL11.glScalef(2, 2, 2);
|
}
|
||||||
slot.xDisplayPosition -= 16;
|
|
||||||
slot.yDisplayPosition -= 16;
|
|
||||||
super.func_146977_a(slot);
|
|
||||||
slot.xDisplayPosition += 16;
|
|
||||||
slot.yDisplayPosition += 16;
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
} else {
|
|
||||||
super.func_146977_a(slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IChiselMode getCurrentMode() {
|
@Override
|
||||||
return currentMode;
|
protected void actionPerformed(final GuiButton button) {
|
||||||
}
|
if (button.id == 0) {
|
||||||
|
if (container.chisel != null && container.chisel.getItem() instanceof IAdvancedChisel) {
|
||||||
|
final IAdvancedChisel item = (IAdvancedChisel) container.chisel.getItem();
|
||||||
|
currentMode = item.getNextMode(container.chisel, currentMode);
|
||||||
|
} else {
|
||||||
|
currentMode = ChiselMode.next(currentMode);
|
||||||
|
}
|
||||||
|
PacketHandler.INSTANCE.sendToServer(new MessageChiselMode(currentMode));
|
||||||
|
}
|
||||||
|
super.actionPerformed(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void func_146977_a(final Slot slot) {
|
||||||
|
if (slot instanceof SlotChiselInput) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glScalef(2, 2, 2);
|
||||||
|
slot.xDisplayPosition -= 16;
|
||||||
|
slot.yDisplayPosition -= 16;
|
||||||
|
super.func_146977_a(slot);
|
||||||
|
slot.xDisplayPosition += 16;
|
||||||
|
slot.yDisplayPosition += 16;
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
} else {
|
||||||
|
super.func_146977_a(slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClickMove(int x, int y, int c, long d) {
|
||||||
|
scrollBar.click(x - guiLeft, y - guiTop);
|
||||||
|
super.mouseClickMove(x, y, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||||
|
scrollBar.click(xCoord - guiLeft, yCoord - guiTop);
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMouseInput() {
|
||||||
|
super.handleMouseInput();
|
||||||
|
|
||||||
|
int i = Mouse.getEventDWheel();
|
||||||
|
if (i != 0 && scrollBar != null) {
|
||||||
|
scrollBar.wheel(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IChiselMode getCurrentMode() {
|
||||||
|
return currentMode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package team.chisel.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import team.chisel.inventory.ContainerChisel;
|
||||||
|
import team.chisel.network.PacketHandler;
|
||||||
|
import team.chisel.network.message.MessageScrollUpdate;
|
||||||
|
|
||||||
|
public class GuiScrollbar {
|
||||||
|
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation("minecraft", "textures/gui/container/creative_inventory/tabs.png");
|
||||||
|
|
||||||
|
private int displayX = 0;
|
||||||
|
private int displayY = 0;
|
||||||
|
private int width = 12;
|
||||||
|
private int height = 15;
|
||||||
|
|
||||||
|
private int rowSize = 10;
|
||||||
|
private int rowsOnPage = 6;
|
||||||
|
|
||||||
|
private int scrollHeight = height;
|
||||||
|
private ContainerChisel container;
|
||||||
|
|
||||||
|
public void draw(GuiChisel g) {
|
||||||
|
// chisel2GuiScroll scroll button texture coordinates work strange (maybe because of alignment) so taking vanilla one
|
||||||
|
g.mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||||
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
|
if (getMaxScroll() == 0) {
|
||||||
|
g.drawTexturedModalRect(displayX, displayY, 232 + width, 0, width, height);
|
||||||
|
} else {
|
||||||
|
int offset = getCurrentScroll() * (scrollHeight - height) / getMaxScroll();
|
||||||
|
g.drawTexturedModalRect(displayX, offset + displayY, 232, 0, width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiScrollbar setScrollHeight(int scrollHeight) {
|
||||||
|
this.scrollHeight = scrollHeight;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiScrollbar setLeft(int displayX) {
|
||||||
|
this.displayX = displayX;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiScrollbar setTop(int displayY) {
|
||||||
|
this.displayY = displayY;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getMaxScroll() {
|
||||||
|
int maxScroll = (container.inventory.getMaxScroll() + rowSize - 1) / rowSize - rowsOnPage;
|
||||||
|
|
||||||
|
if (maxScroll <= 0) {
|
||||||
|
maxScroll = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxScroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentScroll() {
|
||||||
|
return container.inventory.getCurrentScroll() / rowSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCurrentScroll(int scroll) {
|
||||||
|
container.inventory.setCurrentScroll(scroll * rowSize);
|
||||||
|
PacketHandler.INSTANCE.sendToServer(new MessageScrollUpdate(scroll * rowSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int applyRange(int scroll) {
|
||||||
|
return Math.max(Math.min(scroll, getMaxScroll()), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void click(int x, int y) {
|
||||||
|
if (getMaxScroll() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x > displayX && x <= displayX + width) {
|
||||||
|
if (y > displayY && y <= displayY + scrollHeight) {
|
||||||
|
int currentScroll = (y - displayY - height / 2);
|
||||||
|
currentScroll = Math.round(1.0f * currentScroll * getMaxScroll() / (scrollHeight - height));
|
||||||
|
setCurrentScroll(applyRange(currentScroll));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wheel(int delta) {
|
||||||
|
setCurrentScroll(applyRange(getCurrentScroll() + Math.max(Math.min(-delta, 1), -1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContainerChisel(ContainerChisel container) {
|
||||||
|
this.container = container;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,9 +5,12 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import codechicken.nei.api.GuiInfo;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import team.chisel.carving.Carving;
|
import team.chisel.carving.Carving;
|
||||||
|
import team.chisel.client.gui.GuiChisel;
|
||||||
import team.chisel.utils.RecipeUtil;
|
import team.chisel.utils.RecipeUtil;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||||
@@ -86,6 +89,10 @@ public class Compatibility {
|
|||||||
if (Loader.isModLoaded("EE3")) {
|
if (Loader.isModLoaded("EE3")) {
|
||||||
loadEE3Values();
|
loadEE3Values();
|
||||||
}
|
}
|
||||||
|
if (Loader.isModLoaded("NotEnoughItems") && event.getSide() == Side.CLIENT) {
|
||||||
|
// disable chiseling by scrolling over itemstack
|
||||||
|
GuiInfo.customSlotGuis.add(GuiChisel.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package team.chisel.config;
|
package team.chisel.config;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.item.ItemDye;
|
import net.minecraft.item.ItemDye;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
@@ -44,11 +46,13 @@ public class Configurations {
|
|||||||
public static int ironChiselMaxDamage;
|
public static int ironChiselMaxDamage;
|
||||||
public static int diamondChiselMaxDamage;
|
public static int diamondChiselMaxDamage;
|
||||||
public static int obsidianChiselMaxDamage;
|
public static int obsidianChiselMaxDamage;
|
||||||
|
public static int netherStarChiselMaxDamage;
|
||||||
public static boolean ironChiselCanLeftClick;
|
public static boolean ironChiselCanLeftClick;
|
||||||
public static boolean ironChiselHasModes;
|
public static boolean ironChiselHasModes;
|
||||||
public static int ironChiselAttackDamage;
|
public static int ironChiselAttackDamage;
|
||||||
public static int diamondChiselAttackDamage;
|
public static int diamondChiselAttackDamage;
|
||||||
public static int obsidianChiselAttackDamage;
|
public static int obsidianChiselAttackDamage;
|
||||||
|
public static int netherStarChiselAttackDamage;
|
||||||
public static boolean allowChiselCrossColors;
|
public static boolean allowChiselCrossColors;
|
||||||
|
|
||||||
public static boolean useRoadLineTool;
|
public static boolean useRoadLineTool;
|
||||||
@@ -59,6 +63,8 @@ public class Configurations {
|
|||||||
|
|
||||||
public static boolean fullBlockConcrete;
|
public static boolean fullBlockConcrete;
|
||||||
|
|
||||||
|
public static Map<String, Boolean> features = new HashMap<>();
|
||||||
|
|
||||||
public static boolean refreshConfig() {
|
public static boolean refreshConfig() {
|
||||||
|
|
||||||
String category;
|
String category;
|
||||||
@@ -102,6 +108,7 @@ public class Configurations {
|
|||||||
ironChiselMaxDamage = config.getInt("ironChiselMaxDamage", category, 500, 1, Short.MAX_VALUE, "The max damage of the standard iron chisel.");
|
ironChiselMaxDamage = config.getInt("ironChiselMaxDamage", category, 500, 1, Short.MAX_VALUE, "The max damage of the standard iron chisel.");
|
||||||
diamondChiselMaxDamage = config.getInt("diamondChiselMaxDamage", category, 5000, 1, Short.MAX_VALUE, "The max damage of the diamond chisel.");
|
diamondChiselMaxDamage = config.getInt("diamondChiselMaxDamage", category, 5000, 1, Short.MAX_VALUE, "The max damage of the diamond chisel.");
|
||||||
obsidianChiselMaxDamage = config.getInt("obsidianChiselMaxDamage", category, 2500, 1, Short.MAX_VALUE, "The max damage of the obsidian chisel.");
|
obsidianChiselMaxDamage = config.getInt("obsidianChiselMaxDamage", category, 2500, 1, Short.MAX_VALUE, "The max damage of the obsidian chisel.");
|
||||||
|
netherStarChiselMaxDamage = config.getInt("netherStarChiselMaxDamage", category, 32767, 1, Short.MAX_VALUE, "The max damage of the nether star chisel.");
|
||||||
ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean();
|
ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean();
|
||||||
ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean();
|
ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean();
|
||||||
allowChiselCrossColors = config.get(category, "allowChiselCrossColors", true, "Should someone be able to chisel something into a different color.").getBoolean();
|
allowChiselCrossColors = config.get(category, "allowChiselCrossColors", true, "Should someone be able to chisel something into a different color.").getBoolean();
|
||||||
@@ -112,6 +119,8 @@ public class Configurations {
|
|||||||
"The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt();
|
"The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt();
|
||||||
obsidianChiselAttackDamage = config.get(category, "obsidianChiselAttackDamage", 4,
|
obsidianChiselAttackDamage = config.get(category, "obsidianChiselAttackDamage", 4,
|
||||||
"The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.").getInt();
|
"The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.").getInt();
|
||||||
|
netherStarChiselAttackDamage = config.get(category, "netherStarChiselAttackDamage", 6,
|
||||||
|
"The extra attack damage points (in half hearts) that the nether star chisel inflicts when it is used to attack an entity.").getInt();
|
||||||
|
|
||||||
/* block */
|
/* block */
|
||||||
category = "block";
|
category = "block";
|
||||||
@@ -137,6 +146,11 @@ public class Configurations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* features */
|
||||||
|
for (Features feature : Features.values()) {
|
||||||
|
features.put(featureName(feature), config.get("features", featureName(feature), true).getBoolean(true));
|
||||||
|
}
|
||||||
|
|
||||||
if (config.hasChanged()) {
|
if (config.hasChanged()) {
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
@@ -144,7 +158,7 @@ public class Configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean featureEnabled(Features feature) {
|
public static boolean featureEnabled(Features feature) {
|
||||||
return config.get("features", featureName(feature), true).getBoolean(true) && refreshConfig();
|
return features.getOrDefault(featureName(feature), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public final class ChiselItems {
|
|||||||
public static final ItemChisel chisel = null;
|
public static final ItemChisel chisel = null;
|
||||||
public static final ItemChisel diamondChisel = null;
|
public static final ItemChisel diamondChisel = null;
|
||||||
public static final ItemChisel obsidianChisel = null;
|
public static final ItemChisel obsidianChisel = null;
|
||||||
|
public static final ItemChisel netherStarChisel = null;
|
||||||
public static final ItemCloudInABottle cloudinabottle = null;
|
public static final ItemCloudInABottle cloudinabottle = null;
|
||||||
public static final ItemBallOMoss ballomoss = null;
|
public static final ItemBallOMoss ballomoss = null;
|
||||||
public static final ItemSmashingRock smashingrock = null;
|
public static final ItemSmashingRock smashingrock = null;
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ import net.minecraft.item.ItemTool;
|
|||||||
|
|
||||||
public class InventoryChiselSelection implements IInventory {
|
public class InventoryChiselSelection implements IInventory {
|
||||||
|
|
||||||
ItemStack chisel = null;
|
ItemStack chisel;
|
||||||
public final static int normalSlots = 60;
|
public final static int normalSlots = 60;
|
||||||
public int activeVariations = 0;
|
|
||||||
ContainerChisel container;
|
ContainerChisel container;
|
||||||
ItemStack[] inventory;
|
ItemStack[] inventory;
|
||||||
|
private int currentScroll = 0;
|
||||||
|
private int maxScroll = 0;
|
||||||
|
|
||||||
public InventoryChiselSelection(ItemStack c) {
|
public InventoryChiselSelection(ItemStack c) {
|
||||||
super();
|
super();
|
||||||
@@ -28,6 +29,21 @@ public class InventoryChiselSelection implements IInventory {
|
|||||||
chisel = c;
|
chisel = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCurrentScroll(int currentScroll) {
|
||||||
|
if (this.currentScroll != currentScroll) {
|
||||||
|
this.currentScroll = currentScroll;
|
||||||
|
updateItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentScroll() {
|
||||||
|
return currentScroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxScroll() {
|
||||||
|
return maxScroll;
|
||||||
|
}
|
||||||
|
|
||||||
public void onInventoryUpdate(int slot) {
|
public void onInventoryUpdate(int slot) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -95,10 +111,10 @@ public class InventoryChiselSelection implements IInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearItems() {
|
public void clearItems() {
|
||||||
activeVariations = 0;
|
|
||||||
for (int i = 0; i < normalSlots; i++) {
|
for (int i = 0; i < normalSlots; i++) {
|
||||||
inventory[i] = null;
|
inventory[i] = null;
|
||||||
}
|
}
|
||||||
|
maxScroll = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getStackInSpecialSlot() {
|
public ItemStack getStackInSpecialSlot() {
|
||||||
@@ -125,11 +141,11 @@ public class InventoryChiselSelection implements IInventory {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
List<ItemStack> list = container.carving.getItemsForChiseling(chiseledItem);
|
List<ItemStack> list = container.carving.getItemsForChiseling(chiseledItem);
|
||||||
|
maxScroll = list.size();
|
||||||
activeVariations = 0;
|
int activeVariations = 0;
|
||||||
while (activeVariations < normalSlots && activeVariations < list.size()) {
|
while (activeVariations < normalSlots && activeVariations + currentScroll < list.size()) {
|
||||||
if (Block.blockRegistry.getNameForObject(Block.getBlockFromItem(list.get(activeVariations).getItem())) != null) {
|
if (Block.blockRegistry.getNameForObject(Block.getBlockFromItem(list.get(activeVariations + currentScroll).getItem())) != null) {
|
||||||
inventory[activeVariations] = list.get(activeVariations);
|
inventory[activeVariations] = list.get(activeVariations + currentScroll);
|
||||||
activeVariations++;
|
activeVariations++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,8 +167,11 @@ public class InventoryChiselSelection implements IInventory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
inventory[slot] = stack;
|
// we do not want external chisel variant updates
|
||||||
updateInventoryState(slot);
|
if (slot == normalSlots) {
|
||||||
|
inventory[slot] = stack;
|
||||||
|
updateInventoryState(slot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -172,5 +191,4 @@ public class InventoryChiselSelection implements IInventory {
|
|||||||
|
|
||||||
return !(stack != null && (stack.getItem() instanceof ItemChisel)) && i == normalSlots;
|
return !(stack != null && (stack.getItem() instanceof ItemChisel)) && i == normalSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,7 @@ public class SlotChiselInput extends Slot {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
super.onSlotChanged();
|
super.onSlotChanged();
|
||||||
|
selInventory.setCurrentScroll(0);
|
||||||
selInventory.updateItems();
|
selInventory.updateItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,11 @@ public final class ChiselController {
|
|||||||
ItemStack held = event.entityPlayer.getCurrentEquippedItem();
|
ItemStack held = event.entityPlayer.getCurrentEquippedItem();
|
||||||
int slot = event.entityPlayer.inventory.currentItem;
|
int slot = event.entityPlayer.inventory.currentItem;
|
||||||
|
|
||||||
|
//Prevents a crash when activated from a Battlegear slot.
|
||||||
|
if(slot > 8 || slot < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (held == null || !(held.getItem() instanceof IChiselItem)) {
|
if (held == null || !(held.getItem() instanceof IChiselItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ public class ItemChisel extends Item implements IChiselItem {
|
|||||||
public enum ChiselType {
|
public enum ChiselType {
|
||||||
IRON(Configurations.ironChiselMaxDamage, Configurations.ironChiselAttackDamage),
|
IRON(Configurations.ironChiselMaxDamage, Configurations.ironChiselAttackDamage),
|
||||||
DIAMOND(Configurations.diamondChiselMaxDamage, Configurations.diamondChiselAttackDamage),
|
DIAMOND(Configurations.diamondChiselMaxDamage, Configurations.diamondChiselAttackDamage),
|
||||||
OBSIDIAN(Configurations.obsidianChiselMaxDamage, Configurations.obsidianChiselAttackDamage);
|
OBSIDIAN(Configurations.obsidianChiselMaxDamage, Configurations.obsidianChiselAttackDamage),
|
||||||
|
NETHERSTAR(Configurations.netherStarChiselMaxDamage, Configurations.netherStarChiselAttackDamage);
|
||||||
|
|
||||||
final int maxDamage;
|
final int maxDamage;
|
||||||
final int attackDamage;
|
final int attackDamage;
|
||||||
@@ -74,8 +75,9 @@ public class ItemChisel extends Item implements IChiselItem {
|
|||||||
return repairMaterial.getItem().equals(Items.iron_ingot);
|
return repairMaterial.getItem().equals(Items.iron_ingot);
|
||||||
case OBSIDIAN:
|
case OBSIDIAN:
|
||||||
return repairMaterial.getItem().equals(Item.getItemFromBlock(Blocks.obsidian));
|
return repairMaterial.getItem().equals(Item.getItemFromBlock(Blocks.obsidian));
|
||||||
|
case NETHERSTAR:
|
||||||
|
return repairMaterial.getItem().equals(Items.nether_star);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,11 +95,11 @@ public class ItemChisel extends Item implements IChiselItem {
|
|||||||
String lc2 = I18n.format(base + "lc2");
|
String lc2 = I18n.format(base + "lc2");
|
||||||
String modes = I18n.format(base + "modes");
|
String modes = I18n.format(base + "modes");
|
||||||
list.add(gui);
|
list.add(gui);
|
||||||
if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselCanLeftClick) {
|
if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || type == ChiselType.NETHERSTAR || Configurations.ironChiselCanLeftClick) {
|
||||||
list.add(lc1);
|
list.add(lc1);
|
||||||
list.add(lc2);
|
list.add(lc2);
|
||||||
}
|
}
|
||||||
if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselHasModes) {
|
if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || type == ChiselType.NETHERSTAR || Configurations.ironChiselHasModes) {
|
||||||
list.add("");
|
list.add("");
|
||||||
list.add(modes);
|
list.add(modes);
|
||||||
}
|
}
|
||||||
@@ -139,11 +141,11 @@ public class ItemChisel extends Item implements IChiselItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata) {
|
public boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata) {
|
||||||
return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselCanLeftClick;
|
return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || type == ChiselType.NETHERSTAR || Configurations.ironChiselCanLeftClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasModes(ItemStack chisel) {
|
public boolean hasModes(ItemStack chisel) {
|
||||||
return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselHasModes;
|
return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || type == ChiselType.NETHERSTAR || Configurations.ironChiselHasModes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import team.chisel.network.message.MessageAutoChisel;
|
|||||||
import team.chisel.network.message.MessageChiselMode;
|
import team.chisel.network.message.MessageChiselMode;
|
||||||
import team.chisel.network.message.MessageChiselSound;
|
import team.chisel.network.message.MessageChiselSound;
|
||||||
import team.chisel.network.message.MessagePresentConnect;
|
import team.chisel.network.message.MessagePresentConnect;
|
||||||
|
import team.chisel.network.message.MessageScrollUpdate;
|
||||||
import team.chisel.network.message.MessageSlotUpdate;
|
import team.chisel.network.message.MessageSlotUpdate;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@@ -21,5 +22,6 @@ public class PacketHandler {
|
|||||||
INSTANCE.registerMessage(MessageAutoChisel.Handler.class, MessageAutoChisel.class, id++, Side.CLIENT);
|
INSTANCE.registerMessage(MessageAutoChisel.Handler.class, MessageAutoChisel.class, id++, Side.CLIENT);
|
||||||
INSTANCE.registerMessage(MessageChiselMode.Handler.class, MessageChiselMode.class, id++, Side.SERVER);
|
INSTANCE.registerMessage(MessageChiselMode.Handler.class, MessageChiselMode.class, id++, Side.SERVER);
|
||||||
INSTANCE.registerMessage(MessagePresentConnect.Handler.class, MessagePresentConnect.class, id++, Side.CLIENT);
|
INSTANCE.registerMessage(MessagePresentConnect.Handler.class, MessagePresentConnect.class, id++, Side.CLIENT);
|
||||||
|
INSTANCE.registerMessage(MessageScrollUpdate.Handler.class, MessageScrollUpdate.class, id++, Side.SERVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package team.chisel.network.message;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import team.chisel.inventory.ContainerChisel;
|
||||||
|
|
||||||
|
public class MessageScrollUpdate implements IMessage {
|
||||||
|
|
||||||
|
private int currentScroll;
|
||||||
|
|
||||||
|
public MessageScrollUpdate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageScrollUpdate(int scroll) {
|
||||||
|
currentScroll = scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf) {
|
||||||
|
currentScroll = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf) {
|
||||||
|
buf.writeInt(currentScroll);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Handler implements IMessageHandler<MessageScrollUpdate, IMessage> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(MessageScrollUpdate message, MessageContext ctx) {
|
||||||
|
Container container = ctx.getServerHandler().playerEntity.openContainer;
|
||||||
|
if (container instanceof ContainerChisel) {
|
||||||
|
((ContainerChisel) container).inventory.setCurrentScroll(message.currentScroll);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,14 @@ tile.shingles.5.desc=Schwarze große Vierecke
|
|||||||
tile.chisel.valentines.name=Valentinsblock
|
tile.chisel.valentines.name=Valentinsblock
|
||||||
tile.valentines.0.desc=Valentinsziegel
|
tile.valentines.0.desc=Valentinsziegel
|
||||||
tile.valentines.1.desc=Wenn es spricht, würde ich es nicht berühren!
|
tile.valentines.1.desc=Wenn es spricht, würde ich es nicht berühren!
|
||||||
|
tile.valentines.2.desc=
|
||||||
|
tile.valentines.3.desc=
|
||||||
|
tile.valentines.4.desc=
|
||||||
|
tile.valentines.5.desc=
|
||||||
|
tile.valentines.6.desc=
|
||||||
|
tile.valentines.7.desc=
|
||||||
|
tile.valentines.8.desc=
|
||||||
|
tile.valentines.9.desc=
|
||||||
|
|
||||||
# AntiBlocks
|
# AntiBlocks
|
||||||
tile.chisel.antiBlock.name=Antiblock
|
tile.chisel.antiBlock.name=Antiblock
|
||||||
@@ -720,6 +728,7 @@ tile.glass2.0.desc=Asymmetrisches Bleiglas
|
|||||||
|
|
||||||
# Sandstone
|
# Sandstone
|
||||||
tile.chisel.sandstone.name=Sandstein
|
tile.chisel.sandstone.name=Sandstein
|
||||||
|
tile.chisel.sandstone2.name=Sandstein
|
||||||
|
|
||||||
tile.sandstone.0.desc=Sandstein mit Glyphen
|
tile.sandstone.0.desc=Sandstein mit Glyphen
|
||||||
tile.sandstone.1.desc=Sandpflaster
|
tile.sandstone.1.desc=Sandpflaster
|
||||||
@@ -738,6 +747,8 @@ tile.sandstone.12.desc=Sandsteinblock
|
|||||||
tile.sandstone.13.desc=Schmaler Sandsteinblock
|
tile.sandstone.13.desc=Schmaler Sandsteinblock
|
||||||
tile.sandstone.14.desc=Sandsteinmosaik
|
tile.sandstone.14.desc=Sandsteinmosaik
|
||||||
tile.sandstone.15.desc=Gestapelte Sandsteinfliesen
|
tile.sandstone.15.desc=Gestapelte Sandsteinfliesen
|
||||||
|
tile.sandstone.16.desc=Sandsteinziegel
|
||||||
|
tile.sandstone.17.desc=
|
||||||
|
|
||||||
# Sandstone scribbles
|
# Sandstone scribbles
|
||||||
tile.chisel.sandstone_scribbles.name=Sandstein mit Gekritzel
|
tile.chisel.sandstone_scribbles.name=Sandstein mit Gekritzel
|
||||||
|
|||||||
@@ -56,6 +56,14 @@ tile.shingles.5.desc=Black Big Squares
|
|||||||
tile.chisel.valentines.name=Valentines Block
|
tile.chisel.valentines.name=Valentines Block
|
||||||
tile.valentines.0.desc=Valentines Bricks
|
tile.valentines.0.desc=Valentines Bricks
|
||||||
tile.valentines.1.desc=If it speaks, I wouldn't touch it
|
tile.valentines.1.desc=If it speaks, I wouldn't touch it
|
||||||
|
tile.valentines.2.desc=
|
||||||
|
tile.valentines.3.desc=
|
||||||
|
tile.valentines.4.desc=
|
||||||
|
tile.valentines.5.desc=
|
||||||
|
tile.valentines.6.desc=
|
||||||
|
tile.valentines.7.desc=
|
||||||
|
tile.valentines.8.desc=
|
||||||
|
tile.valentines.9.desc=
|
||||||
|
|
||||||
# AntiBlocks
|
# AntiBlocks
|
||||||
tile.chisel.antiBlock.name=Anti Block
|
tile.chisel.antiBlock.name=Anti Block
|
||||||
@@ -724,6 +732,7 @@ tile.glass2.0.desc=Asymmetrical Leaded Glass
|
|||||||
|
|
||||||
# Sandstone
|
# Sandstone
|
||||||
tile.chisel.sandstone.name=Sandstone
|
tile.chisel.sandstone.name=Sandstone
|
||||||
|
tile.chisel.sandstone2.name=Sandstone
|
||||||
|
|
||||||
tile.sandstone.0.desc=Sandstone Glyphs
|
tile.sandstone.0.desc=Sandstone Glyphs
|
||||||
tile.sandstone.1.desc=Sandcobble
|
tile.sandstone.1.desc=Sandcobble
|
||||||
@@ -742,6 +751,8 @@ tile.sandstone.12.desc=Sandstone Block
|
|||||||
tile.sandstone.13.desc=Small Sandstone Blocks
|
tile.sandstone.13.desc=Small Sandstone Blocks
|
||||||
tile.sandstone.14.desc=Sandstone Mosaic
|
tile.sandstone.14.desc=Sandstone Mosaic
|
||||||
tile.sandstone.15.desc=Stacked Sandstone Tiles
|
tile.sandstone.15.desc=Stacked Sandstone Tiles
|
||||||
|
tile.sandstone.16.desc=Sandstone Bricks
|
||||||
|
tile.sandstone.17.desc=
|
||||||
|
|
||||||
# Sandstone scribbles
|
# Sandstone scribbles
|
||||||
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
|
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
|
||||||
|
|||||||
@@ -57,6 +57,14 @@ tile.shingles.5.desc=Black Big Squares
|
|||||||
tile.chisel.valentines.name=Valentines Block
|
tile.chisel.valentines.name=Valentines Block
|
||||||
tile.valentines.0.desc=Valentines Bricks
|
tile.valentines.0.desc=Valentines Bricks
|
||||||
tile.valentines.1.desc=If it speaks, I wouldn't touch it
|
tile.valentines.1.desc=If it speaks, I wouldn't touch it
|
||||||
|
tile.valentines.2.desc=
|
||||||
|
tile.valentines.3.desc=
|
||||||
|
tile.valentines.4.desc=
|
||||||
|
tile.valentines.5.desc=
|
||||||
|
tile.valentines.6.desc=
|
||||||
|
tile.valentines.7.desc=
|
||||||
|
tile.valentines.8.desc=
|
||||||
|
tile.valentines.9.desc=
|
||||||
|
|
||||||
# AntiBlocks
|
# AntiBlocks
|
||||||
tile.chisel.antiBlock.name=Anti Block
|
tile.chisel.antiBlock.name=Anti Block
|
||||||
@@ -722,6 +730,7 @@ tile.glass2.0.desc=Asymmetrical Leaded Glass
|
|||||||
|
|
||||||
# Sandstone
|
# Sandstone
|
||||||
tile.chisel.sandstone.name=Sandstone
|
tile.chisel.sandstone.name=Sandstone
|
||||||
|
tile.chisel.sandstone2.name=Sandstone
|
||||||
|
|
||||||
tile.sandstone.0.desc=Sandstone Glyphs
|
tile.sandstone.0.desc=Sandstone Glyphs
|
||||||
tile.sandstone.1.desc=Sandcobble
|
tile.sandstone.1.desc=Sandcobble
|
||||||
@@ -740,6 +749,8 @@ tile.sandstone.12.desc=Sandstone Block
|
|||||||
tile.sandstone.13.desc=Small Sandstone Blocks
|
tile.sandstone.13.desc=Small Sandstone Blocks
|
||||||
tile.sandstone.14.desc=Sandstone Mosaic
|
tile.sandstone.14.desc=Sandstone Mosaic
|
||||||
tile.sandstone.15.desc=Stacked Sandstone Tiles
|
tile.sandstone.15.desc=Stacked Sandstone Tiles
|
||||||
|
tile.sandstone.16.desc=Sandstone Bricks
|
||||||
|
tile.sandstone.17.desc=
|
||||||
|
|
||||||
# Sandstone scribbles
|
# Sandstone scribbles
|
||||||
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
|
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ item.chisel.chisel.desc.modes=Has multiple modes for chiseling.
|
|||||||
|
|
||||||
item.chisel.chisel_diamond.name=Diamond Chisel
|
item.chisel.chisel_diamond.name=Diamond Chisel
|
||||||
item.chisel.chisel_obsidian.name=Obsidian Chisel
|
item.chisel.chisel_obsidian.name=Obsidian Chisel
|
||||||
|
item.chisel.chisel_netherstar.name=Nether Star Chisel
|
||||||
|
|
||||||
item.ballMoss.name=Ball O' Moss
|
item.ballMoss.name=Ball O' Moss
|
||||||
item.ballMoss.desc=Right-Click to throw. This will turn Cobblestone to Moss Stone on impact.
|
item.ballMoss.desc=Right-Click to throw. This will turn Cobblestone to Moss Stone on impact.
|
||||||
@@ -59,6 +60,14 @@ tile.shingles.5.desc=Black Big Squares
|
|||||||
tile.chisel.valentines.name=Valentines Block
|
tile.chisel.valentines.name=Valentines Block
|
||||||
tile.valentines.0.desc=Valentines Bricks
|
tile.valentines.0.desc=Valentines Bricks
|
||||||
tile.valentines.1.desc=If it speaks, I wouldn't touch it
|
tile.valentines.1.desc=If it speaks, I wouldn't touch it
|
||||||
|
tile.valentines.2.desc=
|
||||||
|
tile.valentines.3.desc=
|
||||||
|
tile.valentines.4.desc=
|
||||||
|
tile.valentines.5.desc=
|
||||||
|
tile.valentines.6.desc=
|
||||||
|
tile.valentines.7.desc=
|
||||||
|
tile.valentines.8.desc=
|
||||||
|
tile.valentines.9.desc=
|
||||||
|
|
||||||
#AntiBlocks
|
#AntiBlocks
|
||||||
tile.chisel.antiBlock.name=Anti Block
|
tile.chisel.antiBlock.name=Anti Block
|
||||||
@@ -724,6 +733,7 @@ tile.glass2.0.desc=Asymmetrical Leaded Glass
|
|||||||
|
|
||||||
#Sandstone
|
#Sandstone
|
||||||
tile.chisel.sandstone.name=Sandstone
|
tile.chisel.sandstone.name=Sandstone
|
||||||
|
tile.chisel.sandstone2.name=Sandstone
|
||||||
|
|
||||||
tile.sandstone.0.desc=Sandstone Glyphs
|
tile.sandstone.0.desc=Sandstone Glyphs
|
||||||
tile.sandstone.1.desc=Sandcobble
|
tile.sandstone.1.desc=Sandcobble
|
||||||
@@ -742,6 +752,8 @@ tile.sandstone.12.desc=Sandstone Block
|
|||||||
tile.sandstone.13.desc=Small Sandstone Blocks
|
tile.sandstone.13.desc=Small Sandstone Blocks
|
||||||
tile.sandstone.14.desc=Sandstone Mosaic
|
tile.sandstone.14.desc=Sandstone Mosaic
|
||||||
tile.sandstone.15.desc=Stacked Sandstone Tiles
|
tile.sandstone.15.desc=Stacked Sandstone Tiles
|
||||||
|
tile.sandstone.16.desc=Sandstone Bricks
|
||||||
|
tile.sandstone.17.desc=
|
||||||
|
|
||||||
#Sandstone scribbles
|
#Sandstone scribbles
|
||||||
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
|
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 228 B |
@@ -1,10 +1,10 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"modid": "chisel",
|
"modid": "${modId}",
|
||||||
"name": "Chisel",
|
"name": "${modName}",
|
||||||
"description": "A mod that adds in many fancy blocks for decoration, which are crafted utilising the Chisel.",
|
"description": "A mod that adds in many fancy blocks for decoration, which are crafted utilising the Chisel.",
|
||||||
"version": "${version}",
|
"version": "${modVersion}",
|
||||||
"mcversion": "${mcversion}",
|
"mcversion": "${minecraftVersion}",
|
||||||
"url": "http://www.minecraftforum.net/forums/thread/1294901",
|
"url": "http://www.minecraftforum.net/forums/thread/1294901",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
"authorList": [ "tterrag", "Drullkus", "minecreatr" ],
|
"authorList": [ "tterrag", "Drullkus", "minecreatr" ],
|
||||||
|
|||||||
Reference in new issue
Block a user