Update build script (#13)

* Remove most copied dependencies

* Draft for unified build script

* Remove custom updater

* Adapt bee frame to "new" forestry API

* Add missing dependency

* Refactor branch naming

* Resolve todos
This commit is contained in:
Johann Bernhardt authored and GitHub committed 2021-12-19 14:45:11 +01:00
1 parent 4666fc6f47
commit fbaaed088b
354 files changed
+923 -16207

No files matched your search

-22
View File
@@ -1,22 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+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 }}"
+23 -32
View File
@@ -1,37 +1,28 @@
# General use .gitignore for Minecraft modding.
# Directories
/.gradle/
/build/
/eclipse
/run/
/out/
/asm/
/bin/
/build/
/config/
crash-reports/
.gradle
.settings
/.idea/
/.metadata/
/.settings/
/libs/
/saves/
/resourcepacks/
/run/
/build/
/eclipse/
.classpath
.project
/bin/
/config/
/crash-reports/
/logs/
/mods/
/screenshots/
# File Extensions
*.psd
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
*.classpath
*.project
# Specific files
Thumbs.db
usernamecache.json
options.txt
*.bat
src/main/resources/mixins.*.json
-1
View File
@@ -1 +0,0 @@
gradlew idea
-1
View File
@@ -1 +0,0 @@
gradlew setupDevWorkspace
-1
View File
@@ -1 +0,0 @@
gradlew setupDecompWorkspace --refresh-dependencies
-1
View File
@@ -1 +0,0 @@
gradlew build
+482 -92
View File
@@ -1,139 +1,529 @@
//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.util.concurrent.TimeUnit
buildscript {
repositories {
mavenCentral()
maven { url = "https://maven.minecraftforge.net/" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = "https://jitpack.io/" }
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name = "Scala CI dependencies"
url = "https://repo1.maven.org/maven2/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
classpath 'org.ajoberstar:gradle-git:0.10.1'
}
}
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")
}
apply plugin: 'forge'
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
def projectJavaVersion = JavaLanguageVersion.of(8)
java {
toolchain {
languageVersion.set(projectJavaVersion)
}
}
version = config.mc_version + "-" + config.mod_version + "-" + config.build_number
group= config.package_group
archivesBaseName = config.mod_name
idea {
module {
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
import org.ajoberstar.grgit.Grgit
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
def gitHash = 'unknown'
if (new File(projectDir, '.git').exists()) {
def repo = Grgit.open(project.file('.'))
gitHash = repo.log().find().abbreviatedId
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
}
minecraft {
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
runDir = "run"
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
if(gradleTokenModId) {
replace gradleTokenModId, modId
}
if(gradleTokenModName) {
replace gradleTokenModName, modName
}
if(gradleTokenVersion) {
replace gradleTokenVersion, 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 'https://dvs1.progwml6.com/files/maven'
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
}
maven {
name 'tterrag Repo'
url 'https://maven.tterrag.com/'
}
maven {
name = "gt"
url = "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/"
}
maven {
url "https://jitpack.io"
if(usesMixins.toBoolean()) {
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
url = "https://jitpack.io"
}
}
}
dependencies {
implementation "com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev"
implementation "com.github.GTNewHorizons:ForgeMultipart:master-SNAPSHOT:dev"
compile fileTree(dir: 'libs', include: 'CraftTweaker-Dev-1.7.10-3.2.2-GTNH.4-legacy.jar')
compile fileTree(dir: 'libs', include: 'Guide-API-1.7.10-1.0.1-20-deobf.jar')
compile "team.chisel:Chisel:" + config.chisel_version + ":api"
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")
}
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
apply from: 'dependencies.gradle'
minecraft {
version = config.mc_version + "-" + config.forge_version
runDir = "run"
replaceIn "GAPIChecker.java"
replace "@VERSION@", config.guideapi_version
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"
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
include '**/*.properties'
expand 'version': project.version, 'mcversion': project.minecraft.version
"""
}
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
exclude '**/*.properties'
exclude '**/*.db'
}
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 {
dependsOn "incrementBuildNumber"
classifier = ''
manifest.mainAttributes(
"Built-By": System.getProperty('user.name'),
"Created-By": "${System.getProperty('java.vm.version')} + (${System.getProperty('java.vm.vendor')})",
"Implementation-Title": project.name,
"Implementation-Version": project.version,
"Git-Hash": gitHash
manifest {
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(shadowJar)
enabled = false
}
}
reobf {
if(usesMixins.toBoolean()) {
addExtraSrgFile mixinSrg
}
}
afterEvaluate {
if(usesMixins.toBoolean()) {
tasks.compileJava {
options.compilerArgs += [
"-AreobfSrgFile=${tasks.reobf.srg}",
"-AoutSrgFile=${mixinSrg}",
"-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl",
"-XDignore.symbol.file"
]
}
}
}
runClient {
def arguments = []
if(usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
if(developmentEnvironmentUserName) {
arguments += [
"--username",
developmentEnvironmentUserName
]
}
args(arguments)
}
runServer {
def arguments = []
if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
args(arguments)
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion = projectJavaVersion
}
)
}
// add a source jar
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
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
}
// add a javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
task sourcesJar(type: Jar) {
from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
// because the normal output has been made to be obfuscated
task deobfJar(type: Jar) {
task shadowDevJar(type: ShadowJar) {
from sourceSets.main.output
classifier = 'deobf'
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation]
}
tasks.build.dependsOn sourceJar, javadocJar, deobfJar
tasks.withType(JavaCompile) { task ->
task.options.encoding = 'UTF-8'
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
target = tasks.shadowDevJar
prefix = modGroup + ".shadow"
}
task("incrementBuildNumber") {
// increment build number
doFirst {
// increment
config.build_number = (config.build_number.toString().toInteger()) + 1
// write back to the file
configFile.withWriter {
config.toProperties().store(it, "")
}
}
task circularResolverJar(type: Jar) {
dependsOn(relocateShadowDevJar)
dependsOn(shadowDevJar)
enabled = false
}
// Uncomment this line if you want to auto-upload to CurseForge when you build. This requires you to setup curse.gradle yourself.
// fileTree('gradle').include('curse.gradle').collect().sort().each { apply from: it }
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 sourcesJar
archives devJar
if(apiPackage) {
archives apiJar
}
}
// 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)
}
-15
View File
@@ -1,15 +0,0 @@
#
#Sat Dec 04 09:06:56 CST 2021
mod_name=BloodMagic
forge_version=10.13.4.1614-1.7.10
ccc_version=1.0.7.47
cclib_version=1.1.3.138
nei_version=1.0.5.111
//=Dependency Information
package_group=com.wayoftime.bloodmagic
guideapi_version=1.0.1-20
mod_version=1.3.3
minetweaker_version=Dev-1.7.10-3.2.2-GTNH
chisel_version=2.9.2.8
build_number=47
mc_version=1.7.10
+32
View File
@@ -0,0 +1,32 @@
// Add your dependencies here
dependencies {
compileOnly("com.github.GTNewHorizons:Botania:master-SNAPSHOT:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForestryMC:master-SNAPSHOT:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForgeMultipart:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Chisel:master-SNAPSHOT:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ZenScript:master-SNAPSHOT") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:CraftTweaker:master-SNAPSHOT:dev") {
transitive = false
}
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {
transitive = false
}
compileOnly("curse.maven:guide-api-228832:2287185") {
transitive = false
}
}
+64
View File
@@ -0,0 +1,64 @@
modName = AlchemicalWizardry
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = AWWayofTime
modGroup = WayofTime.alchemicalWizardry
# 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 = AlchemicalWizardry.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 =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatability only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
customArchiveBaseName = BloodMagic
Binary file not shown.
+1 -2
View File
@@ -1,6 +1,5 @@
#Sat Jan 04 01:56:22 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
Vendored
+77 -53
View File
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
@@ -6,47 +22,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@@ -61,9 +36,49 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -90,7 +105,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -110,10 +125,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -154,11 +170,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
+20 -10
View File
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,14 +24,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +62,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
}
@@ -1,49 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
/**
*
* Some miscellaneous lists and settings for bees.
*
* @author SirSengir
*/
public class BeeManager {
/**
* 0 - Common Village Bees 1 - Uncommon Village Bees (20 % of spawns)
*/
public static ArrayList<IBeeGenome>[] villageBees;
/**
* List of items that can induce swarming. Integer denotes x in 1000 chance.
*/
public static HashMap<ItemStack, Integer> inducers = new HashMap<ItemStack, Integer>();
/**
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootBees")
*/
public static IBeeRoot beeRoot;
/**
* Used to create new bees.
*/
public static IBeeFactory beeFactory;
/**
* Used to create new bee mutations.
*/
public static IBeeMutationFactory beeMutationFactory;
/**
* Used to get Forestry's jubilance implementations.
*/
public static IJubilanceFactory jubilanceFactory;
}
@@ -1,102 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleBoolean;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
/**
* Enum representing the order of chromosomes in a bee's genome and what they control.
*
* @author SirSengir
*/
public enum EnumBeeChromosome implements IChromosomeType {
/**
* Species of the bee. Alleles here must implement {@link IAlleleBeeSpecies}.
*/
SPECIES(IAlleleBeeSpecies.class),
/**
* (Production) Speed of the bee.
*/
SPEED(IAlleleFloat.class),
/**
* Lifespan of the bee.
*/
LIFESPAN(IAlleleInteger.class),
/**
* Fertility of the bee. Determines number of offspring.
*/
FERTILITY(IAlleleInteger.class),
/**
* Temperature difference to its native supported one the bee can tolerate.
*/
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
/**
* Slightly incorrectly named. If true, a naturally dirunal bee can work during the night. If true, a naturally nocturnal bee can work during the day.
*/
NOCTURNAL(IAlleleBoolean.class),
/**
* Not used / superseded by fixed values for the species. Probably going to be replaced with a boolean for FIRE_RESIST.
*/
@Deprecated
HUMIDITY(IAllele.class),
/**
* Humidity difference to its native supported one the bee can tolerate.
*/
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
/**
* If true the bee can work during rain.
*/
TOLERANT_FLYER(IAlleleBoolean.class),
/**
* If true, the bee can work without a clear view of the sky.
*/
CAVE_DWELLING(IAlleleBoolean.class),
/**
* Contains the supported flower provider.
*/
FLOWER_PROVIDER(IAlleleFlowers.class),
/**
* Determines pollination speed.
*/
FLOWERING(IAlleleInteger.class),
/**
* Determines the size of the bee's territory.
*/
TERRITORY(IAlleleArea.class),
/**
* Determines the bee's effect.
*/
EFFECT(IAlleleBeeEffect.class);
Class<? extends IAllele> clss;
EnumBeeChromosome(Class<? extends IAllele> clss) {
this.clss = clss;
}
@Override
public Class<? extends IAllele> getAlleleClass() {
return clss;
}
@Override
public String getName() {
return this.toString().toLowerCase();
}
@Override
public ISpeciesRoot getSpeciesRoot() {
return BeeManager.beeRoot;
}
}
@@ -1,24 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import java.util.Locale;
public enum EnumBeeType {
DRONE, PRINCESS, QUEEN, LARVAE, NONE;
public static final EnumBeeType[] VALUES = values();
String name;
private EnumBeeType() {
this.name = this.toString().toLowerCase(Locale.ENGLISH);
}
public String getName() {
return name;
}
}
@@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IFlowerRegistry;
public class FlowerManager {
/**
* ItemStacks representing simple flower blocks. Meta-sensitive, processed by the basic {@link IFlowerProvider}.
*
* @deprecated since Forestry 3.4. Use {@link #IFlowerRegistry.registerPlantableFlower(ItemStack flower, double weight, String... flowerTypes)} instead.
* <blockquote><pre>e.g. FlowerManager.flowerRegister.registerPlantableFlower(new ItemStack(Blocks.red_flower), 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);</pre></blockquote>
*/
@Deprecated
public static ArrayList<ItemStack> plainFlowers = new ArrayList<ItemStack>();
/**
* <blockquote><pre>e.g. FlowerManager.flowerRegister.registerPlantableFlower(new ItemStack(Blocks.red_flower), 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);</pre></blockquote>
*/
public static IFlowerRegistry flowerRegistry;
public static final String FlowerTypeVanilla = "flowersVanilla";
public static final String FlowerTypeNether = "flowersNether";
public static final String FlowerTypeCacti = "flowersCacti";
public static final String FlowerTypeMushrooms = "flowersMushrooms";
public static final String FlowerTypeEnd = "flowersEnd";
public static final String FlowerTypeJungle = "flowersJungle";
public static final String FlowerTypeSnow = "flowersSnow";
public static final String FlowerTypeWheat = "flowersWheat";
public static final String FlowerTypeGourd = "flowersGourd";
}
@@ -1,36 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IEffectData;
public interface IAlleleBeeEffect extends IAlleleEffect {
/**
* Called by apiaries to cause an effect in the world.
*
* @param genome
* Genome of the bee queen causing this effect
* @param storedData
* Object containing the stored effect data for the apiary/hive the bee is in.
* @param housing {@link IBeeHousing} the bee currently resides in.
* @return storedData, may have been manipulated.
*/
IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
/**
* Is called to produce bee effects.
*
* @param genome
* @param storedData
* Object containing the stored effect data for the apiary/hive the bee is in.
* @param housing {@link IBeeHousing} the bee currently resides in.
* @return storedData, may have been manipulated.
*/
IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
}
@@ -1,69 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.IAlleleSpecies;
public interface IAlleleBeeSpecies extends IAlleleSpecies {
/**
* @return the IBeeRoot
*/
IBeeRoot getRoot();
/**
* @return true if this species is only active at night.
*/
boolean isNocturnal();
/**
* @return Map of possible products with the chance for drop each bee cycle. (0 - 1]
*/
Map<ItemStack, Float> getProductChances();
/**
* @return Map of possible specialities with the chance for drop each bee cycle. (0 - 1]
*/
Map<ItemStack, Float> getSpecialtyChances();
/**
* Only jubilant bees produce specialities.
* @return true if the bee is jubilant, false otherwise.
*/
boolean isJubilant(IBeeGenome genome, IBeeHousing housing);
@SideOnly(Side.CLIENT)
IIcon getIcon(EnumBeeType type, int renderPass);
/**
* @deprecated since Forestry 3.6.
* @return Path of the texture to use for entity rendering.
*/
@Deprecated
String getEntityTexture();
/**
* @deprecated Since Forestry 3.6 use getProductChances()
* @return Map of possible products with the chance for drop each bee cycle. (0 - 100)
*/
@Deprecated
Map<ItemStack, Integer> getProducts();
/**
* @deprecated Since Forestry 3.6 use getSpecialtyChances()
* @return Map of possible specialities with the chance for drop each bee cycle. (0 - 100)
*/
@Deprecated
Map<ItemStack, Integer> getSpecialty();
}
@@ -1,40 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IAlleleSpeciesCustom;
public interface IAlleleBeeSpeciesCustom extends IAlleleBeeSpecies, IAlleleSpeciesCustom {
/**
* Add a product for this bee species.
* Chance is between 0 and 1.
*/
IAlleleBeeSpeciesCustom addProduct(ItemStack product, Float chance);
/**
* Add a specialty product for this bee species.
* Bees only produce their specialty when they are Jubilant (see IJubilanceProvider)
* Chance is between 0 and 1.
*/
IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, Float chance);
/**
* Set the Jubilance Provider for this bee species.
* Bees only produce their specialty when they are Jubilant (see IJubilanceProvider)
*/
IAlleleBeeSpeciesCustom setJubilanceProvider(IJubilanceProvider provider);
/**
* Make this species only active at night.
*/
IAlleleBeeSpeciesCustom setNocturnal();
/** Use this if you have custom icons for bees. */
IAlleleBeeSpeciesCustom setCustomBeeIconProvider(IBeeIconProvider beeIconProvider);
}
@@ -1,32 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.core.ITileStructure;
/**
* Needs to be implemented by TileEntities that want to be part of an alveary.
*/
public interface IAlvearyComponent extends ITileStructure {
void registerBeeModifier(IBeeModifier modifier);
void removeBeeModifier(IBeeModifier modifier);
void registerBeeListener(IBeeListener event);
void removeBeeListener(IBeeListener event);
void addTemperatureChange(float change, float boundaryDown, float boundaryUp);
void addHumidityChange(float change, float boundaryDown, float boundaryUp);
/**
* @return true if this TE has a function other than a plain alveary block. Returning true prevents the TE from becoming master.
*/
boolean hasFunction();
}
@@ -1,57 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IIndividual;
/**
* Can be used to garner information on bee breeding. See {@link forestry.api.genetics.ISpeciesRoot} for retrieval functions.
*
* @author SirSengir
*/
public interface IApiaristTracker extends IBreedingTracker {
/**
* Register the birth of a queen. Will mark species as discovered.
*
* @param queen
* Created queen.
*/
void registerQueen(IIndividual queen);
/**
* @return Amount of queens bred with this tracker.
*/
int getQueenCount();
/**
* Register the birth of a princess. Will mark species as discovered.
*
* @param princess
* Created princess.
*/
void registerPrincess(IIndividual princess);
/**
* @return Amount of princesses bred with this tracker.
*/
int getPrincessCount();
/**
* Register the birth of a drone. Will mark species as discovered.
*
* @param drone
* Created drone.
*/
void registerDrone(IIndividual drone);
/**
* @return Amount of drones bred with this tracker.
*/
int getDroneCount();
}
@@ -1,29 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* When implemented by armor piece items, allows them to act as apiarist's armor.
*/
public interface IArmorApiarist {
/**
* Called when the apiarist's armor acts as protection against an attack.
*
* @param player
* Player being attacked
* @param armor
* Armor item
* @param cause
* Optional cause of attack, such as a bee effect identifier
* @param doProtect
* Whether or not to actually do the side effects of protection
* @return Whether or not the armor should protect the player from that attack
*/
public boolean protectPlayer(EntityPlayer player, ItemStack armor, String cause, boolean doProtect);
}
@@ -1,88 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.core.IErrorState;
import forestry.api.genetics.IEffectData;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IIndividualLiving;
/**
* Other implementations than Forestry's default one are not supported.
*
* @author SirSengir
*/
public interface IBee extends IIndividualLiving {
/**
* @return Bee's genetic information.
*/
IBeeGenome getGenome();
/**
* @return Genetic information of the bee's mate, null if unmated.
*/
IBeeGenome getMate();
/**
* @return true if the individual is originally of natural origin.
*/
boolean isNatural();
/**
* @return generation this individual is removed from the original individual.
*/
int getGeneration();
/**
* Set the natural flag on this bee.
* @param flag
*/
void setIsNatural(boolean flag);
IEffectData[] doEffect(IEffectData[] storedData, IBeeHousing housing);
IEffectData[] doFX(IEffectData[] storedData, IBeeHousing housing);
/**
* @return true if the bee may spawn offspring
*/
boolean canSpawn();
/**
* Determines whether the queen can work.
*
* @param housing the {@link IBeeHousing} the bee currently resides in.
* @return the error code encountered.
*/
IErrorState canWork(IBeeHousing housing);
boolean hasFlower(IBeeHousing housing);
ArrayList<BiomeGenBase> getSuitableBiomes();
ItemStack[] getProduceList();
ItemStack[] getSpecialtyList();
ItemStack[] produceStacks(IBeeHousing housing);
IBee spawnPrincess(IBeeHousing housing);
IBee[] spawnDrones(IBeeHousing housing);
void plantFlowerRandom(IBeeHousing housing);
IIndividual retrievePollen(IBeeHousing housing);
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
}
@@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.IClassification;
public interface IBeeFactory {
/**
* Creates a new bee species.
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
* See IAlleleBeeSpeciesCustom and IAlleleSpeciesCustom for adding additional properties to the returned species.
*
* @param uid Unique Identifier for this species
* @param dominant Whether this species is genetically dominant (false means it is recessive)
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
* @param unlocalizedName Unlocalized name for this species
* @param unlocalizedDescription Unlocalized description for this species
* @param branch Classification of this species
* @param binomial Binomial name of the species sans genus ("Apis"). "humboldti" will have the bee species flavour name be "Apis humboldti". Feel free to use fun names or null.
* @param primaryColor The outline color of this species
* @param secondaryColor The body color of this species
* @return a new bee species allele.
*/
IAlleleBeeSpeciesCustom createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
/**
* Creates a new bee branch.
* Must be registered with AlleleManager.alleleRegistry.getClassification("family.apidae").addMemberGroup();
*
* @param uid Unique Identifier for this branch
* @param scientific approximates a "genus" in real life. Real life examples: "Micrapis", "Megapis"
* @return a new bee branch
*/
IClassification createBranch(String uid, String scientific);
}
@@ -1,48 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IGenome;
/**
* Only the default implementation is supported.
*
* @author SirSengir
*
*/
public interface IBeeGenome extends IGenome {
IAlleleBeeSpecies getPrimary();
IAlleleBeeSpecies getSecondary();
float getSpeed();
int getLifespan();
int getFertility();
EnumTolerance getToleranceTemp();
EnumTolerance getToleranceHumid();
boolean getNocturnal();
boolean getTolerantFlyer();
boolean getCaveDwelling();
IFlowerProvider getFlowerProvider();
int getFlowering();
int[] getTerritory();
IAlleleBeeEffect getEffect();
}
@@ -1,27 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IHousing;
public interface IBeeHousing extends IBeeModifier, IBeeListener, IHousing {
ItemStack getQueen();
ItemStack getDrone();
void setQueen(ItemStack itemstack);
void setDrone(ItemStack itemstack);
/**
* @return true if princesses and drones can (currently) mate in this housing to generate queens.
*/
boolean canBreed();
}
@@ -1,14 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public interface IBeeIconProvider {
void registerIcons(IIconRegister register);
IIcon getIcon(EnumBeeType type, int renderPass);
}
@@ -1,46 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IIndividual;
public interface IBeeListener {
/**
* Called on queen update.
*
* @param queen
*/
void onQueenChange(ItemStack queen);
/**
* Called when the bees wear out the housing's equipment.
*
* @param amount
* Integer indicating the amount worn out.
*/
void wearOutEquipment(int amount);
/**
* Called just before the children are generated, and the queen removed.
*
* @param queen
*/
void onQueenDeath(IBee queen);
/**
* Called after the children have been spawned, but before the queen appears
*
* @param queen
*/
void onPostQueenDeath(IBee queen);
boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled);
boolean onEggLaid(IBee queen);
}
@@ -1,71 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
public interface IBeeModifier {
/**
* @param genome Genome of the bee this modifier is called for.
* @param currentModifier Current modifier.
* @return Float used to modify the base territory.
*/
float getTerritoryModifier(IBeeGenome genome, float currentModifier);
/**
* @param genome Genome of the bee this modifier is called for.
* @param mate
* @param currentModifier Current modifier.
* @return Float used to modify the base mutation chance.
*/
float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier);
/**
* @param genome Genome of the bee this modifier is called for.
* @param currentModifier Current modifier.
* @return Float used to modify the life span of queens.
*/
float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier);
/**
* @param genome Genome of the bee this modifier is called for.
* @param currentModifier Current modifier.
* @return Float modifying the production speed of queens.
*/
float getProductionModifier(IBeeGenome genome, float currentModifier);
/**
* @param genome Genome of the bee this modifier is called for.
* @return Float modifying the flowering of queens.
*/
float getFloweringModifier(IBeeGenome genome, float currentModifier);
/**
* @param genome Genome of the bee this modifier is called for.
* @return Float modifying the chance for a swarmer queen to die off.
*/
float getGeneticDecay(IBeeGenome genome, float currentModifier);
/**
* @return Boolean indicating if housing can ignore rain
*/
boolean isSealed();
/**
* @return Boolean indicating if housing can ignore darkness/night
*/
boolean isSelfLighted();
/**
* @return Boolean indicating if housing can ignore not seeing the sky
*/
boolean isSunlightSimulated();
/**
* @return Boolean indicating whether this housing simulates the nether
*/
boolean isHellish();
}
@@ -1,29 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutation;
public interface IBeeMutation extends IMutation {
IBeeRoot getRoot();
/**
* @param housing
* @param allele0
* @param allele1
* @param genome0
* @param genome1
* @return float representing the chance for mutation to occur. note that this is 0 - 100 based, since it was an integer previously!
* @deprecated since Forestry 3.6, use the IAlleleBeeSpecies / IBeeGenome version
*/
@Deprecated
float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1);
}
@@ -1,12 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.IMutationCustom;
public interface IBeeMutationCustom extends IBeeMutation, IMutationCustom {
}
@@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.IAllele;
public interface IBeeMutationFactory {
/**
* Creates a new bee mutation.
* Automatically registered with BeeManager.beeRoot.registerMutation()
* See IBeeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
*
* @param parentBee0 A parent bee for this mutation
* @param parentBee1 A parent bee for this mutation
* @param result The resulting alleles for this mutation
* @param chance The chance that breeding the two parent bees will result in this mutation
* @return a new bee mutation.
*/
IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance);
}
@@ -1,128 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import forestry.api.core.IStructureLogic;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.ISpeciesRoot;
public interface IBeeRoot extends ISpeciesRoot {
/**
* @return true if passed item is a Forestry bee. Equal to getType(ItemStack stack) != EnumBeeType.NONE
*/
@Override
boolean isMember(ItemStack stack);
/**
* @return {@link IBee} pattern parsed from the passed stack's nbt data.
*/
@Override
IBee getMember(ItemStack stack);
@Override
IBee getMember(NBTTagCompound compound);
/* GENOME CONVERSION */
@Override
IBee templateAsIndividual(IAllele[] template);
@Override
IBee templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
@Override
IBeeGenome templateAsGenome(IAllele[] template);
@Override
IBeeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
/* BREEDING TRACKER */
/**
* @param world
* @return {@link IApiaristTracker} associated with the passed world.
*/
IApiaristTracker getBreedingTracker(World world, GameProfile player);
/* BEE SPECIFIC */
/**
* @return type of bee encoded on the itemstack. EnumBeeType.NONE if it isn't a bee.
*/
EnumBeeType getType(ItemStack stack);
/**
* @return true if passed item is a drone. Equal to getType(ItemStack stack) == EnumBeeType.DRONE
*/
boolean isDrone(ItemStack stack);
/**
* @return true if passed item is mated (i.e. a queen)
*/
boolean isMated(ItemStack stack);
/**
* @param genome
* Valid {@link IBeeGenome}
* @return {@link IBee} from the passed genome
*/
IBee getBee(World world, IBeeGenome genome);
/**
* Creates an IBee suitable for a queen containing the necessary second genome for the mate.
*
* @param genome
* Valid {@link IBeeGenome}
* @param mate
* Valid {@link IBee} representing the mate.
* @return Mated {@link IBee} from the passed genomes.
*/
IBee getBee(World world, IBeeGenome genome, IBee mate);
/* TEMPLATES */
@Override
ArrayList<IBee> getIndividualTemplates();
/* MUTATIONS */
@Override
Collection<IBeeMutation> getMutations(boolean shuffle);
/* GAME MODE */
void resetBeekeepingMode();
ArrayList<IBeekeepingMode> getBeekeepingModes();
IBeekeepingMode getBeekeepingMode(World world);
IBeekeepingMode getBeekeepingMode(String name);
void registerBeekeepingMode(IBeekeepingMode mode);
void setBeekeepingMode(World world, String name);
/* MISC */
/**
* @param housing
* Object implementing IBeeHousing.
* @return IBeekeepingLogic
*/
IBeekeepingLogic createBeekeepingLogic(IBeeHousing housing);
/**
* TileEntities wanting to function as alveary components need to implement structure logic for validation.
*
* @return IStructureLogic for alvearies.
*/
IStructureLogic createAlvearyStructureLogic(IAlvearyComponent structure);
}
@@ -1,27 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.core.INBTTagable;
import forestry.api.genetics.IEffectData;
public interface IBeekeepingLogic extends INBTTagable {
/* STATE INFORMATION */
int getBreedingTime();
int getTotalBreedingTime();
IBee getQueen();
IBeeHousing getHousing();
IEffectData[] getEffectData();
/* UPDATING */
void update();
}
@@ -1,70 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.world.World;
public interface IBeekeepingMode extends IBeeModifier {
/**
* @return Localized name of this beekeeping mode.
*/
String getName();
/**
* @return Localized list of strings outlining the behaviour of this beekeeping mode.
*/
ArrayList<String> getDescription();
/**
* @return Float used to modify the wear on comb frames.
*/
float getWearModifier();
/**
* @param queen
* @return fertility taking into account the birthing queen and surroundings.
*/
int getFinalFertility(IBee queen, World world, int x, int y, int z);
/**
* @param queen
* @return true if the queen is genetically "fatigued" and should not be reproduced anymore.
*/
boolean isFatigued(IBee queen, IBeeHousing housing);
/**
* @param queen
* @param housing
* @return true if the queen is being overworked in the bee housing (with chance). will trigger a negative effect.
*/
boolean isOverworked(IBee queen, IBeeHousing housing);
/**
*
* @param queen
* @param offspring
* @param housing
* @return true if the genetic structure of the queen is breaking down during spawning of the offspring (with chance). will trigger a negative effect.
*/
boolean isDegenerating(IBee queen, IBee offspring, IBeeHousing housing);
/**
* @param queen
* @return true if an offspring of this queen is considered a natural
*/
boolean isNaturalOffspring(IBee queen);
/**
* @param queen
* @return true if this mode allows the passed queen or princess to be multiplied
*/
boolean mayMultiplyPrincess(IBee queen);
}
@@ -1,38 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Bees can be seeded either as hive drops or as mutation results.
*
* Add IHiveDrops with HiveManager.get___Hive.addDrop
*
* @author SirSengir
*/
public interface IHiveDrop {
ItemStack getPrincess(World world, int x, int y, int z, int fortune);
Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune);
Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune);
/**
* Chance to drop. Default drops have 80 (= 80 %).
*
* @param world Minecraft world this is called for.
* @param x x-Coordinate of the broken hive.
* @param y y-Coordinate of the broken hive.
* @param z z-Coordinate of the broken hive.
* @return Chance for drop as an integer of 0 - 100.
*/
int getChance(World world, int x, int y, int z);
}
@@ -1,27 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
public interface IHiveFrame extends IBeeModifier {
/**
* Wears out a frame.
*
* @param housing
* IBeeHousing the frame is contained in.
* @param frame
* ItemStack containing the actual frame.
* @param queen
* Current queen in the caller.
* @param wear
* Integer denoting the amount worn out. The wear modifier of the current beekeeping mode has already been taken into account.
* @return ItemStack containing the actual frame with adjusted damage.
*/
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
}
@@ -1,16 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.block.Block;
public interface IJubilanceFactory {
/** The default Jubilance Provider is satisfied when the humidity and temperature are ideal for the bee. */
IJubilanceProvider getDefault();
/** The Requires Resource Jubilance Provider is satisfied when a specific block is under the hive. */
IJubilanceProvider getRequiresResource(Block block, int meta);
}
@@ -1,15 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture;
public interface IJubilanceProvider {
/**
* Returns true when conditions are right to make this species Jubilant.
* Jubilant bees can produce their Specialty products.
*/
boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing);
}
@@ -1,13 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture.hives;
public class HiveManager {
public static IHiveRegistry hiveRegistry;
public static IHiveGenHelper genHelper;
}
@@ -1,48 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture.hives;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
public interface IHiveDescription {
/**
* The hive generator for this hive.
*/
IHiveGen getHiveGen();
/**
* The hive block to be placed in the world.
*/
Block getBlock();
int getMeta();
/**
* returns true if the hive can be generated in these conditions.
* Used as a fast early-elimination check for hives that have no hope of spawning in the area.
*/
boolean isGoodBiome(BiomeGenBase biome);
boolean isGoodHumidity(EnumHumidity humidity);
boolean isGoodTemperature(EnumTemperature temperature);
/**
* float representing the relative chance a hive will generate in a chunk.
* Default is 1.0, higher numbers result in more hives, smaller will result in fewer.
* Tree hives want around 3.0 to 4.0 since there are less locations to generate on.
*/
float getGenChance();
/**
* Called after successful hive generation.
* world, x, y, z give the location of the new hive.
**/
void postGen(World world, int x, int y, int z);
}
@@ -1,29 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture.hives;
import net.minecraft.world.World;
public interface IHiveGen {
/**
* return a Y value that the hive should try to generate at.
* returns negative if the hive can't be placed anywhere.
*/
int getYForHive(World world, int x, int z);
/**
* returns true if the hive can be generated at this location.
* Used for advanced conditions, like checking that the ground below the hive is a certain type.
*/
boolean isValidLocation(World world, int x, int y, int z);
/**
* returns true if the hive can safely replace the block at this location.
*/
boolean canReplace(World world, int x, int y, int z);
}
@@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture.hives;
import net.minecraft.block.Block;
public interface IHiveGenHelper {
/**
* Returns a hiveGen for a hive that spawns on the ground.
* validGroundBlocks specifies which block materials it can spawn on.
*/
IHiveGen ground(Block... validGroundBlocks);
/**
* Returns a hiveGen for a hive that spawns in trees.
*/
IHiveGen tree();
}
@@ -1,33 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.apiculture.hives;
import java.util.List;
import forestry.api.apiculture.IHiveDrop;
public interface IHiveRegistry {
/* Forestry Hive Names */
public static final String forest = "Forestry:forest";
public static final String meadows = "Forestry:meadows";
public static final String desert = "Forestry:desert";
public static final String jungle = "Forestry:jungle";
public static final String end = "Forestry:end";
public static final String snow = "Forestry:snow";
public static final String swamp = "Forestry:swamp";
/**
* Adds a new hive to be generated in the world.
*/
void registerHive(String hiveName, IHiveDescription hiveDescription);
/**
* Add drops to a registered hive.
*/
void addDrops(String hiveName, IHiveDrop... drops);
void addDrops(String hiveName, List<IHiveDrop> drop);
}
@@ -1,8 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@API(apiVersion="4.1.0", owner="ForestryAPI|apiculture", provides="ForestryAPI|hives")
package forestry.api.apiculture.hives;
import cpw.mods.fml.common.API;
@@ -1,8 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@API(apiVersion="3.3.0", owner="ForestryAPI|core", provides="ForestryAPI|apiculture")
package forestry.api.apiculture;
import cpw.mods.fml.common.API;
@@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
public enum EnumGermlingType {
SAPLING("sapling"), BLOSSOM("blossom"), POLLEN("pollen"), GERMLING("germling"), NONE("none");
public static final EnumGermlingType[] VALUES = values();
private final String name;
private EnumGermlingType(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
public enum EnumGrowthConditions {
HOSTILE, PALTRY, NORMAL, GOOD, EXCELLENT
}
@@ -1,96 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleBoolean;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAllelePlantType;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IFruitFamily;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraftforge.common.EnumPlantType;
public enum EnumTreeChromosome implements IChromosomeType {
/**
* Determines the following: - WorldGen, including the used wood blocks - {@link IFruitFamily}s supported. Limits which {@link IFruitProvider}
* will actually yield fruit with this species. - Native {@link EnumPlantType} for this tree. Combines with the PLANT chromosome.
*/
SPECIES(IAlleleTreeSpecies.class),
/**
* {@link IGrowthProvider}, determines conditions required by the tree to grow.
*/
GROWTH(IAlleleGrowth.class),
/**
* A float modifying the height of the tree. Taken into account at worldgen.
*/
HEIGHT(IAlleleFloat.class),
/**
* Chance for saplings.
*/
FERTILITY(IAlleleFloat.class),
/**
* {@link IFruitProvider}, determines if and what fruits are grown on the tree. Limited by the {@link IFruitFamily}s the species supports.
*/
FRUITS(IAlleleFruit.class),
/**
* Chance for fruit leaves and/or drops.
*/
YIELD(IAlleleFloat.class),
/**
* May add additional tolerances for {@link EnumPlantTypes}.
*/
PLANT(IAllelePlantType.class),
/**
* Determines the speed at which fruit will ripen on this tree.
*/
SAPPINESS(IAlleleFloat.class),
/**
* Territory for leaf effects. Unused.
*/
TERRITORY(IAlleleArea.class),
/**
* Leaf effect. Unused.
*/
EFFECT(IAlleleLeafEffect.class),
/**
* Amount of random ticks which need to elapse before a sapling will grow into a tree.
*/
MATURATION(IAlleleInteger.class),
GIRTH(IAlleleInteger.class),
/**
* Determines if the tree can burn.
*/
FIREPROOF(IAlleleBoolean.class),
;
Class<? extends IAllele> clss;
EnumTreeChromosome(Class<? extends IAllele> clss) {
this.clss = clss;
}
@Override
public Class<? extends IAllele> getAlleleClass() {
return clss;
}
@Override
public String getName() {
return this.toString().toLowerCase();
}
@Override
public ISpeciesRoot getSpeciesRoot() {
return AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
}
}
@@ -1,17 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.genetics.IAllele;
/**
* Simple allele encapsulating an {@link IFruitProvider}.
*/
public interface IAlleleFruit extends IAllele {
IFruitProvider getProvider();
}
@@ -1,17 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.genetics.IAllele;
/**
* Simple allele encapsulating an {@link IGrowthProvider}.
*/
public interface IAlleleGrowth extends IAllele {
IGrowthProvider getProvider();
}
@@ -1,20 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.world.World;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IEffectData;
/**
* Simple allele encapsulating a leaf effect. (Not implemented)
*/
public interface IAlleleLeafEffect extends IAlleleEffect {
IEffectData doEffect(ITreeGenome genome, IEffectData storedData, World world, int x, int y, int z);
}
@@ -1,69 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IFruitFamily;
public interface IAlleleTreeSpecies extends IAlleleSpecies {
ITreeRoot getRoot();
/**
* @return Native plant type of this species.
*/
EnumPlantType getPlantType();
/**
* @return List of all {@link IFruitFamily}s which can grow on leaves generated by this species.
*/
Collection<IFruitFamily> getSuitableFruit();
/**
* @param tree
* @param world
* @param x
* @param y
* @param z
* @return Tree generator for the tree at the given location.
*/
WorldGenerator getGenerator(ITree tree, World world, int x, int y, int z);
/**
* @return All available generator classes for this species.
*/
Class<? extends WorldGenerator>[] getGeneratorClasses();
/* TEXTURES AND OVERRIDES */
int getLeafColour(ITree tree);
short getLeafIconIndex(ITree tree, boolean fancy);
@SideOnly(Side.CLIENT)
IIcon getGermlingIcon(EnumGermlingType type, int renderPass);
@SideOnly(Side.CLIENT)
int getGermlingColour(EnumGermlingType type, int renderPass);
/**
*
* @return Array of ItemStacks representing logs that these tree produces, the first one being the primary one
*/
ItemStack[] getLogStacks();
}
@@ -1,12 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.genetics.IBreedingTracker;
public interface IArboristTracker extends IBreedingTracker {
}
@@ -1,74 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.IFruitFamily;
public interface IFruitProvider {
IFruitFamily getFamily();
int getColour(ITreeGenome genome, IBlockAccess world, int x, int y, int z, int ripeningTime);
boolean markAsFruitLeaf(ITreeGenome genome, World world, int x, int y, int z);
int getRipeningPeriod();
// / Products, Chance
ItemStack[] getProducts();
// / Specialty, Chance
ItemStack[] getSpecialty();
ItemStack[] getFruits(ITreeGenome genome, World world, int x, int y, int z, int ripeningTime);
/**
* @return Short, human-readable identifier used in the treealyzer.
*/
String getDescription();
/* TEXTURE OVERLAY */
/**
* @param genome
* @param world
* @param x
* @param y
* @param z
* @param ripeningTime
* Elapsed ripening time for the fruit.
* @param fancy
* @return IIcon index of the texture to overlay on the leaf block.
*/
short getIconIndex(ITreeGenome genome, IBlockAccess world, int x, int y, int z, int ripeningTime, boolean fancy);
/**
* @return true if this fruit provider requires fruit blocks to spawn, false otherwise.
*/
boolean requiresFruitBlocks();
/**
* Tries to spawn a fruit block at the potential position when the tree generates.
*
* @param genome
* @param world
* @param x
* @param y
* @param z
* @return true if a fruit block was spawned, false otherwise.
*/
boolean trySpawnFruitBlock(ITreeGenome genome, World world, int x, int y, int z);
@SideOnly(Side.CLIENT)
void registerIcons(IIconRegister register);
}
@@ -1,38 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.world.World;
public interface IGrowthProvider {
/**
* Check to see whether a sapling at the given location with the given genome can grow into a tree.
*
* @param genome Genome of the tree this is called for.
* @param world Minecraft world the tree will inhabit.
* @param xPos x-Coordinate to attempt growth at.
* @param yPos y-Coordinate to attempt growth at.
* @param zPos z-Coordinate to attempt growth at.
* @param expectedGirth Trunk size of the tree to generate.
* @param expectedHeight Height of the tree to generate.
* @return true if the tree can grow at the given coordinates, false otherwise.
*/
boolean canGrow(ITreeGenome genome, World world, int xPos, int yPos, int zPos, int expectedGirth, int expectedHeight);
EnumGrowthConditions getGrowthConditions(ITreeGenome genome, World world, int xPos, int yPos, int zPos);
/**
* @return Short, human-readable identifier used in the treealyzer.
*/
String getDescription();
/**
* @return Detailed description of growth behaviour used in the treealyzer.
*/
String[] getInfo();
}
@@ -1,12 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.world.World;
public interface ILeafTickHandler {
boolean onRandomLeafTick(ITree tree, World world, int biomeId, int x, int y, int z, boolean isDestroyed);
}
@@ -1,24 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IToolGrafter {
/**
* Called by leaves to determine the increase in sapling droprate.
*
* @param stack ItemStack containing the grafter.
* @param world Minecraft world the player and the target block inhabit.
* @param x x-Coordinate of the broken leaf block.
* @param y y-Coordinate of the broken leaf block.
* @param z z-Coordinate of the broken leaf block.
* @return Float representing the factor the usual drop chance is to be multiplied by.
*/
float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z);
}
@@ -1,100 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IEffectData;
import forestry.api.genetics.IIndividual;
import forestry.api.world.ITreeGenData;
public interface ITree extends IIndividual, ITreeGenData {
void mate(ITree other);
IEffectData[] doEffect(IEffectData[] storedData, World world, int biomeid, int x, int y, int z);
IEffectData[] doFX(IEffectData[] storedData, World world, int biomeid, int x, int y, int z);
ITreeGenome getGenome();
ITreeGenome getMate();
EnumSet<EnumPlantType> getPlantTypes();
ITree[] getSaplings(World world, int x, int y, int z, float modifier);
ItemStack[] getProduceList();
ItemStack[] getSpecialtyList();
ItemStack[] produceStacks(World world, int x, int y, int z, int ripeningTime);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Boolean indicating whether a sapling can stay planted at the given position.
*/
boolean canStay(World world, int x, int y, int z);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Boolean indicating whether a sapling at the given position can grow into a tree.
*/
boolean canGrow(World world, int x, int y, int z, int expectedGirth, int expectedHeight);
/**
* @return Integer denoting the maturity (block ticks) required for a sapling to attempt to grow into a tree.
*/
int getRequiredMaturity();
/**
* @return Integer denoting how resilient leaf blocks are against adverse influences (i.e. caterpillars).
*/
int getResilience();
/**
* @param world
* @param x
* @param y
* @param z
* @return Integer denoting the size of the tree trunk.
*/
int getGirth(World world, int x, int y, int z);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Growth conditions at the given position.
*/
EnumGrowthConditions getGrowthCondition(World world, int x, int y, int z);
WorldGenerator getTreeGenerator(World world, int x, int y, int z, boolean wasBonemealed);
ITree copy();
boolean isPureBred(EnumTreeChromosome chromosome);
boolean canBearFruit();
}
@@ -1,46 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import java.util.EnumSet;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IGenome;
public interface ITreeGenome extends IGenome {
IAlleleTreeSpecies getPrimary();
IAlleleTreeSpecies getSecondary();
IFruitProvider getFruitProvider();
IGrowthProvider getGrowthProvider();
float getHeight();
float getFertility();
/**
* @return Determines either a) how many fruit leaves there are or b) the chance for any fruit leave to drop a sapling. Exact usage determined by the
* IFruitProvider
*/
float getYield();
float getSappiness();
EnumSet<EnumPlantType> getPlantTypes();
/**
* @return Amount of random block ticks required for a sapling to mature into a fully grown tree.
*/
int getMaturationTime();
int getGirth();
IAlleleLeafEffect getEffect();
}
@@ -1,45 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
public interface ITreeModifier {
/**
*
* @param genome
* @return Float used to modify the height.
*/
float getHeightModifier(ITreeGenome genome, float currentModifier);
/**
*
* @param genome
* @return Float used to modify the yield.
*/
float getYieldModifier(ITreeGenome genome, float currentModifier);
/**
*
* @param genome
* @return Float used to modify the sappiness.
*/
float getSappinessModifier(ITreeGenome genome, float currentModifier);
/**
*
* @param genome
* @return Float used to modify the maturation.
*/
float getMaturationModifier(ITreeGenome genome, float currentModifier);
/**
* @param genome0
* @param genome1
* @return Float used to modify the base mutation chance.
*/
float getMutationModifier(ITreeGenome genome0, ITreeGenome genome1, float currentModifier);
}
@@ -1,34 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutation;
import forestry.api.genetics.ISpeciesRoot;
public interface ITreeMutation extends IMutation {
/**
* @return {@link ISpeciesRoot} this mutation is associated with.
*/
ITreeRoot getRoot();
/**
* @param world
* @param x
* @param y
* @param z
* @param allele0
* @param allele1
* @param genome0
* @param genome1
* @return float representing the chance for mutation to occur. note that this is 0 - 100 based, since it was an integer previously!
*/
float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
}
@@ -1,113 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosome;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
public interface ITreeRoot extends ISpeciesRoot {
@Override
boolean isMember(ItemStack itemstack);
@Override
ITree getMember(ItemStack itemstack);
@Override
ITree getMember(NBTTagCompound compound);
@Override
ITree templateAsIndividual(IAllele[] template);
@Override
ITree templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
@Override
ITreeGenome templateAsGenome(IAllele[] template);
@Override
ITreeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
/**
* @param world
* @return {@link IArboristTracker} associated with the passed world.
*/
@Override
IArboristTracker getBreedingTracker(World world, GameProfile player);
/* TREE SPECIFIC */
/**
* Register a leaf tick handler.
* @param handler the {@link ILeafTickHandler} to register.
*/
void registerLeafTickHandler(ILeafTickHandler handler);
Collection<ILeafTickHandler> getLeafTickHandlers();
/**
* @return type of tree encoded on the itemstack. EnumBeeType.NONE if it isn't a tree.
*/
EnumGermlingType getType(ItemStack stack);
ITree getTree(World world, int x, int y, int z);
ITree getTree(World world, ITreeGenome genome);
boolean plantSapling(World world, ITree tree, GameProfile owner, int x, int y, int z);
/**
* @deprecated since Forestry 3.5.0. Use ITreeGenData setLeavesDecorative.
*/
@Deprecated
// decorative=true for creative and player-placed leaves. No decay, pollination, or drops.
boolean setLeaves(World world, IIndividual tree, GameProfile owner, int x, int y, int z, boolean decorative);
/**
* @deprecated since Forestry 3.5.0. Use ITreeGenData setLeaves.
*/
@Deprecated
// set normal leaves created as worldgen
boolean setLeaves(World world, IIndividual tree, GameProfile owner, int x, int y, int z);
@Override
IChromosome[] templateAsChromosomes(IAllele[] template);
@Override
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
boolean setFruitBlock(World world, IAlleleFruit allele, float sappiness, short[] indices, int x, int y, int z);
/* GAME MODE */
ArrayList<ITreekeepingMode> getTreekeepingModes();
ITreekeepingMode getTreekeepingMode(World world);
ITreekeepingMode getTreekeepingMode(String name);
void registerTreekeepingMode(ITreekeepingMode mode);
void setTreekeepingMode(World world, String name);
/* TEMPLATES */
@Override
ArrayList<ITree> getIndividualTemplates();
/* MUTATIONS */
@Override
Collection<ITreeMutation> getMutations(boolean shuffle);
}
@@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import java.util.ArrayList;
public interface ITreekeepingMode extends ITreeModifier {
/**
* @return Localized name of this treekeeping mode.
*/
String getName();
/**
* @return Localized list of strings outlining the behaviour of this treekeeping mode.
*/
ArrayList<String> getDescription();
}
@@ -1,8 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@API(apiVersion="2.3.0", owner="ForestryAPI|core", provides="ForestryAPI|arboriculture")
package forestry.api.arboriculture;
import cpw.mods.fml.common.API;
@@ -1,13 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.circuits;
public class ChipsetManager {
public static ISolderManager solderManager;
public static ICircuitRegistry circuitRegistry;
}
@@ -1,32 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.circuits;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
public interface ICircuit {
String getUID();
boolean requiresDiscovery();
int getLimit();
String getName();
boolean isCircuitable(TileEntity tile);
void onInsertion(int slot, TileEntity tile);
void onLoad(int slot, TileEntity tile);
void onRemoval(int slot, TileEntity tile);
void onTick(int slot, TileEntity tile);
void addTooltip(List<String> list);
}
@@ -1,32 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.circuits;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import forestry.api.core.INBTTagable;
public interface ICircuitBoard extends INBTTagable {
int getPrimaryColor();
int getSecondaryColor();
void addTooltip(List<String> list);
void onInsertion(TileEntity tile);
void onLoad(TileEntity tile);
void onRemoval(TileEntity tile);
void onTick(TileEntity tile);
ICircuit[] getCircuits();
}
@@ -1,16 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.circuits;
public interface ICircuitLayout {
String getUID();
String getName();
String getUsage();
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.circuits;
public interface ICircuitLibrary {
}
@@ -1,37 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.circuits;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface ICircuitRegistry {
/* CIRCUITS */
Map<String, ICircuit> getRegisteredCircuits();
void registerCircuit(ICircuit circuit);
ICircuit getCircuit(String uid);
ICircuitLibrary getCircuitLibrary(World world, String playername);
/* LAYOUTS */
Map<String, ICircuitLayout> getRegisteredLayouts();
void registerLayout(ICircuitLayout layout);
ICircuitLayout getLayout(String uid);
ICircuitLayout getDefaultLayout();
ICircuitBoard getCircuitboard(ItemStack itemstack);
boolean isChipset(ItemStack itemstack);
}
@@ -1,14 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.circuits;
import net.minecraft.item.ItemStack;
public interface ISolderManager {
void addRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit);
}
@@ -1,8 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@API(apiVersion="2.0.0", owner="ForestryAPI|core", provides="ForestryAPI|circuits")
package forestry.api.circuits;
import cpw.mods.fml.common.API;
@@ -1,36 +0,0 @@
package forestry.api.core;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
public class BiomeHelper {
private static final Map<BiomeGenBase, Boolean> isBiomeHellishCache = new HashMap<BiomeGenBase, Boolean>();
/**
* Determines if it can rain or snow in the given biome.
*/
public static boolean canRainOrSnow(BiomeGenBase biomeGenBase) {
return biomeGenBase.getEnableSnow() || biomeGenBase.canSpawnLightningBolt();
}
/**
* Determines if a given BiomeGenBase is of HELLISH temperature, since it is treated separately from actual temperature values.
* Uses the BiomeDictionary.
* @param biomeGen BiomeGenBase of the biome in question
* @return true, if the BiomeGenBase is a Nether-type biome; false otherwise.
*/
public static boolean isBiomeHellish(BiomeGenBase biomeGen) {
if (isBiomeHellishCache.containsKey(biomeGen)) {
return isBiomeHellishCache.get(biomeGen);
}
boolean isBiomeHellish = BiomeDictionary.isBiomeOfType(biomeGen, BiomeDictionary.Type.NETHER);
isBiomeHellishCache.put(biomeGen, isBiomeHellish);
return isBiomeHellish;
}
}
@@ -1,43 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core;
/**
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
*
* This enum concerns humidity.
*/
public enum EnumHumidity {
ARID("Arid"), NORMAL("Normal"), DAMP("Damp");
public final String name;
private EnumHumidity(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
/**
* Determines the EnumHumidity given a floating point representation of Minecraft Rainfall.
* To check if rainfall is possible in a biome, use BiomeHelper.canRainOrSnow().
* @param rawHumidity raw rainfall value
* @return EnumHumidity corresponding to rainfall value
*/
public static EnumHumidity getFromValue(float rawHumidity) {
if (rawHumidity > 0.85f) { // matches BiomeGenBase.isHighHumidity()
return DAMP;
}
else if (rawHumidity >= 0.3f) {
return NORMAL;
}
else {
return ARID;
}
}
}
@@ -1,71 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core;
import net.minecraft.util.IIcon;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
*
* This enum concerns temperature.
*/
public enum EnumTemperature {
NONE("None", "habitats/ocean"), ICY("Icy", "habitats/snow"), COLD("Cold", "habitats/taiga"),
NORMAL("Normal", "habitats/plains"), WARM("Warm", "habitats/jungle"), HOT("Hot", "habitats/desert"), HELLISH("Hellish", "habitats/nether");
public final String name;
public final String iconIndex;
private EnumTemperature(String name, String iconIndex) {
this.name = name;
this.iconIndex = iconIndex;
}
public String getName() {
return this.name;
}
@SideOnly(Side.CLIENT)
public IIcon getIcon() {
return ForestryAPI.textureManager.getDefault(iconIndex);
}
/**
* Determines the EnumTemperature given a floating point representation of
* Minecraft temperature. Hellish biomes are handled based on their biome
* type - check BiomeHelper.isBiomeHellish.
* @param rawTemp raw temperature value
* @return EnumTemperature corresponding to value of rawTemp
*/
public static EnumTemperature getFromValue(float rawTemp) {
if (rawTemp > 1.00f) {
return HOT;
}
else if (rawTemp > 0.80f) {
return WARM;
}
else if (rawTemp > 0.30f) {
return NORMAL;
}
else if (rawTemp > 0.0f) {
return COLD;
}
else {
return ICY;
}
}
public static EnumTemperature getFromBiome(BiomeGenBase biomeGenBase) {
if (BiomeHelper.isBiomeHellish(biomeGenBase)) {
return HELLISH;
}
return getFromValue(biomeGenBase.temperature);
}
}
@@ -1,77 +0,0 @@
/*
*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
*******************************************************************************
*/
package forestry.api.core;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class ErrorStateRegistry {
private static final BiMap<Short, IErrorState> states = HashBiMap.create();
private static final Map<String, IErrorState> stateNames = new HashMap<String, IErrorState>();
private static final Set<IErrorState> stateView = Collections.unmodifiableSet(states.inverse().keySet());
public static void registerErrorState(IErrorState state) {
if (states.containsKey(state.getID()))
throw new RuntimeException("Forestry Error State does not possess a unique id.");
states.put(state.getID(), state);
addStateName(state, state.getUniqueName());
}
public static void addAlias(IErrorState state, String name) {
if (!states.values().contains(state))
throw new RuntimeException("Forestry Error State did not exist while trying to register alias.");
addStateName(state, name);
}
private static void addStateName(IErrorState state, String name) {
if (!name.contains(":"))
throw new RuntimeException("Forestry Error State name must be in the format <modid>:<name>.");
if (stateNames.containsKey(name))
throw new RuntimeException("Forestry Error State does not possess a unique name.");
stateNames.put(name, state);
}
public static IErrorState getErrorState(short id) {
return states.get(id);
}
public static IErrorState getErrorState(String name) {
return stateNames.get(name);
}
public static Set<IErrorState> getErrorStates() {
return stateView;
}
@SideOnly(Side.CLIENT)
public static void initIcons(IIconRegister register) {
for (IErrorState code : states.values()) {
code.registerIcons(register);
}
}
}
Loaded 100 of 354 files, more files were not shown because too many files have changed in this diff. Show more