mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-22 13:09:47 +00:00
Compare commits
3
Commits
master
...
2.0.47-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45b590a003 | ||
|
|
e5ab8b5087 | ||
|
|
52b5a7b79b |
No files matched your search
+66
-43
@@ -1,4 +1,4 @@
|
|||||||
//version: 1669411416
|
//version: 1674409054
|
||||||
/*
|
/*
|
||||||
DO NOT CHANGE THIS FILE!
|
DO NOT CHANGE THIS FILE!
|
||||||
Also, you may replace this file at any time if there is an update available.
|
Also, you may replace this file at any time if there is an update available.
|
||||||
@@ -31,7 +31,7 @@ buildscript {
|
|||||||
url 'https://maven.minecraftforge.net'
|
url 'https://maven.minecraftforge.net'
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
// GTNH ForgeGradle Fork
|
// GTNH ForgeGradle and ASM Fork
|
||||||
name = "GTNH Maven"
|
name = "GTNH Maven"
|
||||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,9 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.11'
|
//Overwrite the current ASM version to fix shading newer than java 8 applicatations.
|
||||||
|
classpath 'org.ow2.asm:asm-debug-all-custom:5.0.3'
|
||||||
|
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.13'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugins {
|
plugins {
|
||||||
@@ -142,6 +144,7 @@ propertyDefaultIfUnset("modrinthProjectId", "")
|
|||||||
propertyDefaultIfUnset("modrinthRelations", "")
|
propertyDefaultIfUnset("modrinthRelations", "")
|
||||||
propertyDefaultIfUnset("curseForgeProjectId", "")
|
propertyDefaultIfUnset("curseForgeProjectId", "")
|
||||||
propertyDefaultIfUnset("curseForgeRelations", "")
|
propertyDefaultIfUnset("curseForgeRelations", "")
|
||||||
|
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
|
||||||
|
|
||||||
String javaSourceDir = "src/main/java/"
|
String javaSourceDir = "src/main/java/"
|
||||||
String scalaSourceDir = "src/main/scala/"
|
String scalaSourceDir = "src/main/scala/"
|
||||||
@@ -234,9 +237,9 @@ try {
|
|||||||
}
|
}
|
||||||
catch (Exception ignored) {
|
catch (Exception ignored) {
|
||||||
out.style(Style.Failure).text(
|
out.style(Style.Failure).text(
|
||||||
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
|
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
|
||||||
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
|
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
|
||||||
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
|
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
|
||||||
)
|
)
|
||||||
versionOverride = 'NO-GIT-TAG-SET'
|
versionOverride = 'NO-GIT-TAG-SET'
|
||||||
identifiedVersion = versionOverride
|
identifiedVersion = versionOverride
|
||||||
@@ -262,13 +265,13 @@ def jvmArguments = []
|
|||||||
|
|
||||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||||
arguments += [
|
arguments += [
|
||||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||||
]
|
]
|
||||||
if (usesMixinDebug.toBoolean()) {
|
if (usesMixinDebug.toBoolean()) {
|
||||||
jvmArguments += [
|
jvmArguments += [
|
||||||
"-Dmixin.debug.countInjections=true",
|
"-Dmixin.debug.countInjections=true",
|
||||||
"-Dmixin.debug.verbose=true",
|
"-Dmixin.debug.verbose=true",
|
||||||
"-Dmixin.debug.export=true"
|
"-Dmixin.debug.export=true"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +281,9 @@ minecraft {
|
|||||||
runDir = 'run'
|
runDir = 'run'
|
||||||
|
|
||||||
if (replaceGradleTokenInFile) {
|
if (replaceGradleTokenInFile) {
|
||||||
replaceIn replaceGradleTokenInFile
|
for (f in replaceGradleTokenInFile.split(',')) {
|
||||||
|
replaceIn f
|
||||||
|
}
|
||||||
if (gradleTokenModId) {
|
if (gradleTokenModId) {
|
||||||
replace gradleTokenModId, modId
|
replace gradleTokenModId, modId
|
||||||
}
|
}
|
||||||
@@ -315,9 +320,13 @@ if (file('addon.gradle').exists()) {
|
|||||||
apply from: 'repositories.gradle'
|
apply from: 'repositories.gradle'
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
|
// TODO: remove Compile after all uses are refactored to Implementation
|
||||||
implementation.extendsFrom(shadowCompile)
|
for (config in [shadowImplementation, shadowCompile, shadeCompile]) {
|
||||||
implementation.extendsFrom(shadeCompile)
|
compileClasspath.extendsFrom(config)
|
||||||
|
runtimeClasspath.extendsFrom(config)
|
||||||
|
testCompileClasspath.extendsFrom(config)
|
||||||
|
testRuntimeClasspath.extendsFrom(config)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -330,6 +339,12 @@ repositories {
|
|||||||
name = "GTNH Maven"
|
name = "GTNH Maven"
|
||||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||||
}
|
}
|
||||||
|
if (usesMixinDebug.toBoolean()) {
|
||||||
|
maven {
|
||||||
|
name = "Fabric Maven"
|
||||||
|
url = "https://maven.fabricmc.net/"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,10 +353,14 @@ dependencies {
|
|||||||
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
||||||
annotationProcessor('com.google.guava:guava:24.1.1-jre')
|
annotationProcessor('com.google.guava:guava:24.1.1-jre')
|
||||||
annotationProcessor('com.google.code.gson:gson:2.8.6')
|
annotationProcessor('com.google.code.gson:gson:2.8.6')
|
||||||
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.1:processor')
|
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.3:processor')
|
||||||
|
if (usesMixinDebug.toBoolean()) {
|
||||||
|
runtimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16')
|
||||||
|
testRuntimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||||
compile('com.gtnewhorizon:gtnhmixins:2.1.1')
|
compile('com.gtnewhorizon:gtnhmixins:2.1.3')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,10 +412,12 @@ shadowJar {
|
|||||||
attributes(getManifestAttributes())
|
attributes(getManifestAttributes())
|
||||||
}
|
}
|
||||||
|
|
||||||
minimize() // This will only allow shading for actually used classes
|
if (minimizeShadowedDependencies.toBoolean()) {
|
||||||
|
minimize() // This will only allow shading for actually used classes
|
||||||
|
}
|
||||||
configurations = [
|
configurations = [
|
||||||
project.configurations.shadowImplementation,
|
project.configurations.shadowImplementation,
|
||||||
project.configurations.shadowCompile
|
project.configurations.shadowCompile
|
||||||
]
|
]
|
||||||
dependsOn(relocateShadowJar)
|
dependsOn(relocateShadowJar)
|
||||||
}
|
}
|
||||||
@@ -428,12 +449,12 @@ afterEvaluate {
|
|||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
tasks.compileJava {
|
tasks.compileJava {
|
||||||
options.compilerArgs += [
|
options.compilerArgs += [
|
||||||
"-AreobfSrgFile=${tasks.reobf.srg}",
|
"-AreobfSrgFile=${tasks.reobf.srg}",
|
||||||
"-AoutSrgFile=${mixinSrg}",
|
"-AoutSrgFile=${mixinSrg}",
|
||||||
"-AoutRefMapFile=${refMap}",
|
"-AoutRefMapFile=${refMap}",
|
||||||
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
|
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
|
||||||
"-XDenableSunApiLintControl",
|
"-XDenableSunApiLintControl",
|
||||||
"-XDignore.symbol.file"
|
"-XDignore.symbol.file"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -442,8 +463,8 @@ afterEvaluate {
|
|||||||
runClient {
|
runClient {
|
||||||
if (developmentEnvironmentUserName) {
|
if (developmentEnvironmentUserName) {
|
||||||
arguments += [
|
arguments += [
|
||||||
"--username",
|
"--username",
|
||||||
developmentEnvironmentUserName
|
developmentEnvironmentUserName
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,9 +479,9 @@ runServer {
|
|||||||
|
|
||||||
tasks.withType(JavaExec).configureEach {
|
tasks.withType(JavaExec).configureEach {
|
||||||
javaLauncher.set(
|
javaLauncher.set(
|
||||||
javaToolchains.launcherFor {
|
javaToolchains.launcherFor {
|
||||||
languageVersion = projectJavaVersion
|
languageVersion = projectJavaVersion
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,9 +497,9 @@ processResources {
|
|||||||
|
|
||||||
// replace modVersion and minecraftVersion
|
// replace modVersion and minecraftVersion
|
||||||
expand "minecraftVersion": project.minecraft.version,
|
expand "minecraftVersion": project.minecraft.version,
|
||||||
"modVersion": modVersion,
|
"modVersion": modVersion,
|
||||||
"modId": modId,
|
"modId": modId,
|
||||||
"modName": modName
|
"modName": modName
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
@@ -508,9 +529,9 @@ def getManifestAttributes() {
|
|||||||
|
|
||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
manifestAttributes += [
|
manifestAttributes += [
|
||||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||||
"MixinConfigs" : "mixins." + modId + ".json",
|
"MixinConfigs" : "mixins." + modId + ".json",
|
||||||
"ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean()
|
"ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean()
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
return manifestAttributes
|
return manifestAttributes
|
||||||
@@ -536,10 +557,12 @@ task shadowDevJar(type: ShadowJar) {
|
|||||||
attributes(getManifestAttributes())
|
attributes(getManifestAttributes())
|
||||||
}
|
}
|
||||||
|
|
||||||
minimize() // This will only allow shading for actually used classes
|
if (minimizeShadowedDependencies.toBoolean()) {
|
||||||
|
minimize() // This will only allow shading for actually used classes
|
||||||
|
}
|
||||||
configurations = [
|
configurations = [
|
||||||
project.configurations.shadowImplementation,
|
project.configurations.shadowImplementation,
|
||||||
project.configurations.shadowCompile
|
project.configurations.shadowCompile
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,8 +656,8 @@ publishing {
|
|||||||
pom.withXml {
|
pom.withXml {
|
||||||
def badArtifacts = [:].withDefault { [] as Set<String> }
|
def badArtifacts = [:].withDefault { [] as Set<String> }
|
||||||
for (configuration in [
|
for (configuration in [
|
||||||
projectConfigs.minecraft,
|
projectConfigs.minecraft,
|
||||||
projectConfigs.minecraftDeps
|
projectConfigs.minecraftDeps
|
||||||
]) {
|
]) {
|
||||||
for (dependency in configuration.allDependencies) {
|
for (dependency in configuration.allDependencies) {
|
||||||
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
|
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
|
||||||
@@ -694,7 +717,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
addModrinthDep("required", "version", "gtnhmixins")
|
addModrinthDep("required", "project", "gtnhmixins")
|
||||||
}
|
}
|
||||||
tasks.modrinth.dependsOn(build)
|
tasks.modrinth.dependsOn(build)
|
||||||
tasks.publish.dependsOn(tasks.modrinth)
|
tasks.publish.dependsOn(tasks.modrinth)
|
||||||
@@ -1100,4 +1123,4 @@ def getSecondaryArtifacts() {
|
|||||||
if (!noPublishedSources) secondaryArtifacts += [sourcesJar]
|
if (!noPublishedSources) secondaryArtifacts += [sourcesJar]
|
||||||
if (apiPackage) secondaryArtifacts += [apiJar]
|
if (apiPackage) secondaryArtifacts += [apiJar]
|
||||||
return secondaryArtifacts
|
return secondaryArtifacts
|
||||||
}
|
}
|
||||||
+5
-4
@@ -1,11 +1,12 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile('com.github.GTNewHorizons:ForestryMC:4.4.6:dev')
|
implementation('com.github.GTNewHorizons:GTNHLib:0.0.10:dev')
|
||||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev')
|
compile('com.github.GTNewHorizons:ForestryMC:4.5.6:dev')
|
||||||
|
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.21-GTNH:dev')
|
||||||
|
|
||||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:api')
|
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.28:api')
|
||||||
|
|
||||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||||
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ import net.minecraftforge.client.event.TextureStitchEvent;
|
|||||||
name = "Binnie Core",
|
name = "Binnie Core",
|
||||||
version = BinnieCore.VERSION,
|
version = BinnieCore.VERSION,
|
||||||
useMetadata = true,
|
useMetadata = true,
|
||||||
dependencies = "after:Forestry@[4.2,)")
|
dependencies = "after:Forestry@[4.2,),required-after:gtnhlib@[0.0.10,)")
|
||||||
public class BinnieCore extends AbstractMod {
|
public class BinnieCore extends AbstractMod {
|
||||||
@Mod.Instance("BinnieCore")
|
@Mod.Instance("BinnieCore")
|
||||||
public static BinnieCore instance;
|
public static BinnieCore instance;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler {
|
|||||||
public void loadUsageRecipes(FluidStack ingredient) {}
|
public void loadUsageRecipes(FluidStack ingredient) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip, int recipe) {
|
public List<String> handleTooltip(GuiRecipe<?> guiRecipe, List<String> currenttip, int recipe) {
|
||||||
super.handleTooltip(guiRecipe, currenttip, recipe);
|
super.handleTooltip(guiRecipe, currenttip, recipe);
|
||||||
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
||||||
if (GuiContainerManager.shouldShowTooltip(guiRecipe)) {
|
if (GuiContainerManager.shouldShowTooltip(guiRecipe)) {
|
||||||
@@ -98,7 +98,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> provideTooltip(
|
public List<String> provideTooltip(
|
||||||
GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
|
GuiRecipe<?> guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
|
||||||
if (crecipe.getFluidTanks() != null) {
|
if (crecipe.getFluidTanks() != null) {
|
||||||
for (PositionedFluidTank tank : crecipe.getFluidTanks()) {
|
for (PositionedFluidTank tank : crecipe.getFluidTanks()) {
|
||||||
if (tank.position.contains(relMouse)) {
|
if (tank.position.contains(relMouse)) {
|
||||||
@@ -111,7 +111,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> handleItemTooltip(
|
public List<String> handleItemTooltip(
|
||||||
GuiRecipe guiRecipe, ItemStack itemStack, List<String> currenttip, int recipe) {
|
GuiRecipe<?> guiRecipe, ItemStack itemStack, List<String> currenttip, int recipe) {
|
||||||
super.handleItemTooltip(guiRecipe, itemStack, currenttip, recipe);
|
super.handleItemTooltip(guiRecipe, itemStack, currenttip, recipe);
|
||||||
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
||||||
Point mouse = GuiDraw.getMousePosition();
|
Point mouse = GuiDraw.getMousePosition();
|
||||||
@@ -125,7 +125,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> provideItemTooltip(
|
public List<String> provideItemTooltip(
|
||||||
GuiRecipe guiRecipe,
|
GuiRecipe<?> guiRecipe,
|
||||||
ItemStack itemStack,
|
ItemStack itemStack,
|
||||||
List<String> currenttip,
|
List<String> currenttip,
|
||||||
CachedBaseRecipe crecipe,
|
CachedBaseRecipe crecipe,
|
||||||
@@ -151,7 +151,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) {
|
public boolean keyTyped(GuiRecipe<?> gui, char keyChar, int keyCode, int recipe) {
|
||||||
if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) {
|
if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) {
|
||||||
if (this.transferFluidTank(gui, recipe, false)) {
|
if (this.transferFluidTank(gui, recipe, false)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -165,7 +165,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(GuiRecipe gui, int button, int recipe) {
|
public boolean mouseClicked(GuiRecipe<?> gui, int button, int recipe) {
|
||||||
if (button == 0) {
|
if (button == 0) {
|
||||||
if (this.transferFluidTank(gui, recipe, false)) {
|
if (this.transferFluidTank(gui, recipe, false)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -178,7 +178,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler {
|
|||||||
return super.mouseClicked(gui, button, recipe);
|
return super.mouseClicked(gui, button, recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean transferFluidTank(GuiRecipe guiRecipe, int recipe, boolean usage) {
|
protected boolean transferFluidTank(GuiRecipe<?> guiRecipe, int recipe, boolean usage) {
|
||||||
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
||||||
|
|
||||||
if (crecipe.getFluidTanks() != null) {
|
if (crecipe.getFluidTanks() != null) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package binnie.extratrees;
|
|||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
import forestry.api.arboriculture.EnumWoodType;
|
import forestry.api.arboriculture.EnumWoodType;
|
||||||
import forestry.arboriculture.tiles.TileWood;
|
import forestry.arboriculture.tiles.TileWood;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Field;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@@ -14,9 +14,21 @@ import net.minecraft.world.WorldSettings;
|
|||||||
import net.minecraft.world.WorldSettings.GameType;
|
import net.minecraft.world.WorldSettings.GameType;
|
||||||
import net.minecraft.world.WorldType;
|
import net.minecraft.world.WorldType;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import sun.reflect.ReflectionFactory;
|
import sun.misc.Unsafe;
|
||||||
|
|
||||||
public class FakeWorld extends World {
|
public class FakeWorld extends World {
|
||||||
|
private static Unsafe unsafe;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
|
||||||
|
theUnsafe.setAccessible(true);
|
||||||
|
unsafe = (Unsafe) theUnsafe.get(null);
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static FakeWorld instance = SilentObjectCreator.create(FakeWorld.class);
|
public static FakeWorld instance = SilentObjectCreator.create(FakeWorld.class);
|
||||||
|
|
||||||
protected Block block;
|
protected Block block;
|
||||||
@@ -106,22 +118,10 @@ public class FakeWorld extends World {
|
|||||||
* Creating objects without calling constructors.
|
* Creating objects without calling constructors.
|
||||||
*/
|
*/
|
||||||
public static <T> T create(Class<T> clazz) {
|
public static <T> T create(Class<T> clazz) {
|
||||||
return create(clazz, Object.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creating objects without calling constructors.
|
|
||||||
*/
|
|
||||||
public static <T> T create(Class<T> clazz, Class<? super T> parent) {
|
|
||||||
try {
|
try {
|
||||||
ReflectionFactory rf = ReflectionFactory.getReflectionFactory();
|
return clazz.cast(unsafe.allocateInstance(clazz));
|
||||||
Constructor objDef = parent.getDeclaredConstructor();
|
} catch (InstantiationException e) {
|
||||||
Constructor intConstr = rf.newConstructorForSerialization(clazz, objDef);
|
throw new IllegalStateException(e);
|
||||||
return clazz.cast(intConstr.newInstance());
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
throw e;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new IllegalStateException("Cannot create object", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import binnie.extratrees.ExtraTrees;
|
|||||||
import binnie.extratrees.block.FruitPod;
|
import binnie.extratrees.block.FruitPod;
|
||||||
import binnie.extratrees.config.ConfigurationMain;
|
import binnie.extratrees.config.ConfigurationMain;
|
||||||
import binnie.extratrees.item.Food;
|
import binnie.extratrees.item.Food;
|
||||||
|
import com.gtnewhorizon.gtnhlib.reflect.Fields;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||||
@@ -18,7 +19,6 @@ import forestry.api.genetics.IAlleleSpecies;
|
|||||||
import forestry.api.genetics.IFruitFamily;
|
import forestry.api.genetics.IFruitFamily;
|
||||||
import forestry.arboriculture.FruitProviderNone;
|
import forestry.arboriculture.FruitProviderNone;
|
||||||
import forestry.arboriculture.genetics.alleles.AlleleTreeSpecies;
|
import forestry.arboriculture.genetics.alleles.AlleleTreeSpecies;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -254,12 +254,9 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider {
|
|||||||
try {
|
try {
|
||||||
IAlleleFruit lemon = (IAlleleFruit) AlleleManager.alleleRegistry.getAllele("forestry.fruitLemon");
|
IAlleleFruit lemon = (IAlleleFruit) AlleleManager.alleleRegistry.getAllele("forestry.fruitLemon");
|
||||||
FruitProviderNone prov = (FruitProviderNone) lemon.getProvider();
|
FruitProviderNone prov = (FruitProviderNone) lemon.getProvider();
|
||||||
Field f = FruitProviderNone.class.getDeclaredField("family");
|
Fields.ofClass(FruitProviderNone.class)
|
||||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
.getField(Fields.LookupType.DECLARED, "family", IFruitFamily.class)
|
||||||
f.setAccessible(true);
|
.setValue(prov, familyCitrus);
|
||||||
modifiersField.setAccessible(true);
|
|
||||||
modifiersField.setInt(f, f.getModifiers() & 0xFFFFFFEF);
|
|
||||||
f.set(prov, familyCitrus);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
||||||
"logoFile": "/assets/binniecore/logo.png",
|
"logoFile": "/assets/binniecore/logo.png",
|
||||||
"parent": "",
|
"parent": "",
|
||||||
"requiredMods": [ "Forestry" ],
|
"requiredMods": [ "Forestry", "gtnhlib@[0.0.10,)" ],
|
||||||
"dependencies": [ "Forestry" ],
|
"dependencies": [ "Forestry", "gtnhlib@[0.0.10,)" ],
|
||||||
"dependants" : [ ],
|
"dependants" : [ ],
|
||||||
"useDependencyInformation" : true
|
"useDependencyInformation" : true
|
||||||
},
|
},
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
"authorList": [ "Binnie" ],
|
"authorList": [ "Binnie" ],
|
||||||
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
||||||
"logoFile": "/assets/extrabees/logo.png",
|
"logoFile": "/assets/extrabees/logo.png",
|
||||||
"parent": "",
|
"parent": "${modId}",
|
||||||
"dependencies": [ "BinnieCore" ]
|
"dependencies": [ "BinnieCore" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"authorList": [ "Binnie" ],
|
"authorList": [ "Binnie" ],
|
||||||
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
||||||
"logoFile": "/assets/extratrees/logo.png",
|
"logoFile": "/assets/extratrees/logo.png",
|
||||||
"parent": "",
|
"parent": "${modId}",
|
||||||
"dependencies": [ "BinnieCore" ]
|
"dependencies": [ "BinnieCore" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
"authorList": [ "Binnie" ],
|
"authorList": [ "Binnie" ],
|
||||||
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
||||||
"logoFile": "/assets/botany/logo.png",
|
"logoFile": "/assets/botany/logo.png",
|
||||||
"parent": "",
|
"parent": "${modId}",
|
||||||
"dependencies": [ "BinnieCore" ]
|
"dependencies": [ "BinnieCore" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
"authorList": [ "Binnie" ],
|
"authorList": [ "Binnie" ],
|
||||||
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
"credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others",
|
||||||
"logoFile": "/assets/genetics/logo.png",
|
"logoFile": "/assets/genetics/logo.png",
|
||||||
"parent": "",
|
"parent": "${modId}",
|
||||||
"dependencies": [ "BinnieCore" ]
|
"dependencies": [ "BinnieCore" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in new issue
Block a user