Merge pull request #15 from GTNewHorizons/unified-build-script

Unified build script
This commit is contained in:
Martin Robertz authored and GitHub committed 2021-12-20 12:00:23 +01:00
commit 377c5f688e
147 files changed
+907 -7015

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
if [[ -d "run/crash-reports" ]]; then
echo "Crash reports detected:"
cat $directory/*
exit 1
fi
if grep --quiet "Fatal errors were detected" server.log; then
echo "Fatal errors detected:"
cat server.log
exit 1
fi
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then
echo "Server force stopped:"
cat server.log
exit 1
fi
if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then
echo "Server didn't finish startup:"
cat server.log
exit 1
fi
echo "No crash reports detected"
exit 0
+45
View File
@@ -0,0 +1,45 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Run server for 1.5 minutes
run: |
mkdir run
echo "eula=true" > run/eula.txt
timeout 90 ./gradlew runServer | tee --append server.log || true
- name: Test no errors reported during server run
run: |
chmod +x .github/scripts/test-no-error-reports.sh
.github/scripts/test-no-error-reports.sh
+61
View File
@@ -0,0 +1,61 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release tagged build
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Release under current tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "${{ env.RELEASE_VERSION }}"
files: build/libs/*.jar
- name: Set repository owner and name
run: |
echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Publish package
run: ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACT_GROUP_ID: com.github.${{ env.REPOSITORY_OWNER }}
ARTIFACT_ID: "${{ env.REPOSITORY_NAME }}"
ARTIFACT_VERSION: "${{ env.RELEASE_VERSION }}"
REPOSITORY_NAME: "${{ env.REPOSITORY_NAME }}"
REPOSITORY_OWNER: "${{ env.REPOSITORY_OWNER }}"
+27 -44
View File
@@ -1,48 +1,31 @@
*.class
dist
download
push.sh
remotebuild.py
## gradle
/.gradle
/build
/eclipse
/gradlew.bat
/libs
## ForgeGradle
/run
/out
/ForgeModule
/libs/download
## idea
.gradle
.settings
/.idea/
/run/
/build/
/eclipse/
.classpath
.project
/bin/
/config/
/crash-reports/
/logs/
options.txt
/saves/
usernamecache.json
banned-ips.json
banned-players.json
eula.txt
ops.json
server.properties
servers.dat
usercache.json
whitelist.json
/out/
*.iml
*.ipr
*.iws
## eclipse
/.settings
/.metadata
/.classpath
/.project
/bin
/.idea
/client/
/Server/
/classes/
## misc
TCDEOBF*
## Ignore OS cache files
/src/main/resources/CoFH_at.cfg
*.DS_Store
_MACOSX
Thumbs.db
/forgelibs
## Ignore unnecessary files
*.log
*.lck
/target/
src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
-51
View File
@@ -1,51 +0,0 @@
*.class
dist
download
push.sh
remotebuild.py
## gradle
/.gradle
/build
/eclipse
/gradlew.bat
## ForgeGradle
/run
/out
/ForgeModule
/libs/download
## idea
*.iml
*.ipr
*.iws
## eclipse
/.settings
/.metadata
/.classpath
/.project
/bin
/.idea
/client/
/Server/
/classes/
## misc
/libs/Thaumcraft-deobf*.jar*
<<<<<<< HEAD
/libs/Ender*
=======
/libs/*1.7.10*
>>>>>>> develop
TCDEOBF*
## Ignore OS cache files
*.DS_Store
_MACOSX
Thumbs.db
/forgelibs
## Ignore unnecessary files
*.log
*.lck
/target/
-56
View File
@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="2">
<profile kind="CleanUpProfile" name="ThaumicTinkererCleanup" version="2">
<setting id="cleanup.remove_unused_private_fields" value="true"/>
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.never_use_blocks" value="false"/>
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
<setting id="cleanup.remove_unused_private_methods" value="true"/>
<setting id="cleanup.convert_to_enhanced_for_loop" value="true"/>
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
<setting id="cleanup.sort_members" value="false"/>
<setting id="cleanup.remove_unused_local_variables" value="true"/>
<setting id="cleanup.remove_unused_private_members" value="true"/>
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
<setting id="cleanup.make_parameters_final" value="false"/>
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
<setting id="cleanup.use_blocks" value="false"/>
<setting id="cleanup.remove_private_constructors" value="true"/>
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
<setting id="cleanup.always_use_this_for_non_static_field_access" value="false"/>
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="true"/>
<setting id="cleanup.add_default_serial_version_id" value="false"/>
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
<setting id="cleanup.make_variable_declarations_final" value="false"/>
<setting id="cleanup.add_missing_nls_tags" value="false"/>
<setting id="cleanup.format_source_code" value="false"/>
<setting id="cleanup.add_missing_override_annotations" value="true"/>
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.remove_unused_private_types" value="true"/>
<setting id="cleanup.make_local_variable_final" value="true"/>
<setting id="cleanup.add_missing_methods" value="false"/>
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
<setting id="cleanup.correct_indentation" value="false"/>
<setting id="cleanup.remove_unused_imports" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
<setting id="cleanup.make_private_fields_final" value="true"/>
<setting id="cleanup.add_generated_serial_version_id" value="true"/>
<setting id="cleanup.organize_imports" value="true"/>
<setting id="cleanup.sort_members_all" value="false"/>
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
<setting id="cleanup.use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.add_missing_annotations" value="true"/>
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
<setting id="cleanup.add_serial_version_id" value="true"/>
<setting id="cleanup.always_use_blocks" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
<setting id="cleanup.format_source_code_changes_only" value="false"/>
</profile>
</profiles>
-80
View File
@@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
<template autoinsert="false" context="gettercomment_context" deleted="false" description="Comment for getter method"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment"/>
<template autoinsert="false" context="settercomment_context" deleted="false" description="Comment for setter method"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment"/>
<template autoinsert="false" context="constructorcomment_context" deleted="false"
description="Comment for created constructors" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment"/>
<template autoinsert="false" context="filecomment_context" deleted="false"
description="Comment for created Java files" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
* This class was created by &lt;Vazkii&gt;. It's distributed as
* part of the ${project_name} Mod.
*
* ${project_name} is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* ${project_name} is a Derivative Work on Thaumcraft 4.
* Thaumcraft 4 (c) Azanor 2012
* (http://www.minecraftforum.net/topic/1585216-)
*
* File Created @ [${date}, ${time} (GMT)]
*/
</template>
<template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment"/>
<template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/>
<template autoinsert="false" context="methodcomment_context" deleted="false"
description="Comment for non-overriding methods" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment"/>
<template autoinsert="false" context="overridecomment_context" deleted="false"
description="Comment for overriding methods" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment"/>
<template autoinsert="false" context="delegatecomment_context" deleted="false"
description="Comment for delegate methods" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment"/>
<template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
${package_declaration}
${typecomment}
${type_declaration}
</template>
<template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
</template>
<template autoinsert="true" context="interfacebody_context" deleted="false"
description="Code in new interface type bodies" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
</template>
<template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
</template>
<template autoinsert="true" context="annotationbody_context" deleted="false"
description="Code in new annotation type bodies" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
</template>
<template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo}
Auto-generated catch block
${exception_var}.printStackTrace();
</template>
<template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created method stubs"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody"/>
<template autoinsert="true" context="constructorbody_context" deleted="false"
description="Code in created constructor stubs" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
// ${todo} Auto-generated constructor stub
</template>
<template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};
</template>
<template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} =
${param};
</template>
</templates>
@@ -1,29 +0,0 @@
package thaumcraft.common.lib;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class Utils {
public static boolean breakFurthestBlock(World world, int x,int y,int z,int blockid,EntityPlayer player)
{
return false;
}
public static MovingObjectPosition getTargetBlock(World world, Entity entity, boolean par3)
{
return null;
}
public static float getWalkSpeed(PlayerCapabilities pc) {
return 0.0f;
}
public static void setWalkSpeed(PlayerCapabilities pc, float ws)
{
}
public static boolean isWoodLog(World world, int x, int y, int z)
{
return false;
}
}
+510 -79
View File
@@ -1,131 +1,562 @@
//version: 29197fa3cf1ea6ef5c07884a613171d01c026d1d
/*
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 {
repositories {
mavenCentral()
maven {
name = "gt"
url = "https://gregtech.overminddl1.com/"
name = "forge"
url = "https://maven.minecraftforge.net"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name = "jitpack.io"
name = "Scala CI dependencies"
url = "https://repo1.maven.org/maven2/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
}
}
plugins {
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")
id("maven-publish")
}
apply plugin: 'forge'
apply plugin: 'idea'
sourceCompatibility = 1.8
targetCompatibility = 1.8
def projectJavaVersion = JavaLanguageVersion.of(8)
ext.configFile = file('build.properties')
ext.config = parseConfig(configFile)
version = "${config.mc_version}-${config.version}"
if (System.getenv("BUILD_NUMBER") != null) {
version += "-${System.getenv("BUILD_NUMBER")}"
} else if(config.build_number != null){
version += "-${config.build_number}"
java {
toolchain {
languageVersion.set(projectJavaVersion)
}
}
if (project.hasProperty("releaseType") && project.releaseType == "ALPHA") {
version += "_alpha"
idea {
module {
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
checkPropertyExists("modName")
checkPropertyExists("modId")
checkPropertyExists("modGroup")
checkPropertyExists("autoUpdateBuildScript")
checkPropertyExists("minecraftVersion")
checkPropertyExists("forgeVersion")
checkPropertyExists("replaceGradleTokenInFile")
checkPropertyExists("gradleTokenModId")
checkPropertyExists("gradleTokenModName")
checkPropertyExists("gradleTokenVersion")
checkPropertyExists("gradleTokenGroupName")
checkPropertyExists("apiPackage")
checkPropertyExists("accessTransformersFile")
checkPropertyExists("usesMixins")
checkPropertyExists("mixinPlugin")
checkPropertyExists("mixinsPackage")
checkPropertyExists("coreModClass")
checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
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
}
group = "thaumic.tinkerer" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = config.mod_name
minecraft {
version = "1.7.10-10.13.4.1614-1.7.10"
runDir = "eclipse"
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
runDir = "run"
replace "\${version}", config.version
if (replaceGradleTokenInFile) {
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 {
implementation.extendsFrom(shadowImplementation)
}
repositories {
maven {
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}
maven { // the repo from which to get NEI and stuff
name 'CB Repo'
url "http://chickenbones.net/maven/"
}
maven {
name = "gt"
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
}
if(usesMixins.toBoolean()) {
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
url = "https://jitpack.io"
}
}
}
dependencies {
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev"
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev"
compile "mcp.mobius.waila:Waila:1.5.10_1.7.10"
compile "net.industrial-craft:industrialcraft-2:2.2.827-experimental:dev"
compile "codechicken:EnderStorage:1.7.10-1.4.7.37:dev"
compile "com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf"
compile "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev"
compile "appeng:appliedenergistics2:rv3-beta-6:dev"
compile "li.cil.oc:OpenComputers:MC1.7.10-1.7.2.1204:dev"
compile "cofh:CoFHCore:1.7.10R3.0.4:dev"
compile "cofh:CoFHLib:1.7.10R3.0.3:dev"
compile "com.enderio.core:EnderCore:1.7.10-0.2.0.39_beta:dev"
compile "com.enderio:EnderIO:1.7.10-2.3.0.430_beta:dev"
compile "mantle:Mantle:1.7.10-0.3.2.jenkins187:deobf"
compile "tconstruct:TConstruct:1.7.10-1.8.3.build927:deobf"
if(usesMixins.toBoolean()) {
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
annotationProcessor("com.google.guava:guava:24.1.1-jre")
annotationProcessor("com.google.code.gson:gson:2.8.6")
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
// using 0.8 to workaround a issue in 0.7 which fails mixin application
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: "launchwrapper"
exclude module: "guava"
exclude module: "gson"
exclude module: "commons-io"
exclude module: "log4j-core"
}
compile("com.github.GTNewHorizons:SpongeMixins:1.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 'FMLCorePlugin': 'thaumic.tinkerer.preloader.ThaumicTLoaderContainer'
attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(shadowJar)
enabled = false
}
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
reobf {
if(usesMixins.toBoolean()) {
addExtraSrgFile mixinSrg
}
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
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
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
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
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
def getManifestAttributes() {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if(usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
task shadowDevJar(type: ShadowJar) {
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
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
}
}
task apiJar(type: Jar) {
from (sourceSets.main.allJava) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.output) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.resources.srcDirs) {
include("LICENSE")
}
getArchiveClassifier().set('api')
}
artifacts {
archives deobfJar
archives sourcesJar
}
static def parseConfig(File config) {
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
archives devJar
if(apiPackage) {
archives apiJar
}
}
// publishing
publishing {
publications {
maven(MavenPublication) {
artifact source: jar
artifact source: sourcesJar, classifier: "src"
artifact source: devJar, classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
version = System.getenv("ARTIFACT_VERSION") ?: project.version
}
}
repositories {
maven {
String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown"
String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown"
String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName"
name = "GitHubPackages"
url = githubRepositoryUrl
credentials {
username = System.getenv("GITHUB_ACTOR") ?: "NONE"
password = System.getenv("GITHUB_TOKEN") ?: "NONE"
}
}
}
}
// Updating
task updateBuildScript {
doLast {
if (performBuildScriptUpdate(projectDir.toString())) return
print("Build script already up-to-date!")
}
}
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
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)
}
-4
View File
@@ -1,4 +0,0 @@
version=2.5
build_number=559-GTNH
mc_version=1.7.10
mod_name=ThaumicTinkerer
-306
View File
@@ -1,306 +0,0 @@
<project name="ThaumicTinkerer" default="install" basedir=".">
<!-- Buildscript thanks to CoFH -->
<property environment="env"/>
<!-- Basic directories -->
<property name="src.dir" value="src/main/java"/>
<property name="api.dir" value="src/api/java"/>
<property name="library.dir" value="libs"/>
<property name="library.download.dir" value="${library.dir}/downloads"/>
<property name="resources.dir" value="src/main/resources"/>
<property name="build.dir" value="build"/>
<property name="download.dir" value="${build.dir}/downloads"/>
<!-- Project information -->
<property name="build.name" value="${ant.project.name}"/>
<property name="class.pckg" value="thaumic/tinkerer"/>
<!-- Version file -->
<property name="verclass.dir" value="${src.dir}/${class.pckg}/common/lib"/>
<property name="verclass.name" value="LibMisc.java"/>
<!-- Forge version -->
<property name="mc.version" value="1.7.10"/>
<property name="forge.major" value="10"/>
<property name="forge.minor" value="13"/>
<property name="forge.patch" value="0"/>
<property name="forge.build" value="1199"/>
<!-- Packaging -->
<property name="dist.dir" value="${build.dir}/dist"/>
<property name="classes.dir" value="${build.dir}/packaging"/>
<property name="apiclasses.dir" value="${build.dir}/api-packaging"/>
<!-- Forge paths -->
<property name="forge.version" value="${mc.version}-${forge.major}.${forge.minor}.${forge.patch}.${forge.build}"/>
<property name="forge.dir" value="${build.dir}/forge"/>
<property name="forgebuild.dir" value="${forge.dir}/build"/>
<property name="compile.dir" value="${forgebuild.dir}/tmp/compile"/>
<property name="lib.dir" value="${forgebuild.dir}/libs"/>
<property name="sources.dir" value="${forgebuild.dir}/sources/minecraft"/>
<property name="transformers.dir" value="${forge.dir}/src/main/resources/"/>
<property name="forge.stsh"
value="${build.dir}/.gradle/caches/minecraft/net/minecraftforge/forge/${forge.version}"/>
<property name="forge.jar" value="${forge.stsh}/forgeSrc-${forge.version}.jar"/>
<property name="reobf.cmd" value="${download.dir}/bon.jar"/>
<property name="forge.url"
value="http://files.minecraftforge.net/maven/net/minecraftforge/forge/${forge.version}/forge-${forge.version}-src.zip"/>
<!-- Classpaths -->
<path id="lib.classpath">
<pathelement location="${forge.jar}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<include name="**/*.jar"/>
<exclude name="${reobf.jar}"/>
</fileset>
<fileset dir="libs">
<include name="*.jar"/>
<include name="**/*.jar"/>
</fileset>
<!--fileset dir="${build.dir}/.gradle/caches">
<include name="modules*/files*/**/*.jar"/>
<exclude name="commons-io-1.4.jar"/>
<exclude name="commons-lang3-3.1.jar"/>
<exclude name="modules*/files*/commons-io/commons-io/1.4/**/*.jar"/>
<exclude name="modules*/files*/com.google.guava/guava/14*/**/*.jar"/>
<exclude name="modules*/files*/com.google.guava/guava/15*/**/*.jar"/>
</fileset-->
</path>
<path id="gson">
<!--fileset dir="${build.dir}/.gradle/caches">
<include name="modules*/files*/com.google.code.gson/**/*.jar"/>
</fileset-->
</path>
<!-- Task skipping -->
<target name="properties">
<!-- Enforce some paths -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${download.dir}"/>
<!-- Set properties -->
<available property="has.api" file="${src.dir}/${class.pckg}/api"/>
<available property="forge.exists" file="${download.dir}/forge-${forge.version}-src.zip"/>
<available property="bon.exists" file="${reobf.cmd}"/>
<condition property="forge.already.installed">
<available file="${forge.jar}" type="file"/>
</condition>
<condition property="have.libs">
<and>
<istrue value="${
}"/>
</and>
</condition>
</target>
<!-- Dependency downloading -->
<target name="download-core" depends="properties">
</target>
<target name="get-dependencies" depends="get-version" unless="have.libs">
<delete dir="${library.download.dir}/"/>
<mkdir dir="${library.download.dir}/"/>
<echo message="Downloading libs"/>
<get src="http://files.minecraftforge.net/maven/codechicken/ForgeMultipart/1.7.2-1.1.0.268/ForgeMultipart-1.7.2-1.1.0.268-dev.jar"
dest="${library.download.dir}/FMP.jar"/>
<get src="http://dvs1.progwml6.com/files/maven/tconstruct/TConstruct/1.7.2-1.6.0.jenkins494/TConstruct-1.7.2-1.6.0.jenkins494-deobf.jar"
dest="${library.download.dir}/TCONSTRUCT.jar"/>
<get src="http://dvs1.progwml6.com/files/maven/mantle/Mantle/1.7.2-145.3a637c2/Mantle-1.7.2-145.3a637c2-deobf.jar"
dest="${library.download.dir}/MANTLE.jar"/>
<!-- Begin hack -->
<delete dir="${compile.dir}" failonerror="false"/>
<!-- End hack -->
</target>
<!-- Building process -->
<target name="install" depends="build">
<!-- Cleanup -->
<delete dir="${apiclasses.dir}"/>
<delete dir="${classes.dir}"/>
<delete>
<fileset dir="${dist.dir}">
<exclude name="${build.name}${build.full}${build.number}.jar"/>
<exclude name="${build.name}${build.full}dev-${build.number}.jar"/>
<exclude name="${build.name}-API${build.full}${build.number}.zip"/>
</fileset>
</delete>
</target>
<macrodef name="install-lite">
<attribute name="build"/>
<attribute name="classes" default="${compile.dir}"/>
<sequential>
<copy todir="${classes.dir}" preservelastmodified="true">
<fileset dir="@{classes}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${resources.dir}"/>
</copy>
<update-languages/>
<manifest file="${classes.dir}/MANIFEST.MF">
<attribute name="FMLCorePlugin" value="cofh.asm.LoadingPlugin"/>
<attribute name="FMLCorePluginContainsFMLMod" value="true"/>
</manifest>
<jar destfile="${dist.dir}/${build.name}${build.full}@{build}.jar"
compress="true" level="9" basedir="${classes.dir}"
manifest="${classes.dir}/MANIFEST.MF">
<exclude name="MANIFEST.MF"/>
</jar>
</sequential>
</macrodef>
<target name="build" depends="get-dependencies,get-build-number,copy-sources">
<!-- Recompile -->
<echo message="Compiling..."/>
<mkdir dir="${compile.dir}"/>
<depend srcdir="${sources.dir}" destdir="${compile.dir}"
cache="${forgebuild.dir}/tmp/depcache" closure="true">
<include name="**/*.java"/>
</depend>
<!--Print out detailed classpath-->
<pathconvert pathsep="${line.separator}| |-- "
property="echo.path.compile"
refid="lib.classpath">
</pathconvert>
<echo message="|-- compile classpath"/>
<echo message="| |"/>
<echo message="| |-- ${echo.path.compile}"/>
<javac srcdir="${sources.dir}" destdir="${compile.dir}" target="1.6" source="1.6"
classpathref="lib.classpath" debug="true" debuglevel="lines,source" includeAntRuntime="false">
<include name="**/*.java"/>
</javac>
<!-- Dev jar -->
<echo message="Building jar..."/>
<local name="build"/>
<property name="build" value="dev-${build.number}"/>
<install-lite build="${build}"/>
<!-- Reobf -->
<echo message="Reobfuscating..."/>
<java classpath="${reobf.cmd}" classname="immibis.bon.cui.MCPRemap">
<arg line="-q -m"/>
<arg value="-to SRG"/>
<arg value="-from MCP"/>
<arg value="-mcp ${forge.stsh}/unpacked"/>
<arg value="-in ${dist.dir}/${build.name}${build.full}${build}.jar"/>
<arg value="-out ${dist.dir}/${build.name}${build.full}${build.number}.jar"/>
<arg value="-ref ${forge.jar}"/>
<arg value="-jref ${lib.dir}"/>
</java>
</target>
<target name="copy-sources" depends="package-api">
<!-- Copy source -->
<mkdir dir="${sources.dir}"/>
<sync todir="${sources.dir}">
<fileset dir="${src.dir}"/>
<fileset dir="${api.dir}"/>
</sync>
</target>
<target name="package-api" depends="get-version" if="has.api">
<!-- Copy & package API -->
<copy todir="${apiclasses.dir}/${class.pckg}/api">
<fileset dir="${src.dir}/${class.pckg}/api"/>
</copy>
<zip destfile="${dist.dir}/${build.name}-API${build.full}${build.number}.zip" basedir="${apiclasses.dir}"/>
</target>
<target name="setup-forge" depends="download-forge" unless="forge.already.installed">
<delete dir="${forge.dir}" failonerror="false"/>
<mkdir dir="${forge.dir}"/>
<unzip dest="${forge.dir}">
<fileset dir="${download.dir}">
<include name="forge-${forge.version}-src.zip"/>
</fileset>
</unzip>
<!-- Cleanup -->
<delete>
<fileset dir="${forge.dir}">
<include name="*.txt"/>
<include name="src/**/*.info"/>
</fileset>
</delete>
<delete dir="${forge.dir}/eclipse" failonerror="false"/>
<delete dir="${forge.dir}/src/main/java" failonerror="false"/>
<delete dir="${build.dir}/.gradle/caches/minecraft/net/minecraftforge/forge/${forge.version}/srgs"
failonerror="false"/>
<!-- Change executables' permissions -->
<chmod file="${forge.dir}/gradlew" perm="+x"/>
<copy file="${resources.dir}/ThaumicTinkerer_at.cfg" tofile="${transformers.dir}/ThaumicTinkerer_at.cfg"/>
<!-- Install forge -->
<exec executable="./gradlew" failonerror="true" dir="${forge.dir}/" vmlauncher="false">
<arg line="-g ../.gradle"/>
<arg line="extractMinecraftSrc"/>
<arg line="eclipseClasspath"/>
</exec>
<mkdir dir="${compile.dir}"/>
<mkdir dir="${lib.dir}"/>
<javac srcdir="${forgebuild.dir}/tmp/recompSrc" destdir="${compile.dir}" target="1.6" source="1.6"
classpathref="lib.classpath" debug="true" debuglevel="lines,source" includeAntRuntime="false"/>
<jar destfile="${forge.jar}" compress="true" level="9" basedir="${compile.dir}"/>
<copy file="${forge.jar}" todir="${forgebuild.dir}/dirtyArtifacts/"/>
<delete dir="${compile.dir}"/>
</target>
<target name="download-forge" depends="setup-bon,download-core">
<echo message="Downloading forge... "/>
<get src="${forge.url}" dest="${download.dir}/forge-${forge.version}-src.zip"/>
</target>
<target name="setup-bon" depends="properties" unless="bon.exists">
<echo message="Downloading BON..."/>
<get src="https://github.com/skyboy/bearded-octo-nemesis/releases/download/1.1/BON.jar" dest="${reobf.cmd}"/>
</target>
<macrodef name="update-languages">
<sequential>
<script language="javascript"><![CDATA[
importPackage(java.io);
var path = "/assets/cofh/language/";
var languages = new File(project.getProperty("resources.dir") + path);
if (languages.exists() && languages.isDirectory()) {
var out = "";
for each(var i in languages.list()) {
if (i != null && i.length() > 5 && i.indexOf(".lang") == i.length() - 5) {
out += i.substring(0, i.length() - 5) + ", ";
}
}
if (out.length > 0) {
var os = new PrintWriter(project.getProperty("classes.dir") + path + ".languages");
os.write("["+out.substring(0, out.length - 2)+"]");
os.flush();
os.close();
}
}
]]></script>
</sequential>
</macrodef>
<target name="verify-version">
<script language="javascript"><![CDATA[
var name = project.getProperty("build.full");
if (name == null || name == "") {
name = project.getProperty("verclass.name");
if (name == null || name == "") {
project.setProperty("build.full", "-");
}
}
]]></script>
</target>
<target name="get-version" depends="verify-version,setup-forge" unless="build.full">
<local name="grep.out"/>
<local name="mfrv"/>
<local name="mcv"/>
<!-- Read version out of file -->
<property name="version" value="2.4"/>
<!-- Split mod&mc version, update mcmod -->
<property name="build.full" value="-[${mcv}]${mfrv}-"/>
</target>
<target name="get-build-number" depends="build-number-there" unless="build.number">
<echo message="!! No build number set !!"/>
<property name="build.number" value="CUSTOM_BUILD"/>
</target>
<target name="build-number-there" depends="get-version" if="env.BUILD_NUMBER" unless="build.number">
<echo message="Using build number ${env.BUILD_NUMBER}..."/>
<property name="build.number" value="${env.BUILD_NUMBER}"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="rebuild">
<delete file="${forge.jar}" failonerror="false"/>
<delete dir="${forge.dir}"/>
<delete dir="${download.dir}"/>
<antcall target="install"/>
</target>
<target name="refresh-deps">
<delete dir="${lib.dir}"/>
<delete dir="${download.dir}"/>
<antcall target="install"/>
</target>
<target name="jar" depends="install"/>
</project>
+49
View File
@@ -0,0 +1,49 @@
// Add your dependencies here
dependencies {
compile("com.github.GTNewHorizons:Baubles:master-SNAPSHOT:dev")
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:api")
compile("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
compileOnly("com.github.GTNewHorizons:Botania:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:EnderCore:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:EnderIO:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:EnderStorage:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:waila:master-SNAPSHOT:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:TinkersConstruct:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForgeMultipart:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:OpenComputers:master-SNAPSHOT:api") {
transitive = false
}
compileOnly("curse.maven:computercraft-67504:2269339") {
transitive = false
}
compileOnly("curse.maven:cofh-lib-220333:2388748") {
transitive = false
}
compileOnly("curse.maven:cofh-core-69162:2388751") {
transitive = false
}
compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:api") {
transitive = false
}
}
-5
View File
@@ -1,5 +0,0 @@
Manifest-Version: 1.0
FMLCorePlugin: tconstruct.preloader.TConstructLoaderContainer
FMLCorePluginContainsFMLMod: true
Binary file not shown.
+64
View File
@@ -0,0 +1,64 @@
modName = Thaumic Tinkerer
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = ThaumicTinkerer
modGroup = thaumic.tinkerer
# 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 = LibMisc.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 = api
# 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 = ThaumicTinkerer_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 compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass = preloader.ThaumicTLoaderContainer
# 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 =
@@ -1 +0,0 @@
#Sun Jun 29 10:07:24 EDT 2014
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-6
View File
@@ -1,6 +0,0 @@
#Sun Jun 29 10:07:25 EDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
-164
View File
@@ -1,164 +0,0 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
Binary file not shown.
+2 -3
View File
@@ -1,6 +1,5 @@
#Wed Sep 02 15:08:51 MSK 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+77 -53
View File
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
@@ -6,47 +22,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@@ -61,9 +36,49 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -90,7 +105,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -110,10 +125,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -154,11 +170,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
+20 -10
View File
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,14 +24,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +62,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
+18
View File
@@ -0,0 +1,18 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
name = "ic2"
url = "https://maven.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
}
}
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
}
@@ -1,265 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api;
import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.api.filesystem.IWritableMount;
import dan200.computercraft.api.media.IMediaProvider;
import dan200.computercraft.api.peripheral.IPeripheralProvider;
import dan200.computercraft.api.redstone.IBundledRedstoneProvider;
import dan200.computercraft.api.turtle.ITurtleUpgrade;
import net.minecraft.world.World;
import java.lang.reflect.Method;
/**
* The static entry point to the ComputerCraft API.
* Members in this class must be called after mod_ComputerCraft has been initialised,
* but may be called before it is fully loaded.
*/
public final class ComputerCraftAPI
{
/**
* Creates a numbered directory in a subfolder of the save directory for a given world, and returns that number.<br>
* Use in conjuction with createSaveDirMount() to create a unique place for your peripherals or media items to store files.<br>
* @param world The world for which the save dir should be created. This should be the serverside world object.
* @param parentSubPath The folder path within the save directory where the new directory should be created. eg: "computercraft/disk"
* @return The numerical value of the name of the new folder, or -1 if the folder could not be created for some reason.<br>
* eg: if createUniqueNumberedSaveDir( world, "computer/disk" ) was called returns 42, then "computer/disk/42" is now available for writing.
* @see #createSaveDirMount(net.minecraft.world.World, String, long)
*/
public static int createUniqueNumberedSaveDir( World world, String parentSubPath )
{
findCC();
if( computerCraft_createUniqueNumberedSaveDir != null )
{
try {
return ((Integer)computerCraft_createUniqueNumberedSaveDir.invoke( null, world, parentSubPath )).intValue();
} catch (Exception e){
// It failed
}
}
return -1;
}
/**
* Creates a file system mount that maps to a subfolder of the save directory for a given world, and returns it.<br>
* Use in conjuction with IComputerAccess.mount() or IComputerAccess.mountWritable() to mount a folder from the
* users save directory onto a computers file system.<br>
* @param world The world for which the save dir can be found. This should be the serverside world object.
* @param subPath The folder path within the save directory that the mount should map to. eg: "computer/disk/42".<br>
* Use createUniqueNumberedSaveDir() to create a new numbered folder to use.
* @param capacity The ammount of data that can be stored in the directory before it fills up, in bytes.
* @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable()
* to mount this on a Computers' file system.
* @see #createUniqueNumberedSaveDir(net.minecraft.world.World, String)
* @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount)
* @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount)
* @see dan200.computercraft.api.filesystem.IMount
* @see dan200.computercraft.api.filesystem.IWritableMount
*/
public static IWritableMount createSaveDirMount( World world, String subPath, long capacity )
{
findCC();
if( computerCraft_createSaveDirMount != null )
{
try {
return (IWritableMount)computerCraft_createSaveDirMount.invoke( null, world, subPath, capacity );
} catch (Exception e){
// It failed
}
}
return null;
}
/**
* Creates a file system mount to a resource folder, and returns it.<br>
* Use in conjuction with IComputerAccess.mount() or IComputerAccess.mountWritable() to mount a resource folder onto a computers file system.<br>
* The files in this mount will be a combination of files in the specified mod jar, and resource packs that contain resources with the same domain and path.<br>
* @param modClass A class in whose jar to look first for the resources to mount. Using your main mod class is recommended. eg: MyMod.class
* @param domain The domain under which to look for resources. eg: "mymod"
* @param subPath The domain under which to look for resources. eg: "mymod/lua/myfiles"
* @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable()
* to mount this on a Computers' file system.
* @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount)
* @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount)
* @see dan200.computercraft.api.filesystem.IMount
*/
public static IMount createResourceMount( Class modClass, String domain, String subPath )
{
findCC();
if( computerCraft_createResourceMount != null )
{
try {
return (IMount)computerCraft_createResourceMount.invoke( null, modClass, domain, subPath );
} catch (Exception e){
// It failed
}
}
return null;
}
/**
* Registers a peripheral handler to convert blocks into IPeripheral implementations.
* @see dan200.computercraft.api.peripheral.IPeripheral
* @see dan200.computercraft.api.peripheral.IPeripheralProvider
*/
public static void registerPeripheralProvider( IPeripheralProvider handler )
{
findCC();
if ( computerCraft_registerPeripheralProvider != null)
{
try {
computerCraft_registerPeripheralProvider.invoke( null, handler );
} catch (Exception e){
// It failed
}
}
}
/**
* Registers a new turtle turtle for use in ComputerCraft. After calling this,
* users should be able to craft Turtles with your new turtle. It is recommended to call
* this during the load() method of your mod.
* @see dan200.computercraft.api.turtle.ITurtleUpgrade
*/
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
{
if( upgrade != null )
{
findCC();
if( computerCraft_registerTurtleUpgrade != null )
{
try {
computerCraft_registerTurtleUpgrade.invoke( null, upgrade );
} catch( Exception e ) {
// It failed
}
}
}
}
/**
* Registers a bundled redstone handler to provide bundled redstone output for blocks
* @see dan200.computercraft.api.redstone.IBundledRedstoneProvider
*/
public static void registerBundledRedstoneProvider( IBundledRedstoneProvider handler )
{
findCC();
if( computerCraft_registerBundledRedstoneProvider != null )
{
try {
computerCraft_registerBundledRedstoneProvider.invoke( null, handler );
} catch (Exception e) {
// It failed
}
}
}
/**
* If there is a Computer or Turtle at a certain position in the world, get it's bundled redstone output.
* @see dan200.computercraft.api.redstone.IBundledRedstoneProvider
* @return If there is a block capable of emitting bundled redstone at the location, it's signal (0-65535) will be returned.
* If there is no block capable of emitting bundled redstone at the location, -1 will be returned.
*/
public static int getBundledRedstoneOutput( World world, int x, int y, int z, int side )
{
findCC();
if( computerCraft_getDefaultBundledRedstoneOutput != null )
{
try {
return ((Integer)computerCraft_getDefaultBundledRedstoneOutput.invoke( null, world, x, y, z, side )).intValue();
} catch (Exception e){
// It failed
}
}
return -1;
}
/**
* Registers a media handler to provide IMedia implementations for Items
* @see dan200.computercraft.api.media.IMediaProvider
*/
public static void registerMediaProvider( IMediaProvider handler )
{
findCC();
if( computerCraft_registerMediaProvider != null )
{
try {
computerCraft_registerMediaProvider.invoke( null, handler );
} catch (Exception e){
// It failed
}
}
}
// The functions below here are private, and are used to interface with the non-API ComputerCraft classes.
// Reflection is used here so you can develop your mod in MCP without decompiling ComputerCraft and including
// it in your solution.
private static void findCC()
{
if( !ccSearched ) {
try {
computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" );
computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{
World.class, String.class
} );
computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] {
World.class, String.class, Long.TYPE
} );
computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] {
Class.class, String.class, String.class
} );
computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] {
IPeripheralProvider.class
} );
computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] {
ITurtleUpgrade.class
} );
computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] {
IBundledRedstoneProvider.class
} );
computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] {
World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE
} );
computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] {
IMediaProvider.class
} );
} catch( Exception e ) {
System.out.println( "ComputerCraftAPI: ComputerCraft not found." );
} finally {
ccSearched = true;
}
}
}
private static Method findCCMethod( String name, Class[] args )
{
try {
if( computerCraft != null )
{
return computerCraft.getMethod( name, args );
}
return null;
} catch( NoSuchMethodException e ) {
System.out.println( "ComputerCraftAPI: ComputerCraft method " + name + " not found." );
return null;
}
}
private static boolean ccSearched = false;
private static Class computerCraft = null;
private static Method computerCraft_createUniqueNumberedSaveDir = null;
private static Method computerCraft_createSaveDirMount = null;
private static Method computerCraft_createResourceMount = null;
private static Method computerCraft_registerPeripheralProvider = null;
private static Method computerCraft_registerTurtleUpgrade = null;
private static Method computerCraft_registerBundledRedstoneProvider = null;
private static Method computerCraft_getDefaultBundledRedstoneOutput = null;
private static Method computerCraft_registerMediaProvider = null;
}
@@ -1,57 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.filesystem;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
/**
* Represents a read only part of a virtual filesystem that can be mounted onto a computercraft using IComputerAccess.mount().
* Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount() or ComputerCraftAPI.createResourceMount(), or you're free to implement it yourselves!
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String)
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String)
* @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount)
* @see IWritableMount
*/
public interface IMount
{
/**
* Returns whether a file with a given path exists or not.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return true if the file exists, false otherwise
*/
public boolean exists(String path) throws IOException;
/**
* Returns whether a file with a given path is a directory or not.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms"
* @return true if the file exists and is a directory, false otherwise
*/
public boolean isDirectory(String path) throws IOException;
/**
* Returns the file names of all the files in a directory.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms"
* @param contents A list of strings. Add all the file names to this list
*/
public void list(String path, List<String> contents) throws IOException;
/**
* Returns the size of a file with a given path, in bytes
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return the size of the file, in bytes
*/
public long getSize(String path) throws IOException;
/**
* Opens a file with a given path, and returns an inputstream representing it's contents.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return a stream representing the contents of the file
*/
public InputStream openForRead(String path) throws IOException;
}
@@ -1,52 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.filesystem;
import java.io.IOException;
import java.io.OutputStream;
/**
* Represents a part of a virtual filesystem that can be mounted onto a computercraft using IComputerAccess.mount() or IComputerAccess.mountWritable(), that can also be written to.
* Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount(), or you're free to implement it yourselves!
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String)
* @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, IMount)
* @see IMount
*/
public interface IWritableMount extends IMount
{
/**
* Creates a directory at a given path inside the virtual file system.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/mynewprograms"
*/
public void makeDirectory(String path) throws IOException;
/**
* Deletes a directory at a given path inside the virtual file system.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myoldprograms"
*/
public void delete(String path) throws IOException;
/**
* Opens a file with a given path, and returns an outputstream for writing to it.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return a stream for writing to
*/
public OutputStream openForWrite(String path) throws IOException;
/**
* Opens a file with a given path, and returns an outputstream for appending to it.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return a stream for writing to
*/
public OutputStream openForAppend(String path) throws IOException;
/**
* Get the ammount of free space on the mount, in bytes. You should decrease this value as the user writes to the mount, and write operations should fail once it reaches zero.
* @return The ammount of free space, in bytes.
*/
public long getRemainingSpace() throws IOException;
}
@@ -1,10 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
@API( owner="ComputerCraft", provides="ComputerCraft|API|FileSystem", apiVersion="1.66pr3" )
package dan200.computercraft.api.filesystem;
import cpw.mods.fml.common.API;
@@ -1,58 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.lua;
/**
* An interface passed to peripherals and ILuaObjects' by computers or turtles, providing methods
* that allow the peripheral call to wait for events before returning, just like in lua.
* This is very useful if you need to signal work to be performed on the main thread, and don't want to return
* until the work has been completed.
*/
public interface ILuaContext
{
/**
* Wait for an event to occur on the computercraft, suspending the thread until it arises. This method is exactly equivalent to os.pullEvent() in lua.
* @param filter A specific event to wait for, or null to wait for any event
* @return An object array containing the name of the event that occurred, and any event parameters
* @throws Exception If the user presses CTRL+T to terminate the current program while pullEvent() is waiting for an event, a "Terminated" exception will be thrown here.
* Do not attempt to common this exception, unless you wish to prevent termination, which is not recommended.
* @throws InterruptedException If the user shuts down or reboots the computercraft while pullEvent() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
*/
public Object[] pullEvent(String filter) throws LuaException, InterruptedException;
/**
* The same as pullEvent(), except "terminated" events are ignored. Only use this if you want to prevent program termination, which is not recommended. This method is exactly equivalent to os.pullEventRaw() in lua.
* @param filter A specific event to wait for, or null to wait for any event
* @return An object array containing the name of the event that occurred, and any event parameters
* @throws InterruptedException If the user shuts down or reboots the computercraft while pullEventRaw() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
* @see #pullEvent(String)
*/
public Object[] pullEventRaw(String filter) throws InterruptedException;
/**
* Yield the current coroutine with some arguments until it is resumed. This method is exactly equivalent to coroutine.yield() in lua. Use pullEvent() if you wish to wait for events.
* @param arguments An object array containing the arguments to pass to coroutine.yield()
* @return An object array containing the return values from coroutine.yield()
* @throws InterruptedException If the user shuts down or reboots the computercraft the coroutine is suspended, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
* @see #pullEvent(String)
*/
public Object[] yield(Object[] arguments) throws InterruptedException;
/**
* TODO: Document me
* @param task
* @return
*/
public Object[] executeMainThreadTask(ILuaTask task) throws LuaException, InterruptedException;
/**
* TODO: Document me
* @param task
* @return
*/
public long issueMainThreadTask(ILuaTask task);
}
@@ -1,26 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.lua;
/**
* An interface for representing custom objects returned by IPeripheral.callMethod() calls.
* Return objects implementing this interface to expose objects with methods to lua.
*/
public interface ILuaObject
{
/**
* Get the names of the methods that this object implements. This works the same as IPeripheral.getMethodNames(). See that method for detailed documentation.
* @see dan200.computercraft.api.peripheral.IPeripheral#getMethodNames()
*/
public String[] getMethodNames();
/**
* Called when a user calls one of the methods that this object implements. This works the same as IPeripheral.callMethod(). See that method for detailed documentation.
* @see dan200.computercraft.api.peripheral.IPeripheral#callMethod(dan200.computercraft.api.peripheral.IComputerAccess, ILuaContext, int, Object[])
*/
public Object[] callMethod(ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException;
}
@@ -1,12 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.lua;
public interface ILuaTask
{
public Object[] execute() throws LuaException;
}
@@ -1,36 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.lua;
/**
* An exception representing an error in Lua, like that raised by the error() function
*/
public class LuaException extends Exception
{
private final int m_level;
public LuaException()
{
this( "error", 1 );
}
public LuaException( String message )
{
this( message, 1 );
}
public LuaException( String message, int level )
{
super( message );
m_level = level;
}
public int getLevel()
{
return m_level;
}
}
@@ -1,10 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
@API( owner="ComputerCraft", provides="ComputerCraft|API|Lua", apiVersion="1.66pr3" )
package dan200.computercraft.api.lua;
import cpw.mods.fml.common.API;
@@ -1,59 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.media;
import dan200.computercraft.api.filesystem.IMount;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Represents an item that can be placed in a disk drive and used by a Computer.
* Implement this interface on your Item class to allow it to be used in the drive.
*/
public interface IMedia
{
/**
* Get a string representing the label of this item. Will be called vi disk.getLabel() in lua.
* @param stack The itemstack to inspect
* @return The label. ie: "Dan's Programs"
*/
public String getLabel(ItemStack stack);
/**
* Set a string representing the label of this item. Will be called vi disk.setLabel() in lua.
* @param stack The itemstack to modify.
* @param label The string to set the label to.
* @return true if the label was updated, false if the label may not be modified.
*/
public boolean setLabel(ItemStack stack, String label);
/**
* If this disk represents an item with audio (like a record), get the readable name of the audio track. ie: "Jonathon Coulton - Still Alive"
* @param stack The itemstack to inspect.
* @return The name, or null if this item does not represent an item with audio.
*/
public String getAudioTitle(ItemStack stack);
/**
* If this disk represents an item with audio (like a record), get the resource name of the audio track to play.
* @param stack The itemstack to inspect.
* @return The name, or null if this item does not represent an item with audio.
*/
public String getAudioRecordName(ItemStack stack);
/**
* If this disk represents an item with data (like a floppy disk), get a mount representing it's contents. This will be mounted onto the filesystem of the computercraft while the media is in the disk drive.
* @param stack The itemstack to inspect.
* @param world The world in which the item and disk drive reside.
* @return The mount, or null if this item does not represent an item with data. If the IMount returned also implements IWritableMount, it will mounted using mountWritable()
* @see dan200.computercraft.api.filesystem.IMount
* @see dan200.computercraft.api.filesystem.IWritableMount
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(net.minecraft.world.World, String, long)
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String)
*/
public IMount createDataMount(ItemStack stack, World world);
}
@@ -1,23 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.media;
import net.minecraft.item.ItemStack;
/**
* This interface is used to provide IMedia implementations for ItemStack
* @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(dan200.computercraft.api.media.IMediaProvider)
*/
public interface IMediaProvider
{
/**
* Produce an IMedia implementation from an ItemStack.
* @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(dan200.computercraft.api.media.IMediaProvider)
* @return an IMedia implementation, or null if the item is not something you wish to handle
*/
public IMedia getMedia(ItemStack stack);
}
@@ -1,10 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
@API( owner="ComputerCraft", provides="ComputerCraft|API|Media", apiVersion="1.66pr3" )
package dan200.computercraft.api.media;
import cpw.mods.fml.common.API;
@@ -1,10 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
@API( owner="ComputerCraft", provides="ComputerCraft|API", apiVersion="1.66pr3" )
package dan200.computercraft.api;
import cpw.mods.fml.common.API;
@@ -1,102 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.peripheral;
import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.api.filesystem.IWritableMount;
/**
* The interface passed to peripherals by computers or turtles, providing methods
* that they can call. This should not be implemented by your classes. Do not interact
* with computers except via this interface.
*/
public interface IComputerAccess
{
/**
* Mount a mount onto the computers' file system in a read only mode.<br>
* @param desiredLocation The location on the computercraft's file system where you would like the mount to be mounted.
* @param mount The mount object to mount on the computercraft. These can be obtained by calling ComputerCraftAPI.createSaveDirMount(), ComputerCraftAPI.createResourceMount() or by creating your own objects that implement the IMount interface.
* @return The location on the computercraft's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later.
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String)
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String)
* @see #mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount)
* @see #unmount(String)
* @see dan200.computercraft.api.filesystem.IMount
*/
public String mount(String desiredLocation, IMount mount);
/**
* TODO: Document me
*/
public String mount(String desiredLocation, IMount mount, String driveName);
/**
* Mount a mount onto the computers' file system in a writable mode.<br>
* @param desiredLocation The location on the computercraft's file system where you would like the mount to be mounted.
* @param mount The mount object to mount on the computercraft. These can be obtained by calling ComputerCraftAPI.createSaveDirMount() or by creating your own objects that implement the IWritableMount interface.
* @return The location on the computercraft's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later.
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String)
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String)
* @see #mount(String, dan200.computercraft.api.filesystem.IMount)
* @see #unmount(String)
* @see dan200.computercraft.api.filesystem.IMount
*/
public String mountWritable(String desiredLocation, IWritableMount mount);
/**
* TODO: Document me
*/
public String mountWritable(String desiredLocation, IWritableMount mount, String driveName);
/**
* Unmounts a directory previously mounted onto the computers file system by mount() or mountWritable().<br>
* When a directory is unmounted, it will disappear from the computers file system, and the user will no longer be able to
* access it. All directories mounted by a mount or mountWritable are automatically unmounted when the peripheral
* is attached if they have not been explicitly unmounted.
* @param location The desired location in the computers file system of the directory to unmount.
* This must be the location of a directory previously mounted by mount() or mountWritable(), as
* indicated by their return value.
* @see #mount(String, dan200.computercraft.api.filesystem.IMount)
* @see #mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount)
*/
public void unmount(String location);
/**
* Returns the numerical ID of this computercraft.<br>
* This is the same number obtained by calling os.getComputerID() or running the "id" program from lua,
* and is guarunteed unique. This number will be positive.
* @return The identifier.
*/
public int getID();
/**
* Causes an event to be raised on this computercraft, which the computercraft can respond to by calling
* os.pullEvent(). This can be used to notify the computercraft when things happen in the world or to
* this peripheral.
* @param event A string identifying the type of event that has occurred, this will be
* returned as the first value from os.pullEvent(). It is recommended that you
* you choose a name that is unique, and recognisable as originating from your
* peripheral. eg: If your peripheral type is "button", a suitable event would be
* "button_pressed".
* @param arguments In addition to a name, you may pass an array of extra arguments to the event, that will
* be supplied as extra return values to os.pullEvent(). Objects in the array will be converted
* to lua data types in the same fashion as the return values of IPeripheral.callMethod().<br>
* You may supply null to indicate that no arguments are to be supplied.
* @see IPeripheral#callMethod
*/
public void queueEvent(String event, Object[] arguments);
/**
* Get a string, unique to the computercraft, by which the computercraft refers to this peripheral.
* For directly attached peripherals this will be "left","right","front","back",etc, but
* for peripherals attached remotely it will be different. It is good practice to supply
* this string when raising events to the computercraft, so that the computercraft knows from
* which peripheral the event came.
* @return A string unique to the computercraft, but not globally.
*/
public String getAttachmentName();
}
@@ -1,100 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.peripheral;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
/**
* The interface that defines a peripheral. This should be implemented by the
* TileEntity of any common that you wish to be interacted with by
* computercraft or turtle.
*/
public interface IPeripheral
{
/**
* Should return a string that uniquely identifies this type of peripheral.
* This can be queried from lua by calling peripheral.getType()
* @return A string identifying the type of peripheral.
*/
public String getType();
/**
* Should return an array of strings that identify the methods that this
* peripheral exposes to Lua. This will be called once before each attachment,
* and should not change when called multiple times.
* @return An array of strings representing method names.
* @see #callMethod
*/
public String[] getMethodNames();
/**
* This is called when a lua program on an attached computercraft calls peripheral.call() with
* one of the methods exposed by getMethodNames().<br>
* <br>
* Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe
* when interacting with minecraft objects.
* @param computer The interface to the computercraft that is making the call. Remember that multiple
* computers can be attached to a peripheral at once.
* @param context The context of the currently running lua thread. This can be used to wait for events
* or otherwise yield.
* @param method An integer identifying which of the methods from getMethodNames() the computercraft
* wishes to call. The integer indicates the index into the getMethodNames() table
* that corresponds to the string passed into peripheral.call()
* @param arguments An array of objects, representing the arguments passed into peripheral.call().<br>
* Lua values of type "string" will be represented by Object type String.<br>
* Lua values of type "number" will be represented by Object type Double.<br>
* Lua values of type "boolean" will be represented by Object type Boolean.<br>
* Lua values of any other type will be represented by a null object.<br>
* This array will be empty if no arguments are passed.
* @return An array of objects, representing values you wish to return to the lua program.<br>
* Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.<br>
* All other types will be converted to nil.<br>
* You may return null to indicate no values should be returned.
* @throws Exception If you throw any exception from this function, a lua error will be raised with the
* same message as your exception. Use this to throw appropriate errors if the wrong
* arguments are supplied to your method.
* @see #getMethodNames
*/
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException;
/**
* Is called when canAttachToSide has returned true, and a computercraft is attaching to the peripheral.
* This will occur when a peripheral is placed next to an active computercraft, when a computercraft is turned on next to a peripheral,
* or when a turtle travels into a square next to a peripheral.
* Between calls to attach() and detach(), the attached computercraft can make method calls on the peripheral using peripheral.call().
* This method can be used to keep track of which computers are attached to the peripheral, or to take action when attachment
* occurs.<br>
* <br>
* Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe
* when interacting with minecraft objects.
* @param computer The interface to the computercraft that is being attached. Remember that multiple
* computers can be attached to a peripheral at once.
* @see #detach
*/
public void attach(IComputerAccess computer);
/**
* Is called when a computercraft is detaching from the peripheral.
* This will occur when a computercraft shuts down, when the peripheral is removed while attached to computers,
* or when a turtle moves away from a square attached to a peripheral.
* This method can be used to keep track of which computers are attached to the peripheral, or to take action when detachment
* occurs.<br>
* <br>
* Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe
* when interacting with minecraft objects.
* @param computer The interface to the computercraft that is being detached. Remember that multiple
* computers can be attached to a peripheral at once.
* @see #detach
*/
public void detach(IComputerAccess computer);
/**
* TODO: Document me
*/
public boolean equals(IPeripheral other);
}
@@ -1,23 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.peripheral;
import net.minecraft.world.World;
/**
* This interface is used to create peripheral implementations for blocks
* @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(dan200.computercraft.api.peripheral.IPeripheralProvider)
*/
public interface IPeripheralProvider
{
/**
* Produce an peripheral implementation from a block location.
* @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(dan200.computercraft.api.peripheral.IPeripheralProvider)
* @return a peripheral, or null if there is not a peripheral here you'd like to handle.
*/
public IPeripheral getPeripheral(World world, int x, int y, int z, int side);
}
@@ -1,10 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
@API( owner="ComputerCraft", provides="ComputerCraft|API|Peripheral", apiVersion="1.66pr3" )
package dan200.computercraft.api.peripheral;
import cpw.mods.fml.common.API;
@@ -1,23 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.redstone;
import net.minecraft.world.World;
/**
* This interface is used to provide bundled redstone output for blocks
* @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(dan200.computercraft.api.redstone.IBundledRedstoneProvider)
*/
public interface IBundledRedstoneProvider
{
/**
* Produce an bundled redstone output from a block location.
* @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(dan200.computercraft.api.redstone.IBundledRedstoneProvider)
* @return a number in the range 0-65535 to indicate this block is providing output, or -1 if you do not wish to handle this block
*/
public int getBundledRedstoneOutput(World world, int x, int y, int z, int side);
}
@@ -1,10 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
@API( owner="ComputerCraft", provides="ComputerCraft|API|Redstone", apiVersion="1.66pr3" )
package dan200.computercraft.api.redstone;
import cpw.mods.fml.common.API;
@@ -1,168 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.turtle;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IPeripheral;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
/**
* The interface passed to turtle by turtles, providing methods that they can call.
* This should not be implemented by your classes. Do not interact with turtles except via this interface and ITurtleUpgrade.
*/
public interface ITurtleAccess
{
/**
* Returns the world in which the turtle resides.
* @return the world in which the turtle resides.
*/
public World getWorld();
/**
* Returns a vector containing the integer co-ordinates at which the turtle resides.
* @return a vector containing the integer co-ordinates at which the turtle resides.
*/
public ChunkCoordinates getPosition();
/**
* TODO: Document me
*/
public boolean teleportTo(World world, int x, int y, int z);
/**
* Returns a vector containing the floating point co-ordinates at which the turtle is rendered.
* This will shift when the turtle is moving.
* @param f The subframe fraction
* @return a vector containing the floating point co-ordinates at which the turtle resides.
*/
public Vec3 getVisualPosition(float f);
/**
* TODO: Document me
*/
public float getVisualYaw(float f);
/**
* Returns the world direction the turtle is currently facing.
* @return the world direction the turtle is currently facing.
*/
public int getDirection();
/**
* TODO: Document me
*/
public void setDirection(int dir);
/**
* TODO: Document me
*/
public int getSelectedSlot();
/**
* TODO: Document me
*/
public void setSelectedSlot(int slot);
/**
* Sets the colour of the turtle, as if the player had dyed it with a dye item.
* @param dyeColour 0-15 to dye the turtle one of the 16 standard minecraft colours, or -1 to remove the dye from the turtle.
*/
public void setDyeColour(int dyeColour);
/**
* Gets the colour the turtle has been dyed.
* @return 0-15 if the turtle has been dyed one of the 16 standard minecraft colours, -1 if the turtle is clean.
*/
public int getDyeColour();
/**
* TODO: Document me
*/
public IInventory getInventory();
/**
* TODO: Document me
*/
public boolean isFuelNeeded();
/**
* TODO: Document me
*/
public int getFuelLevel();
/**
* TODO: Document me
*/
public void setFuelLevel(int fuel);
/**
* TODO: Document me
*/
public int getFuelLimit();
/**
* Removes some fuel from the turtles fuel supply. Negative numbers can be passed in to INCREASE the fuel level of the turtle.
* @return Whether the turtle was able to consume the ammount of fuel specified. Will return false if you supply a number
* greater than the current fuel level of the turtle.
*/
public boolean consumeFuel(int fuel);
/**
* TODO: Document me
*/
public void addFuel(int fuel);
/**
* Adds a custom command to the turtles command queue. Unlike peripheral methods, these custom commands will be executed
* on the main thread, so are guaranteed to be able to access Minecraft objects safely, and will be queued up
* with the turtles standard movement and tool commands. An issued command will return an unique integer, which will
* be supplied as a parameter to a "turtle_response" event issued to the turtle after the command has completed. Look at the
* lua source code for "rom/apis/turtle" for how to build a lua wrapper around this functionality.
* @param command an object which will execute the custom command when its point in the queue is reached
* @return the objects the command returned when executed. you should probably return these to the player
* unchanged if called from a peripheral method.
* @see ITurtleCommand
*/
public Object[] executeCommand(ILuaContext context, ITurtleCommand command) throws LuaException, InterruptedException;
/**
* TODO: Document me
*/
public void playAnimation(TurtleAnimation animation);
/**
* Returns the turtle on the specified side of the turtle, if there is one.
* @return the turtle on the specified side of the turtle, if there is one.
*/
public ITurtleUpgrade getUpgrade(TurtleSide side);
/**
* TODO: Document me
*/
public void setUpgrade(TurtleSide side, ITurtleUpgrade upgrade);
/**
* Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one.
* @return the peripheral created by the upgrade on the specified side of the turtle, if there is one.
*/
public IPeripheral getPeripheral(TurtleSide side);
/**
* TODO: Document me
*/
public NBTTagCompound getUpgradeNBTData(TurtleSide side);
/**
* TODO: Document me
*/
public void updateUpgradeNBTData(TurtleSide side);
}
@@ -1,25 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.turtle;
/**
* An interface for objects executing custom turtle commands, used with ITurtleAccess.issueCommand
* @see dan200.computercraft.api.turtle.ITurtleAccess#executeCommand(dan200.computercraft.api.lua.ILuaContext, dan200.computercraft.api.turtle.ITurtleCommand)
*/
public interface ITurtleCommand
{
/**
* Will be called by the turtle on the main thread when it is time to execute the custom command.
* The handler should either perform the work of the command, and return success, or return
* failure with an error message to indicate the command cannot be executed at this time.
* @param turtle access to the turtle for whom the command was issued
* @return TurtleCommandResult.success() or TurtleCommandResult.failure( errorMessage )
* @see dan200.computercraft.api.turtle.ITurtleAccess#executeCommand(dan200.computercraft.api.lua.ILuaContext, dan200.computercraft.api.turtle.ITurtleCommand)
* @see dan200.computercraft.api.turtle.TurtleCommandResult
*/
public TurtleCommandResult execute(ITurtleAccess turtle);
}
@@ -1,94 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.turtle;
import dan200.computercraft.api.peripheral.IPeripheral;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
/**
* The primary interface for defining an turtle for Turtles. A turtle turtle
* can either be a new tool, or a new peripheral.
* @see dan200.computercraft.api.ComputerCraftAPI#registerTurtleUpgrade( ITurtleUpgrade )
*/
public interface ITurtleUpgrade
{
/**
* Gets a unique numerical identifier representing this type of turtle turtle.
* Like Minecraft common and item IDs, you should strive to make this number unique
* among all turtle turtle that have been released for ComputerCraft.
* The ID must be in the range 64 to 255, as the ID is stored as an 8-bit value,
* and 0-64 is reserved for future use by ComputerCraft. The turtle will
* fail registration if an already used ID is specified.
* @see dan200.computercraft.api.ComputerCraftAPI#registerTurtleUpgrade( ITurtleUpgrade )
*/
public int getUpgradeID();
/**
* Return a String to describe this type of turtle in turtle item names.
* Examples of built-in adjectives are "Wireless", "Mining" and "Crafty".
*/
public String getUnlocalisedAdjective();
/**
* Return whether this turtle adds a tool or a peripheral to the turtle.
* Currently, turtle crafting is restricted to one tool & one peripheral per turtle.
* @see TurtleUpgradeType for the differences between the two.
*/
public TurtleUpgradeType getType();
/**
* Return an item stack representing the type of item that a turtle must be crafted
* with to create a turtle which holds this turtle.
* Currently, turtle crafting is restricted to one tool & one peripheral per turtle.
*/
public ItemStack getCraftingItem();
/**
* Will only be called for Peripheral turtle. Creates a peripheral for a turtle
* being placed using this turtle. The peripheral created will be stored
* for the lifetime of the turtle, will have update() called once-per-tick, and will be
* attach'd detach'd and have methods called in the same manner as a Computer peripheral.
*
* @param turtle Access to the turtle that the peripheral is being created for.
* @param side Which side of the turtle (left or right) that the turtle resides on.
* @return The newly created peripheral. You may return null if this turtle is a Tool
* and this method is not expected to be called.
*/
public IPeripheral createPeripheral(ITurtleAccess turtle, TurtleSide side);
/**
* Will only be called for Tool turtle. Called when turtle.dig() or turtle.attack() is called
* by the turtle, and the tool is required to do some work.
* @param turtle Access to the turtle that the tool resides on.
* @param side Which side of the turtle (left or right) the tool resides on.
* @param verb Which action (dig or attack) the turtle is being called on to perform.
* @param direction Which world direction the action should be performed in, relative to the turtles
* position. This will either be up, down, or the direction the turtle is facing, depending on
* whether dig, digUp or digDown was called.
* @return Whether the turtle was able to perform the action, and hence whether the turtle.dig()
* or turtle.attack() lua method should return true. If true is returned, the tool will perform
* a swinging animation. You may return null if this turtle is a Peripheral
* and this method is not expected to be called.
*/
public TurtleCommandResult useTool(ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, int direction);
/**
* Called to obtain the IIcon to be used when rendering a turtle peripheral. Needs to be a "common"
* type IIcon for now, as there is no way to determine which texture sheet an IIcon is from by the
* IIcon itself.
* @param turtle Access to the turtle that the peripheral resides on.
* @param side Which side of the turtle (left or right) the peripheral resides on.
* @return The IIcon that you wish to be used to render your turtle peripheral.
*/
public IIcon getIcon(ITurtleAccess turtle, TurtleSide side);
/**
* TODO: Document me
*/
public void update(ITurtleAccess turtle, TurtleSide side);
}
@@ -1,21 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.turtle;
public enum TurtleAnimation
{
None,
MoveForward,
MoveBack,
MoveUp,
MoveDown,
TurnLeft,
TurnRight,
SwingLeftTool,
SwingRightTool,
Wait,
}
@@ -1,73 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.turtle;
public final class TurtleCommandResult
{
private static final TurtleCommandResult s_success = new TurtleCommandResult( true, null, null );
private static final TurtleCommandResult s_emptyFailure = new TurtleCommandResult( false, null, null );
public static TurtleCommandResult success()
{
return success( null );
}
public static TurtleCommandResult success( Object[] results )
{
if( results == null || results.length == 0 )
{
return s_success;
}
else
{
return new TurtleCommandResult( true, null, results );
}
}
public static TurtleCommandResult failure()
{
return failure( null );
}
public static TurtleCommandResult failure( String errorMessage )
{
if( errorMessage == null )
{
return s_emptyFailure;
}
else
{
return new TurtleCommandResult( false, errorMessage, null );
}
}
private final boolean m_success;
private final String m_errorMessage;
private final Object[] m_results;
private TurtleCommandResult( boolean success, String errorMessage, Object[] results )
{
m_success = success;
m_errorMessage = errorMessage;
m_results = results;
}
public boolean isSuccess()
{
return m_success;
}
public String getErrorMessage()
{
return m_errorMessage;
}
public Object[] getResults()
{
return m_results;
}
}
@@ -1,23 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.turtle;
/**
* An enum representing the two sides of the turtle that a turtle turtle might reside.
*/
public enum TurtleSide
{
/**
* The turtles left side (where the pickaxe usually is on a Wireless Mining Turtle)
*/
Left,
/**
* The turtles right side (where the modem usually is on a Wireless Mining Turtle)
*/
Right,
}
@@ -1,27 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.turtle;
/**
* An enum representing the two different types of turtle that an ITurtleUpgrade
* implementation can add to a turtle.
* @see dan200.computercraft.api.turtle.ITurtleUpgrade
*/
public enum TurtleUpgradeType
{
/**
* A tool is rendered as an item on the side of the turtle, and responds to the turtle.dig()
* and turtle.attack() methods (Such as pickaxe or sword on Mining and Melee turtles).
*/
Tool,
/**
* A peripheral adds a special peripheral which is attached to the side of the turtle,
* and can be interacted with the peripheral API (Such as the modem on Wireless Turtles).
*/
Peripheral,
}
@@ -1,26 +0,0 @@
/**
* This file is part of the public ComputerCraft API - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only.
* For help using the API, and posting your mods, visit the forums at computercraft.info.
*/
package dan200.computercraft.api.turtle;
/**
* An enum representing the two different actions that an ITurtleUpgrade of type
* Tool may be called on to perform by a turtle.
* @see ITurtleUpgrade
* @see ITurtleUpgrade#useTool
*/
public enum TurtleVerb
{
/**
* The turtle called turtle.dig(), turtle.digUp() or turtle.digDown()
*/
Dig,
/**
* The turtle called turtle.attack(), turtle.attackUp() or turtle.attackDown()
*/
Attack,
}
@@ -1,4 +0,0 @@
@API( owner="ComputerCraft", provides="ComputerCraft|API|Turtle", apiVersion="1.66pr3" )
package dan200.computercraft.api.turtle;
import cpw.mods.fml.common.API;
@@ -1,441 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 14, 2014, 6:15:28 PM (GMT)]
*/
package vazkii.botania.api;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.EnumHelper;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.internal.DummyMethodHandler;
import vazkii.botania.api.internal.DummySubTile;
import vazkii.botania.api.internal.IInternalMethodHandler;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.api.subtile.signature.BasicSignature;
import vazkii.botania.api.subtile.signature.SubTileSignature;
import vazkii.botania.api.wiki.IWikiProvider;
import vazkii.botania.api.wiki.SimpleWikiProvider;
import vazkii.botania.api.wiki.WikiHooks;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
public final class BotaniaAPI {
private static List<LexiconCategory> categories = new ArrayList<LexiconCategory>();
private static List<LexiconEntry> allEntries = new ArrayList<LexiconEntry>();
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<String, KnowledgeType>();
public static Map<String, Brew> brewMap = new LinkedHashMap<String, Brew>();
public static List<RecipePetals> petalRecipes = new ArrayList<RecipePetals>();
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<RecipeRuneAltar>();
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<RecipeManaInfusion>();
public static List<RecipeElvenTrade> elvenTradeRecipes = new ArrayList<RecipeElvenTrade>();
public static List<RecipeBrew> brewRecipes = new ArrayList<RecipeBrew>();
private static BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.<String, Class<? extends SubTileEntity>> create();
private static Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<Class<? extends SubTileEntity>, SubTileSignature>();
public static Set<String> subtilesForCreativeMenu = new LinkedHashSet();
public static Map<String, Integer> oreWeights = new HashMap<String, Integer>();
public static Map<Item, Block> seeds = new HashMap();
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18);
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
public static ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", 18, new int[] { 2, 6, 5, 2 }, 18);
public static ToolMaterial elementiumToolMaterial = EnumHelper.addToolMaterial("B_ELEMENTIUM", 3, 720, 6.2F, 2F, 20);
public static ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", 34, new int[] {3, 8, 6, 3}, 26);
public static ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 3, 2300, 9F, 3F, 26);
public static KnowledgeType basicKnowledge, elvenKnowledge;
// All of these categories are initialized during botania's PreInit stage.
public static LexiconCategory categoryBasics;
public static LexiconCategory categoryMana;
public static LexiconCategory categoryFunctionalFlowers;
public static LexiconCategory categoryGenerationFlowers;
public static LexiconCategory categoryDevices;
public static LexiconCategory categoryTools;
public static LexiconCategory categoryBaubles;
public static LexiconCategory categoryAlfhomancy;
public static LexiconCategory categoryMisc;
public static Brew fallbackBrew = new Brew("fallback", "botania.brew.fallback", 0, 0);
static {
registerSubTile("", DummySubTile.class);
basicKnowledge = registerKnowledgeType("minecraft", EnumChatFormatting.RESET, true);
elvenKnowledge = registerKnowledgeType("alfheim", EnumChatFormatting.DARK_GREEN, false);
addOreWeight("oreAluminum", 3940); // Tinkers' Construct
addOreWeight("oreAmber", 2075); // Thaumcraft
addOreWeight("oreApatite", 1595); // Forestry
addOreWeight("oreBlueTopaz", 3195); // Ars Magica
addOreWeight("oreCassiterite", 1634); // GregTech
addOreWeight("oreCertusQuartz", 3975); // Applied Energistics
addOreWeight("oreChimerite", 3970); // Ars Magica
addOreWeight("oreCinnabar", 2585); // Thaumcraft
addOreWeight("oreCoal", 46525); // Vanilla
addOreWeight("oreCooperite", 5); // GregTech
addOreWeight("oreCopper", 8325); // IC2, Thermal Expansion, Tinkers' Construct, etc.
addOreWeight("oreDarkIron", 1700); // Factorization
addOreWeight("oreDiamond", 1265); // Vanilla
addOreWeight("oreEmerald", 780); // Vanilla
addOreWeight("oreEmery", 415); // GregTech
addOreWeight("oreGalena", 1000); // Factorization
addOreWeight("oreGold", 2970); // Vanilla
addOreWeight("oreInfusedAir", 925); // Thaumcraft
addOreWeight("oreInfusedEarth", 925); // Thaumcraft
addOreWeight("oreInfusedEntropy", 925); // Thaumcraft
addOreWeight("oreInfusedFire", 925); // Thaumcraft
addOreWeight("oreInfusedOrder", 925); // Thaumcraft
addOreWeight("oreInfusedWater", 925); // Thaumcraft
addOreWeight("oreIridium", 30); // GregTech
addOreWeight("oreIron", 20665); // Vanilla
addOreWeight("oreLapis", 1285); // Vanilla
addOreWeight("oreLead", 7985); // IC2, Thermal Expansion, Factorization, etc.
addOreWeight("oreMCropsEssence", 3085); // Magical Crops
addOreWeight("oreNickel", 2275); // Thermal Expansion
addOreWeight("oreOlivine", 1100); // Project RED
addOreWeight("oreRedstone", 6885); // Vanilla
addOreWeight("oreRuby", 1100); // Project RED
addOreWeight("oreSapphire", 1100); // Project RED
addOreWeight("oreSilver", 6300); // Thermal Expansion, Factorization, etc.
addOreWeight("oreSphalerite", 25); // GregTech
addOreWeight("oreSulfur", 1105); // Railcraft
addOreWeight("oreTetrahedrite", 4040); // GregTech
addOreWeight("oreTin", 9450); // IC2, Thermal Expansion, etc.
addOreWeight("oreTungstate", 20); // GregTech
addOreWeight("oreUranium", 1337); // IC2
addOreWeight("oreVinteum", 5925); // Ars Magica
addOreWeight("oreYellorite", 3520); // Big Reactors
addOreWeight("oreZinc", 6485); // Flaxbeard's Steam Power
addSeed(Items.wheat_seeds, Blocks.wheat);
addSeed(Items.potato, Blocks.potatoes);
addSeed(Items.carrot, Blocks.carrots);
addSeed(Items.nether_wart, Blocks.nether_wart);
addSeed(Items.pumpkin_seeds, Blocks.pumpkin_stem);
addSeed(Items.melon_seeds, Blocks.melon_stem);
registerModWiki("Minecraft", new SimpleWikiProvider("Minecraft Wiki", "http://minecraft.gamepedia.com/%s"));
IWikiProvider technicWiki = new SimpleWikiProvider("Technic Wiki", "http://wiki.technicpack.net/%s");
IWikiProvider mekanismWiki = new SimpleWikiProvider("Mekanism Wiki", "http://wiki.aidancbrady.com/wiki/%s");
IWikiProvider buildcraftWiki = new SimpleWikiProvider("BuildCraft Wiki", "http://www.mod-buildcraft.com/wiki/doku.php?id=%s");
registerModWiki("Mekanism", mekanismWiki);
registerModWiki("MekanismGenerators", mekanismWiki);
registerModWiki("MekanismTools", mekanismWiki);
registerModWiki("EnderIO", new SimpleWikiProvider("EnderIO Wiki", "http://wiki.enderio.com/%s"));
registerModWiki("TropiCraft", new SimpleWikiProvider("Tropicraft Wiki", "http://wiki.tropicraft.net/wiki/%s"));
registerModWiki("RandomThings", new SimpleWikiProvider("Random Things Wiki", "http://randomthingsminecraftmod.wikispaces.com/%s"));
registerModWiki("Witchery", new SimpleWikiProvider("Witchery Wiki", "https://sites.google.com/site/witcherymod/%s", "-"));
registerModWiki("AppliedEnergistics2", new SimpleWikiProvider("AE2 Wiki", "http://ae-mod.info/%s"));
registerModWiki("BigReactors", technicWiki);
registerModWiki("BuildCraft|Core", buildcraftWiki);
registerModWiki("BuildCraft|Builders", buildcraftWiki);
registerModWiki("BuildCraft|Energy", buildcraftWiki);
registerModWiki("BuildCraft|Factory", buildcraftWiki);
registerModWiki("BuildCraft|Silicon", buildcraftWiki);
registerModWiki("BuildCraft|Transport", buildcraftWiki);
registerModWiki("ArsMagica2", new SimpleWikiProvider("ArsMagica2 Wiki", "http://wiki.arsmagicamod.com/wiki/%s"));
registerModWiki("PneumaticCraft", new SimpleWikiProvider("PneumaticCraft Wiki", "http://www.minemaarten.com/wikis/pneumaticcraft-wiki/pneumaticcraft-wiki-%s"));
registerModWiki("StevesCarts2", new SimpleWikiProvider("Steve's Carts Wiki", "http://stevescarts2.wikispaces.com/%s"));
registerModWiki("GanysSurface", new SimpleWikiProvider("Gany's Surface Wiki", "http://ganys-surface.wikia.com/wiki/%s"));
registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s"));
registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s"));
}
/**
* The internal method handler in use. Do not overwrite.
* @see vazkii.botania.api.internal.IInternalMethodHandler
*/
public static IInternalMethodHandler internalHandler = new DummyMethodHandler();
/**
* Registers a new Knowledge Type.
* @param id The ID for this knowledge type.
* @param color The color to display this knowledge type as.
*/
public static KnowledgeType registerKnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) {
KnowledgeType type = new KnowledgeType(id, color, autoUnlock);
knowledgeTypes.put(id, type);
return type;
}
/**
* Registers a Brew and returns it.
*/
public static Brew registerBrew(Brew brew) {
brewMap.put(brew.getKey(), brew);
return brew;
}
/**
* Gets a brew from the key passed in, returns the fallback if
* it's not in the map.
*/
public static Brew getBrewFromKey(String key) {
if(brewMap.containsKey(key))
return brewMap.get(key);
return fallbackBrew;
}
/**
* Registers a Petal Recipe.
* @param output The ItemStack to craft.
* @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper
* or String (case for Ore Dictionary). The array can't be larger than 16.
* @return The recipe created.
*/
public static RecipePetals registerPetalRecipe(ItemStack output, Object... inputs) {
RecipePetals recipe = new RecipePetals(output, inputs);
petalRecipes.add(recipe);
return recipe;
}
/**
* Registers a Rune Altar
* @param output The ItemStack to craft.
* @param mana The amount of mana required. Don't go over 100000!
* @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper
* or String (case for Ore Dictionary). The array can't be larger than 16.
* @return The recipe created.
*/
public static RecipeRuneAltar registerRuneAltarRecipe(ItemStack output, int mana, Object... inputs) {
RecipeRuneAltar recipe = new RecipeRuneAltar(output, mana, inputs);
runeAltarRecipes.add(recipe);
return recipe;
}
/**
* Registers a Mana Infusion Recipe (throw an item in a mana pool)
* @param output The ItemStack to craft
* @param input The input item, be it an ItemStack or an ore dictionary entry String.
* @param mana The amount of mana required. Don't go over 100000!
* @return The recipe created.
*/
public static RecipeManaInfusion registerManaInfusionRecipe(ItemStack output, Object input, int mana) {
RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana);
manaInfusionRecipes.add(recipe);
return recipe;
}
/**
* Register a Mana Infusion Recipe and flags it as an Alchemy recipe (requires an
* Alchemy Catalyst below the pool).
* @see vazkii.botania.api.BotaniaAPI#registerManaInfusionRecipe
*/
public static RecipeManaInfusion registerManaAlchemyRecipe(ItemStack output, Object input, int mana) {
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
recipe.setAlchemy(true);
return recipe;
}
/**
* Register a Mana Infusion Recipe and flags it as an Conjuration recipe (requires a
* Conjuration Catalyst below the pool).
* @see vazkii.botania.api.BotaniaAPI#registerManaInfusionRecipe
*/
public static RecipeManaInfusion registerManaConjurationRecipe(ItemStack output, Object input, int mana) {
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
recipe.setConjuration(true);
return recipe;
}
/**
* Registers a Elven Trade recipe (throw an item in an Alfheim Portal).
* @param output The ItemStack to return.
* @param inputs The items required, can be ItemStack or ore dictionary entry string.
* @return The recipe created.
*/
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
RecipeElvenTrade recipe = new RecipeElvenTrade(output, inputs);
elvenTradeRecipes.add(recipe);
return recipe;
}
/**
* Registers a Brew Recipe (for the Botanical Brewery).
* @param brew The brew in to be set in this recipe.
* @inputs The items used in the recipe, no more than 6.
*/
public static RecipeBrew registerBrewRecipe(Brew brew, Object... inputs) {
RecipeBrew recipe = new RecipeBrew(brew, inputs);
brewRecipes.add(recipe);
return recipe;
}
/**
* Registers a SubTileEntity, a new special flower. Look in the subtile package of the API.
*/
public static void registerSubTile(String key, Class<? extends SubTileEntity> subtileClass) {
subTiles.put(key, subtileClass);
}
/**
* Registers a SubTileEntity's signature.
* @see vazkii.botania.api.subtile.signature.SubTileSignature
*/
public static void registerSubTileSignature(Class<? extends SubTileEntity> subtileClass, SubTileSignature signature) {
subTileSignatures.put(subtileClass, signature);
}
/**
* Gets the singleton signature for a SubTileEntity class. Registers a fallback if one wasn't registered
* before the call.
*/
public static SubTileSignature getSignatureForClass(Class<? extends SubTileEntity> subtileClass) {
if(!subTileSignatures.containsKey(subtileClass))
registerSubTileSignature(subtileClass, new BasicSignature(subTiles.inverse().get(subtileClass)));
return subTileSignatures.get(subtileClass);
}
/**
* Gets the singleton signature for a SubTileEntity's name. Registers a fallback if one wasn't registered
* before the call.
*/
public static SubTileSignature getSignatureForName(String name) {
Class<? extends SubTileEntity> subtileClass = subTiles.get(name);
return getSignatureForClass(subtileClass);
}
/**
* Adds the key for a SubTileEntity into the creative menu. This goes into the
* subtilesForCreativeMenu Set.
*/
public static void addSubTileToCreativeMenu(String key) {
subtilesForCreativeMenu.add(key);
}
/**
* Adds a category to the list of registered categories to appear in the Lexicon.
*/
public static void addCategory(LexiconCategory category) {
categories.add(category);
}
/**
* Gets all registered categories.
*/
public static List<LexiconCategory> getAllCategories() {
return categories;
}
/**
* Gets all registered entries.
*/
public static List<LexiconEntry> getAllEntries() {
return allEntries;
}
/**
* Registers a Lexicon Entry and adds it to the category passed in.
*/
public static void addEntry(LexiconEntry entry, LexiconCategory category) {
allEntries.add(entry);
category.entries.add(entry);
}
/**
* Maps an ore (ore dictionary key) to it's weight on the world generation. This
* is used for the Orechid flower. Check the static block in the BotaniaAPI class
* to get the weights for the vanilla blocks.<br>
* Alternatively get the values with the OreDetector mod:<br>
* https://gist.github.com/Vazkii/9493322
*/
public static void addOreWeight(String ore, int weight) {
oreWeights.put(ore, weight);
}
public static int getOreWeight(String ore) {
return oreWeights.get(ore);
}
/**
* Allows an item to be counted as a seed. Any item in this list can be
* dispensed by a dispenser, the block is the block to be placed.
*/
public static void addSeed(Item item, Block block) {
seeds.put(item, block);
}
/**
* Gets the last recipe to have been added to the recipe list.
*/
public static IRecipe getLatestAddedRecipe() {
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
return list.get(list.size() - 1);
}
/**
* Gets the last x recipes added to the recipe list.
*/
public static List<IRecipe> getLatestAddedRecipes(int x) {
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
List<IRecipe> newList = new ArrayList();
for(int i = x - 1; i >= 0; i--)
newList.add(list.get(list.size() - 1 - i));
return newList;
}
/**
* Registers a Wiki provider for a mod so it uses that instead of the fallback
* FTB wiki. Make sure to call this on PostInit only!
*/
public static void registerModWiki(String mod, IWikiProvider provider) {
WikiHooks.registerModWiki(mod, provider);
}
public static Class<? extends SubTileEntity> getSubTileMapping(String key) {
if(!subTiles.containsKey(key))
key = "";
return subTiles.get(key);
}
public static String getSubTileStringMapping(Class<? extends SubTileEntity> clazz) {
return subTiles.inverse().get(clazz);
}
}
@@ -1,61 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 29, 2014, 6:09:48 PM (GMT)]
*/
package vazkii.botania.api.boss;
import java.awt.Rectangle;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* An extension of IBossDisplayData. This counts as a botania boss and as a normal
* minecraft boss since it has IBossDisplayData. Instead of using the typical
* BossStatus.setBossStatus(entity, true) to set the health bar in the render use
* BotaniaAPI.internalMethodHandler.setBossStatus(entity);<br><br>
* Alternatively, you can check if botania is loaded and use the vanilla one
* if that's not the case.
*/
public interface IBotaniaBoss extends IBossDisplayData {
/**
* The ResourceLocation to bind for this boss's boss bar.
* You can use BotaniaAPI.internalMethodHandler.getDefaultBossBarTexture() to get
* the one used by botania bosses.
*/
@SideOnly(Side.CLIENT)
public ResourceLocation getBossBarTexture();
/**
* A Rectangle instance delimiting the uv, width and height of this boss's
* boss bar texture. This is for the background, not the bar that shows
* the HP.
*/
@SideOnly(Side.CLIENT)
public Rectangle getBossBarTextureRect();
/**
* A Rectangle instance delimiting the uv, width and height of this boss's
* boss bar HP texture. This is for the foreground that shows how much
* HP the boss has. The width of the rectangle will be multiplied by the
* faction of the boss's current HP by max HP.
*/
@SideOnly(Side.CLIENT)
public Rectangle getBossBarHPTextureRect();
/**
* A callback for when this boss's boss bar renders, you can do aditional rendering
* here if needed.
*/
@SideOnly(Side.CLIENT)
public void bossBarRenderCallback();
}
@@ -1,42 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 29, 2014, 6:13:21 PM (GMT)]
*/
package vazkii.botania.api.boss;
import vazkii.botania.api.internal.ShaderCallback;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* A Botania boss whose HP bar makes use of shaders. Shaders
* used through this have a few uniforms available:
* <li><b><i>int</i> time</b> - The amount of total ticks elapsed.</li>
* <li><b><i>int</i> startX</b> - The U coordinate passed in for the render of this bar's texture.</li>
* <li><b><i>int</i> startY</b> - The V coordinate passed in for the render of this bar's texture.</li>
*/
public interface IBotaniaBossWithShader extends IBotaniaBoss {
/**
* The Shader Program to use for this boss bar. Return 0 case
* you don't want a shader to be used. You can use separate shaders
* for the background and foreground.
* @param background True if rendering the background of the boss bar,
* false if rendering the bar itself that shows the HP.
*/
@SideOnly(Side.CLIENT)
public int getBossBarShaderProgram(boolean background);
/**
* A callback for the shader, used to pass in uniforms. Return null for no callback.
*/
@SideOnly(Side.CLIENT)
public ShaderCallback getBossBarShaderCallback(boolean background, int shader);
}
@@ -1,113 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Nov 1, 2014, 6:22:54 PM (GMT)]
*/
package vazkii.botania.api.brew;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
/**
* The class for a Brew definition, each one is a singleton.
*/
public class Brew {
String key;
String name;
int color;
int cost;
List<PotionEffect> effects;
boolean canInfuseBloodPendant = true;
/**
* @param name The unlocalized name of this potion.
* @param color The color for the potion to be rendered in the bottle, note that it will get
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
* @param cost The cost, in Mana for this brew.
* @param effects A list of effects to apply to the player when they drink it.
*/
public Brew(String key, String name, int color, int cost, PotionEffect... effects) {
this.key = key;
this.name = name;
this.color = color;
this.cost = cost;
this.effects = new ArrayList(Arrays.asList(effects));
}
/**
* Sets this brew to not be able to be infused onto the Tainted Blood Pendant.
*/
public Brew setNotBloodPendantInfusable() {
canInfuseBloodPendant = false;
return this;
}
public boolean canInfuseBloodPendant() {
return canInfuseBloodPendant;
}
/**
* Returns the key for this brew, for it to be found in the map in the API.
* This should ALWAYS return the same result.
*/
public String getKey() {
return key;
}
/**
* Gets the insensitive unlocalized name. This is used for the lexicon.
*/
public String getUnlocalizedName() {
return name;
}
/**
* Gets the unlocalized name for the ItemStack passed in.
*/
public String getUnlocalizedName(ItemStack stack) {
return getUnlocalizedName();
}
/**
* Gets the display color for the ItemStack passed in. Note that for
* the lexicon, this passes in a botania Managlass Vial or an
* Alfglass Flask at all times.
*/
public int getColor(ItemStack stack) {
return color;
}
/**
* Gets the insensitive unlocalized mana cost. This is used for the lexicon.
*/
public int getManaCost() {
return cost;
}
/**
* Gets the mana cost for the ItemStack passed in.
*/
public int getManaCost(ItemStack stack) {
return getManaCost();
}
/**
* Gets the list of potion effects for the ItemStack passed in.
* Note that for the lexicon, this passes in a botania Managlass
* Vial or an Alfglass Flask at all times.
*/
public List<PotionEffect> getPotionEffects(ItemStack stack) {
return effects;
}
}
@@ -1,35 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Nov 1, 2014, 6:26:40 PM (GMT)]
*/
package vazkii.botania.api.brew;
import net.minecraft.item.ItemStack;
/**
* An Item that implements this counts as a Brew Container, by which
* it can be used a center item for brew recipes and can contain
* a brew.
*/
public interface IBrewContainer {
/**
* Returs an ItemStack that should be an item that has the brew
* passed in.
*/
public ItemStack getItemForBrew(Brew brew, ItemStack stack);
/**
* Gets the cost to add this brew onto this container. Return -1
* to not allow for the brew to be added. Normally you'd
* use brew.getManaCost(stack);
*/
public int getManaCost(Brew brew, ItemStack stack);
}
@@ -1,24 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Nov 1, 2014, 9:20:33 PM (GMT)]
*/
package vazkii.botania.api.brew;
import net.minecraft.item.ItemStack;
/**
* An Item that implements this is a Brew item, by which it contains
* a brew. This is only used in vanilla to prevent the brew item
* from going back into the brewery but other mods might use it for whatever.
*/
public interface IBrewItem {
public Brew getBrew(ItemStack brew);
}
@@ -1,50 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 7, 2014, 3:47:43 PM (GMT)]
*/
package vazkii.botania.api.internal;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import vazkii.botania.api.mana.TileSignature;
public class DummyManaNetwork implements IManaNetwork {
public static final DummyManaNetwork instance = new DummyManaNetwork();
@Override
public void clear() {
// NO-OP
}
@Override
public TileEntity getClosestPool(ChunkCoordinates pos, World world, int limit) {
return null;
}
@Override
public TileEntity getClosestCollector(ChunkCoordinates pos, World world, int limit) {
return null;
}
@Override
public List<TileSignature> getAllCollectorsInWorld(World world) {
return new ArrayList();
}
@Override
public List<TileSignature> getAllPoolsInWorld(World world) {
return new ArrayList();
}
}
@@ -1,180 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 14, 2014, 6:43:03 PM (GMT)]
*/
package vazkii.botania.api.internal;
import java.util.List;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipeRuneAltar;
public class DummyMethodHandler implements IInternalMethodHandler {
@Override
public LexiconPage textPage(String key) {
return dummyPage(key);
}
@Override
public LexiconPage elfPaperTextPage(String key) {
return dummyPage(key);
}
@Override
public LexiconPage imagePage(String key, String resource) {
return dummyPage(key);
}
@Override
public LexiconPage craftingRecipesPage(String key, List<IRecipe> recipes) {
return dummyPage(key);
}
@Override
public LexiconPage craftingRecipePage(String key, IRecipe recipe) {
return dummyPage(key);
}
@Override
public LexiconPage petalRecipesPage(String key, List<RecipePetals> recipes) {
return dummyPage(key);
}
@Override
public LexiconPage petalRecipePage(String key, RecipePetals recipe) {
return dummyPage(key);
}
@Override
public LexiconPage runeRecipesPage(String key, List<RecipeRuneAltar> recipes) {
return dummyPage(key);
}
@Override
public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe) {
return dummyPage(key);
}
@Override
public LexiconPage manaInfusionRecipesPage(String key, List<RecipeManaInfusion> recipes) {
return dummyPage(key);
}
@Override
public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe) {
return dummyPage(key);
}
@Override
public LexiconPage elvenTradePage(String key, List<RecipeElvenTrade> recipes) {
return dummyPage(key);
}
@Override
public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe) {
return dummyPage(key);
}
@Override
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe) {
return dummyPage(key);
}
private LexiconPage dummyPage(String key) {
return new DummyPage(key);
}
@Override
public ItemStack getSubTileAsStack(String subTile) {
return new ItemStack(Blocks.stone, 0, 0);
}
@Override
public ItemStack getSubTileAsFloatingFlowerStack(String subTile) {
return getSubTileAsStack(subTile);
}
@Override
public IIcon getSubTileIconForName(String name) {
return Blocks.red_flower.getIcon(0, 0);
}
@Override
public void registerBasicSignatureIcons(String name, IIconRegister register) {
// NO-OP
}
@Override
public IManaNetwork getManaNetworkInstance() {
return DummyManaNetwork.instance;
}
@Override
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
// NO-OP
}
@Override
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {
// NO-OP
}
@Override
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
// NO-OP
}
@Override
public IInventory getBaublesInventory(EntityPlayer player) {
return null;
}
@Override
public boolean shouldForceCheck() {
return true;
}
@Override
public int getPassiveFlowerDecay() {
return 0;
}
@Override
public ResourceLocation getDefaultBossBarTexture() {
return null;
}
@Override
public void setBossStatus(IBotaniaBoss status) {
// NO-OP
}
@Override
public boolean isBuildcraftPipe(TileEntity tile) {
return false;
}
}
@@ -1,34 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 14, 2014, 6:41:23 PM (GMT)]
*/
package vazkii.botania.api.internal;
import vazkii.botania.api.lexicon.LexiconPage;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* A dummy page. It does absolutely nothing and is only
* existant to make sure everything goes right even if
* Botania isn't loaded.
*/
public class DummyPage extends LexiconPage {
public DummyPage(String unlocalizedName) {
super(unlocalizedName);
}
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(IGuiLexiconEntry gui, int x, int y) {
// NO-OP
}
}
@@ -1,17 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 24, 2014, 4:17:33 PM (GMT)]
*/
package vazkii.botania.api.internal;
import vazkii.botania.api.subtile.SubTileEntity;
public class DummySubTile extends SubTileEntity {
}
@@ -1,81 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 14, 2014, 6:48:41 PM (GMT)]
*/
package vazkii.botania.api.internal;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import vazkii.botania.api.lexicon.LexiconEntry;
/**
* Internal interface for the Lexicon Entry GUI. This contains
* everything that can be accessed from it. It's safe to cast
* this type to GuiScreen.
*/
public interface IGuiLexiconEntry {
/**
* Gets the entry currently portrayed in this gui.
*/
public LexiconEntry getEntry();
/**
* Gets the current page the lexicon GUI is browsing.
*/
public int getPageOn();
/**
* Gets the leftmost part of the GUI.
*/
public int getLeft();
/**
* Gets the topmost part of the GUI.
*/
public int getTop();
/**
* Gets the GUI's width.
*/
public int getWidth();
/**
* Gets the GUI's height
*/
public int getHeight();
/**
* Gets the GUI's Z level for rendering.
*/
public float getZLevel();
/**
* Gets the list of buttons in this gui.
*/
public List<GuiButton> getButtonList();
/**
* Gets the total amount of ticks (+ partial ticks) the player
* has been in this gui.
*/
public float getElapsedTicks();
/**
* Gets the current partial ticks.
*/
public float getPartialTicks();
/**
* Gets the delta (1F = 1 tick) between this render call
* and the last one.
*/
public float getTickDelta();
}
@@ -1,104 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 14, 2014, 6:34:34 PM (GMT)]
*/
package vazkii.botania.api.internal;
import java.util.List;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Any methods that refer to internal methods in Botania are here.
* This is defaulted to a dummy handler, whose methods do nothing.
* This handler is set to a proper one on PreInit. Make sure to
* make your mod load after Botania if you have any intention of
* doing anythign with this on PreInit.
*/
public interface IInternalMethodHandler {
public LexiconPage textPage(String key);
public LexiconPage elfPaperTextPage(String key);
public LexiconPage imagePage(String key, String resource);
public LexiconPage craftingRecipesPage(String key, List<IRecipe> recipes);
public LexiconPage craftingRecipePage(String key, IRecipe recipe);
public LexiconPage petalRecipesPage(String key, List<RecipePetals> recipes);
public LexiconPage petalRecipePage(String key, RecipePetals recipe);
public LexiconPage runeRecipesPage(String key, List<RecipeRuneAltar> recipes);
public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe);
public LexiconPage manaInfusionRecipesPage(String key, List<RecipeManaInfusion> recipes);
public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe);
public LexiconPage elvenTradePage(String key, List<RecipeElvenTrade> recipes);
public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe);
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe);
public IManaNetwork getManaNetworkInstance();
public ItemStack getSubTileAsStack(String subTile);
public ItemStack getSubTileAsFloatingFlowerStack(String subTile);
public IIcon getSubTileIconForName(String name);
public void registerBasicSignatureIcons(String name, IIconRegister register);
public boolean shouldForceCheck();
public int getPassiveFlowerDecay();
public IInventory getBaublesInventory(EntityPlayer player);
@SideOnly(Side.CLIENT)
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res);
@SideOnly(Side.CLIENT)
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText);
@SideOnly(Side.CLIENT)
public ResourceLocation getDefaultBossBarTexture();
@SideOnly(Side.CLIENT)
public void setBossStatus(IBotaniaBoss status);
public boolean isBuildcraftPipe(TileEntity tile);
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m);
}
@@ -1,61 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 31, 2014, 4:36:13 PM (GMT)]
*/
package vazkii.botania.api.internal;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
/**
* Interface for the Mana Burst entity. This can safely be casted to EntityThrowable.
*/
public interface IManaBurst {
public boolean isFake();
public void setMotion(double x, double y, double z);
public int getColor();
public void setColor(int color);
public int getMana();
public void setMana(int mana);
public int getStartingMana();
public void setStartingMana(int mana);
public int getMinManaLoss();
public void setMinManaLoss(int minManaLoss);
public float getManaLossPerTick();
public void setManaLossPerTick(float mana);
public float getGravity();
public void setGravity(float gravity);
public ChunkCoordinates getBurstSourceChunkCoordinates();
public void setBurstSourceCoords(int x, int y, int z);
public ItemStack getSourceLens();
public void setSourceLens(ItemStack lens);
public boolean hasAlreadyCollidedAt(int x, int y, int z);
public int getTicksExisted();
}
@@ -1,67 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 7, 2014, 3:39:48 PM (GMT)]
*/
package vazkii.botania.api.internal;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import vazkii.botania.api.mana.TileSignature;
/**
* A basic interface for a world's Mana Network.
* @see IInternalMethodHandler#getManaNetworkInstance()
*/
public interface IManaNetwork {
/**
* Clears the entire Mana Network of all it's contents, you probably
* don't want to call this unless you have a very good reason.
*/
public void clear();
/**
* Gets the closest Mana Collector (eg. Mana Spreader) in the network to the Chunk
* Coordinates passed in, in the given dimension.<br>
* A way of getting the dimension is via worldObj.provider.dimensionId<br>
* Note that this function *can* get performance intensive, it's reccomended you
* call it sparingly and take cache of the value returned.
* @param limit The maximum distance the closest block can be, if the closest block
* is farther away than that, null will be returned instead.
*/
public TileEntity getClosestCollector(ChunkCoordinates pos, World world, int limit);
/**
* Gets the closest Mana Pool in the network to the Chunk Coordinates passed in,
* in the given dimension.<br>
* A way of getting the dimension is via worldObj.provider.dimensionId<br>
* Note that this function *can* get performance intensive, it's reccomended you
* call it sparingly and take cache of the value returned.
* @param limit The maximum distance the closest block can be, if the closest block
* is farther away than that, null will be returned instead.
*/
public TileEntity getClosestPool(ChunkCoordinates pos, World world, int limit);
/**
* Gets the list of all Mana Collectors (eg. Mana Spreader) in the dimension
* passed in. Note that this is the actual list and not a copy, make sure to
* clone the list if you intend to change it in any way.
*/
public List<TileSignature> getAllCollectorsInWorld(World world);
/**
* Gets the list of all Mana Pools in the dimension passed in. Note that this
* is the actual list and not a copy, make sure to clone the list if you intend
* to change it in any way.
*/
public List<TileSignature> getAllPoolsInWorld(World world);
}
@@ -1,20 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 29, 2014, 6:31:35 PM (GMT)]
*/
package vazkii.botania.api.internal;
/**
* A Callback for when a shader is called. Used to define shader uniforms.
*/
public abstract class ShaderCallback {
public abstract void call(int shader);
}
@@ -1,76 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Dec 4, 2014, 3:28:43 PM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderPlayerEvent;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* A Bauble Item that implements this will be have hooks to render something on
* the player while its equipped.
* This class doesn't extend IBauble to make the API not depend on the Baubles
* API, but the item in question still needs to implement IBauble.
*/
public interface IBaubleRender {
/**
* Called for the rendering of the bauble on the player. The player instance can be
* acquired through the event parameter. Transformations are already applied for
* the RenderType passed in. Make sure to check against the type parameter for
* rendering.
*/
@SideOnly(Side.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type);
/**
* A few helper methods for the render.
*/
public static class Helper {
public static void rotateIfSneaking(EntityPlayer player) {
if(player.isSneaking())
applySneakingRotation();
}
public static void applySneakingRotation() {
GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
}
public static void translateToHeadLevel(EntityPlayer player) {
GL11.glTranslated(0, (player != Minecraft.getMinecraft().thePlayer ? 1.62F : 0F) - player.getDefaultEyeHeight() + (player.isSneaking() ? 0.0625 : 0), 0);
}
}
public static enum RenderType {
/**
* Render Type for the player's body, translations apply on the player's rotation.
* Sneaking is not handled and should be done during the render.
* @see vazkii.botania.api.item.IBaubleRender.Helper
*/
BODY,
/**
* Render Type for the player's body, translations apply on the player's head rotations.
* Sneaking is not handled and should be done during the render.~
* @see vazkii.botania.api.item.IBaubleRender.Helper
*/
HEAD;
}
}
@@ -1,20 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 24, 2015, 3:08:40 PM (GMT)]
*/
package vazkii.botania.api.item;
/**
* Base Interface for the Manaseer Monocle and items of the sort.
* Having a IBauble of this type equipped on the 0th slot (amulet)
* will draw bursts without depth testing.
*/
public interface IBurstViewerBauble {
}
@@ -1,24 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 18, 2015, 12:20:44 AM (GMT)]
*/
package vazkii.botania.api.item;
/**
* Used to define a Mana Pool that can be dyed through floral powder.
*/
public interface IDyablePool {
public int getColor();
public void setColor(int color);
}
@@ -1,43 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 30, 2014, 4:28:29 PM (GMT)]
*/
package vazkii.botania.api.item;
/**
* A TileEntity that implements this can be heated by an Exoflame flower.
*/
public interface IExoflameHeatable {
/**
* Can this TileEntity smelt its contents. If true, the Exoflame is allowed
* to fuel it.
*/
public boolean canSmelt();
/**
* Gets the amount of ticks left for the fuel. If below 2, the exoflame
* will call boostBurnTime.
*/
public int getBurnTime();
/**
* Called to increase the amount of time this furnace should be burning
* the fuel for. Even if it doesn't have any fuel.
*/
public void boostBurnTime();
/**
* Called once every two ticks to increase the speed of the furnace. Feel
* free to not do anything if all you want is to allow the exoflame to feed
* it, not make it faster.
*/
public void boostCookTime();
}
@@ -1,28 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 6, 2014, 6:02:29 PM (GMT)]
*/
package vazkii.botania.api.item;
/**
* An interface that defines an instance of PlayerControllerMP with
* the ability to modify reach. See vazkii.botania.client.core.handler.BotaniaPlayerController
*/
public interface IExtendedPlayerController {
/**
* Sets the extra reach the player should have.
*/
public void setReachDistanceExtension(float f);
/**
* Gets the current reach extension.
*/
public float getReachDistanceExtension();
}
@@ -1,21 +0,0 @@
/**
* This class was created by <SpitefulFox>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [? (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.world.World;
/**
* A BiomeGenBase that implements this will not have Botania flowers generated.
*/
public interface IFlowerlessBiome {
/**
* @return Should this world be allowed to generate flowers?
*/
public boolean canGenerateFlowers(World world, int x, int z);
}
@@ -1,24 +0,0 @@
/**
* This class was created by <TheLoneDevil>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [? (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.world.World;
/**
* A WorldProvider that implements this will not have Botania flowers generated.
*/
public interface IFlowerlessWorld {
/**
* @return Should this world be allowed to generate flowers?
*/
public boolean generateFlowers(World world);
}
@@ -1,23 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 29, 2014, 4:52:04 PM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.world.World;
/**
* A BlockBush can implement this to check if it can be broken
* by a Horn/Drum of the Wild or not.
*/
public interface IGrassHornExcempt {
public boolean canUproot(World world, int x, int y, int z);
}
@@ -1,29 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 18, 2015, 12:10:00 AM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.mana.IManaPool;
/**
* An item that implements this will have a function called when its standing atop
* a mana pool.
*/
public interface IManaDissolvable {
/**
* Called for every tick the item is on a mana pool. If the stack has stack
* size 0 the item is killed. This is called in both the server and client.
*/
public void onDissolveTick(IManaPool pool, ItemStack stack, EntityItem item);
}
@@ -1,29 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 30, 2014, 4:22:15 PM (GMT)]
*/
package vazkii.botania.api.item;
/**
* Base Interface for the Petal Apothecary block. Can
* be safely casted to TileEntity.
*/
public interface IPetalApothecary {
/**
* Sets if the the apothecary has water or not.
*/
public void setWater(boolean water);
/**
* Does the apothecary have water in it?
*/
public boolean hasWater();
}
@@ -1,29 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 6, 2014, 6:06:27 PM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.item.ItemStack;
/**
* Any item that implements this allows for pixies to be spawned when the player takes damage when...<br>
* - Case the item is armor, having it equipped.<br>
* - Case the item is a bauble, having it worn.<br>
* - On any other case, having the item being the current held item.
*/
public interface IPixieSpawner {
/**
* The chance this item adds for pixies to be spawned. From 0.0 to 1.0. All values
* are put together when calculating.
*/
public float getPixieChance(ItemStack stack);
}
@@ -1,28 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jun 8, 2014, 7:02:48 PM (GMT)]
*/
package vazkii.botania.api.lexicon;
/**
* Have a LexiconEntry implement this to signify it's an "Addon entry", as
* in, one provided by an Addon. This allows it to draw a subtitle of
* sorts, to prevent the [Mod tag here] nonsense that happened with thaumcraft
* addons. It can also be used for other purposes, such as stating an
* entry is WIP.
*/
public interface IAddonEntry {
/**
* Returns the <b>unlocalized</b> subtitle to show below the title. Here you'd
* return something like "(This Entry is provided by the Botanic Tinkerer addon)".
*/
public String getSubtitle();
}
@@ -1,21 +0,0 @@
package vazkii.botania.api.lexicon;
import net.minecraft.item.ItemStack;
/**
* Basic interface for the Lexica Botania.
*/
public interface ILexicon {
/**
* Gets if a specific knowledge is unlocked. Check the knowledge types in
* BotaniaAPI.
*/
public boolean isKnowledgeUnlocked(ItemStack stack, KnowledgeType knowledge);
/**
* Unlocks a specfic type of knowledge.
*/
public void unlockKnowledge(ItemStack stack, KnowledgeType knowledge);
}
@@ -1,28 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 20, 2014, 7:05:44 PM (GMT)]
*/
package vazkii.botania.api.lexicon;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Any block that implements this can be right clicked with
* a Lexica Botania to open a entry page.
*/
public interface ILexiconable {
/**
* Gets the lexicon entry to open at this location. null works too.
*/
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon);
}
@@ -1,23 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 20, 2014, 6:08:48 PM (GMT)]
*/
package vazkii.botania.api.lexicon;
import net.minecraft.item.ItemStack;
/**
* Have an Item implement this so that the method used for mapping it into
* the lexicon recipe mappings isn't the typical id:meta key.
*/
public interface IRecipeKeyProvider {
public String getKey(ItemStack stack);
}
@@ -1,23 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Nov 3, 2014, 2:59:55 PM (GMT)]
*/
package vazkii.botania.api.lexicon;
/**
* A LexiconPage that implements this has two unlocalized names
* rather than one. (See brew pages)
*/
public interface ITwoNamedPage {
public void setSecondUnlocalizedName(String name);
public String getSecondUnlocalizedName();
}
@@ -1,20 +0,0 @@
package vazkii.botania.api.lexicon;
import net.minecraft.util.EnumChatFormatting;
public class KnowledgeType {
public final String id;
public final EnumChatFormatting color;
public final boolean autoUnlock;
public KnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) {
this.id = id;
this.color = color;
this.autoUnlock = autoUnlock;
}
public String getUnlocalizedName() {
return "botania.knowledge." + id;
}
}
@@ -1,76 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 14, 2014, 6:23:47 PM (GMT)]
*/
package vazkii.botania.api.lexicon;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.util.ResourceLocation;
public class LexiconCategory implements Comparable<LexiconCategory> {
private static int count = 0;
public final String unlocalizedName;
public final List<LexiconEntry> entries = new ArrayList<LexiconEntry>();
private final int sortingId;
private ResourceLocation icon;
private int priority = 5;
/**
* @param unlocalizedName The unlocalized name of this category. This will be localized by the client display.
*/
public LexiconCategory(String unlocalizedName) {
this.unlocalizedName = unlocalizedName;
sortingId = count;
count++;
}
public String getUnlocalizedName() {
return unlocalizedName;
}
/**
* Sets the priority for this category for sorting. Higher numbers
* means they'll appear first in the book. The basics category
* is 9, the miscellaneous category is 0, other vanilla botania categories
* are 5. Using 9 and 0 is <b>not</b> recommended, since having your
* categories before basics or after miscellaneous is a bad idea.
* If two categories have the same priority they'll be sorted
* by insertion order.
*/
public LexiconCategory setPriority(int priority) {
this.priority = priority;
return this;
}
public int getSortingPriority() {
return priority;
}
public final int getSortingId() {
return sortingId;
}
public LexiconCategory setIcon(ResourceLocation icon) {
this.icon = icon;
return this;
}
public ResourceLocation getIcon() {
return icon;
}
@Override
public int compareTo(LexiconCategory category) {
return priority == category.priority ? sortingId - category.sortingId : category.priority - priority;
}
}
@@ -1,96 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 14, 2014, 6:17:06 PM (GMT)]
*/
package vazkii.botania.api.lexicon;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.BotaniaAPI;
public class LexiconEntry implements Comparable<LexiconEntry> {
public final String unlocalizedName;
public final LexiconCategory category;
private KnowledgeType type = BotaniaAPI.basicKnowledge;
public List<LexiconPage> pages = new ArrayList<LexiconPage>();
private boolean priority = false;
/**
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
*/
public LexiconEntry(String unlocalizedName, LexiconCategory category) {
this.unlocalizedName = unlocalizedName;
this.category = category;
}
/**
* Sets this page as prioritized, as in, will appear before others in the lexicon.
*/
public LexiconEntry setPriority() {
priority = true;
return this;
}
/**
* Sets the Knowledge type of this entry.
*/
public LexiconEntry setKnowledgeType(KnowledgeType type) {
this.type = type;
return this;
}
public KnowledgeType getKnowledgeType() {
return type;
}
public boolean isPriority() {
return priority;
}
public String getUnlocalizedName() {
return unlocalizedName;
}
/**
* Sets what pages you want this entry to have.
*/
public LexiconEntry setLexiconPages(LexiconPage... pages) {
this.pages.addAll(Arrays.asList(pages));
for(int i = 0; i < this.pages.size(); i++) {
LexiconPage page = this.pages.get(i);
if(!page.skipRegistry)
page.onPageAdded(this, i);
}
return this;
}
/**
* Adds a page to the list of pages.
*/
public void addPage(LexiconPage page) {
pages.add(page);
}
public final String getNameForSorting() {
return (priority ? 0 : 1) + StatCollector.translateToLocal(getUnlocalizedName());
}
@Override
public int compareTo(LexiconEntry o) {
return getNameForSorting().compareTo(o.getNameForSorting());
}
}
@@ -1,102 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 14, 2014, 6:17:24 PM (GMT)]
*/
package vazkii.botania.api.lexicon;
import net.minecraft.client.gui.GuiButton;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public abstract class LexiconPage {
public String unlocalizedName;
public boolean skipRegistry;
public LexiconPage(String unlocalizedName) {
this.unlocalizedName = unlocalizedName;
}
/**
* Does the rendering for this page.
* @param gui The active GuiScreen
* @param mx The mouse's relative X position.
* @param my The mouse's relative Y position.
*/
@SideOnly(Side.CLIENT)
public abstract void renderScreen(IGuiLexiconEntry gui, int mx, int my);
/**
* Called per update tick. Non gui-sensitive version, kept for backwards compatibility only.
*/
@SideOnly(Side.CLIENT)
public void updateScreen() {
// NO-OP
}
/**
* Called per update tick. Feel free to override fully, the
* call to updateScreen() is for backwards compatibility.
*/
@SideOnly(Side.CLIENT)
public void updateScreen(IGuiLexiconEntry gui) {
updateScreen();
}
/**
* Called when this page is opened, be it via initGui() or when the player changes page.
* You can add buttons and whatever you'd do on initGui() here.
*/
@SideOnly(Side.CLIENT)
public void onOpened(IGuiLexiconEntry gui) {
// NO-OP
}
/**
* Called when this page is opened, be it via closing the gui or when the player changes page.
* Make sure to dispose of anything you don't use any more, such as buttons in the gui's buttonList.
*/
@SideOnly(Side.CLIENT)
public void onClosed(IGuiLexiconEntry gui) {
// NO-OP
}
/**
* Called when a button is pressed, equivalent to GuiScreen.actionPerformed.
*/
@SideOnly(Side.CLIENT)
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {
// NO-OP
}
/**
* Called when a key is pressed.
*/
@SideOnly(Side.CLIENT)
public void onKeyPressed(char c, int key) {
// NO-OP
}
/**
* Called when {@link LexiconEntry#setLexiconPages(vazkii.botania.api.lexicon.LexiconPage...)} is called.
*/
public void onPageAdded(LexiconEntry entry, int index) {
// NO-OP
}
public String getUnlocalizedName() {
return unlocalizedName;
}
public LexiconPage setSkipRegistry() {
skipRegistry = true;
return this;
}
}
@@ -1,68 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 6, 2014, 3:54:12 PM (GMT)]
*/
package vazkii.botania.api.lexicon;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.item.ItemStack;
/**
* This class contains mappings for which entry and page correspond to each
* craftable ItemStack. Use the map method to map an ItemStack to a page in
* an entry in the lexicon.
*/
public final class LexiconRecipeMappings {
private static Map<String, EntryData> mappings = new HashMap();
/**
* Maps the given stack to the given page of the entry.
*/
public static void map(ItemStack stack, LexiconEntry entry, int page, boolean force) {
EntryData data = new EntryData(entry, page);
String str = stackToString(stack);
if(force || !mappings.containsKey(str))
mappings.put(str, data);
}
public static void map(ItemStack stack, LexiconEntry entry, int page) {
map(stack, entry, page, false);
}
public static void remove(ItemStack stack) {
mappings.remove(stackToString(stack));
}
public static EntryData getDataForStack(ItemStack stack) {
return mappings.get(stackToString(stack));
}
public static String stackToString(ItemStack stack) {
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
return stack.getUnlocalizedName() + "~" + stack.getItemDamage();
}
public static class EntryData {
public final LexiconEntry entry;
public final int page;
public EntryData(LexiconEntry entry, int page) {
this.entry = entry;
this.page = page;
}
}
}
@@ -1,36 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 31, 2014, 3:49:30 PM (GMT)]
*/
package vazkii.botania.api.mana;
/**
* The properties of a mana burst, when shot. This is passed to the lens
* currently on the mana spreader to apply changes.
*/
public final class BurstProperties {
public int maxMana;
public int ticksBeforeManaLoss;
public float manaLossPerTick;
public float gravity;
public float motionModifier;
public int color;
public BurstProperties(int maxMana, int ticksBeforeManaLoss, float manaLossPerTick, float gravity, float motionModifier, int color) {
this.maxMana = maxMana;
this.ticksBeforeManaLoss = ticksBeforeManaLoss;
this.manaLossPerTick = manaLossPerTick;
this.gravity = gravity;
this.motionModifier = motionModifier;
this.color = color;
}
}
@@ -1,20 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 2, 2014, 5:26:02 PM (GMT)]
*/
package vazkii.botania.api.mana;
/**
* A TileEntity that implements this will get it's recieveMana call
* called on both client and server. If this is not implemented
* the call will only occur on the server.
*/
public interface IClientManaHandler extends IManaReceiver {
}
@@ -1,25 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [May 25, 2014, 7:34:00 PM (GMT)]
*/
package vazkii.botania.api.mana;
import net.minecraft.item.ItemStack;
/**
* Have an item implement this to flag it as an infinite
* mana source for the purposes of the HUD rendered when
* an IManaUserItem implementing item is present.
*/
public interface ICreativeManaProvider {
public boolean isCreative(ItemStack stack);
}
@@ -1,29 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 11, 2014, 4:29:32 PM (GMT)]
*/
package vazkii.botania.api.mana;
/**
* A TileEntity that implements this interface has an IO key lock. This
* interface defines an input and output key.<br><br>
*
* A Spreader can only shoot mana into a IKeyLocked interfaced TE if the Input
* key of the TE is equal to the Output key of the Spreader.<br><br>
*
* A Spreader can only pull mana from a IKeyLocked interfaced IManaPool TE if the
* Output key of the IManaPool is equal to the Input key of the Spreader.
*/
public interface IKeyLocked {
public String getInputKey();
public String getOutputKey();
}
@@ -1,22 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 26, 2014, 9:51:58 PM (GMT)]
*/
package vazkii.botania.api.mana;
import net.minecraft.world.World;
/**
* A block that implements this has a flag for whether it can be moved by the Shard of Laputa.
*/
public interface ILaputaImmobile {
public boolean canMove(World world, int x, int y, int z);
}
@@ -1,42 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 31, 2014, 3:03:04 PM (GMT)]
*/
package vazkii.botania.api.mana;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Have an Item implement this to be counted as a lens for the mana spreader.
*/
public interface ILens extends ILensEffect {
@SideOnly(Side.CLIENT)
public int getLensColor(ItemStack stack);
/**
* Can the source lens be combined with the composite lens? This is called
* for both the ILens instance of ItemStack.getItem() of sourceLens and compositeLens.
*/
public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens);
/**
* Gets the composite lens in the stack passed in, return null for none.
*/
public ItemStack getCompositeLens(ItemStack stack);
/**
* Sets the composite lens for the sourceLens as the compositeLens, returns
* the ItemStack with the combination.
*/
public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens);
}
Loaded 100 of 147 files, more files were not shown because too many files have changed in this diff. Show more