mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 09:34:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b9b105211 | ||
|
|
8b10349309 | ||
|
|
0d26b6b2f2 | ||
|
|
3e5de52efd | ||
|
|
e30e9f4ab9 | ||
|
|
05d1eb87ce | ||
|
|
7679dfc393 | ||
|
|
bb52acc67c | ||
|
|
3caf8cbfef | ||
|
|
207f15ed0b | ||
|
|
c5178be225 | ||
|
|
cd7250604e | ||
|
|
533c9d0b2a | ||
|
|
c00fa15f0e | ||
|
|
ce3dea42e3 | ||
|
|
287cb8cb87 | ||
|
|
10fec50457 | ||
|
|
43c61c18c0 | ||
|
|
dca593f7d8 | ||
|
|
4c874fcf7d | ||
|
|
e62a2f1199 | ||
|
|
8ab94e6741 | ||
|
|
1278c09064 | ||
|
|
ed0b884bce | ||
|
|
85f413f857 | ||
|
|
3cc298b0f1 | ||
|
|
8b0d54f3ec | ||
|
|
40445462f1 | ||
|
|
8eea336fdb | ||
|
|
521514f3d2 | ||
|
|
cc50a05f43 | ||
|
|
1fc56c3b20 | ||
|
|
9cee882788 | ||
|
|
9404f769bb | ||
|
|
7b8b317ffe | ||
|
|
b40a6d4ec9 | ||
|
|
42865951a9 | ||
|
|
a058c3f8c9 | ||
|
|
a83e428d29 | ||
|
|
9c41566485 | ||
|
|
842b9c7199 | ||
|
|
cbb0c15783 | ||
|
|
cbc6f9acff | ||
|
|
03ecce51cc | ||
|
|
644145ac92 | ||
|
|
850a7e2919 | ||
|
|
1f54359836 | ||
|
|
debde28aba | ||
|
|
a2aa07c917 | ||
|
|
3c9572eb83 | ||
|
|
03fd954781 | ||
|
|
2002dff3c9 | ||
|
|
d9ade6dae0 | ||
|
|
3b547c1b87 | ||
|
|
05070982dc | ||
|
|
9833dbb01f | ||
|
|
e67ef8adec | ||
|
|
b5b4ff2de6 | ||
|
|
f78e21e31a | ||
|
|
457962c716 | ||
|
|
7a0dde1140 | ||
|
|
5f7f7fbed6 | ||
|
|
c107c75cbe | ||
|
|
8ed4fa8d7b | ||
|
|
5a10d8a0b2 | ||
|
|
16c3fae45d | ||
|
|
b3be6a8f02 | ||
|
|
aac4d730d6 | ||
|
|
dacd2741a3 | ||
|
|
2f47114015 | ||
|
|
b7ae349314 | ||
|
|
fbea338462 | ||
|
|
b07e5a1556 | ||
|
|
13f49fc930 | ||
|
|
3c4b025c74 | ||
|
|
3df3d9121e | ||
|
|
58ab49d66e | ||
|
|
37893d8aca | ||
|
|
9814601ff2 | ||
|
|
11e8a06a48 | ||
|
|
26f44a2862 | ||
|
|
3073473b0e | ||
|
|
61af8ba6c9 | ||
|
|
3e60c43b30 | ||
|
|
e9ae149ba2 | ||
|
|
b62ec72422 | ||
|
|
50ef3d8b2c | ||
|
|
a0e15f76ca | ||
|
|
e7766d3ad9 | ||
|
|
4e096e7338 | ||
|
|
88fd031fb4 | ||
|
|
ee272de168 | ||
|
|
1faaa6e297 | ||
|
|
6c86447891 | ||
|
|
905e81c2b9 | ||
|
|
25bb682f7d | ||
|
|
18e10f617c | ||
|
|
e0a0ab5594 | ||
|
|
29d96db1e8 | ||
|
|
3769ec42d2 | ||
|
|
d0c1133304 | ||
|
|
c3ff59fbfb | ||
|
|
aa52b063b7 | ||
|
|
a74b3c87c4 | ||
|
|
6c38a6a28e | ||
|
|
db49d305f4 | ||
|
|
5df7b9252b | ||
|
|
f4d0979bb1 | ||
|
|
199200cb01 | ||
|
|
419cebef33 | ||
|
|
716167e3ec | ||
|
|
60debc45f3 | ||
|
|
2c04d42717 | ||
|
|
9e21ed9670 | ||
|
|
095e710bec | ||
|
|
888c5268d5 | ||
|
|
1180c16f45 | ||
|
|
dea1fb144a | ||
|
|
a01190a242 | ||
|
|
0ebced9609 | ||
|
|
ab4489c5aa | ||
|
|
d2ea1d820c | ||
|
|
4d0dfd837e | ||
|
|
e07f10d981 | ||
|
|
d48e9484b8 | ||
|
|
b9924ea98b | ||
|
|
5707d27598 | ||
|
|
42bde9e576 | ||
|
|
76f09be39d | ||
|
|
3aa328a522 | ||
|
|
2b0f5bfdf4 | ||
|
|
bbe6f919c4 | ||
|
|
4441d78eb2 | ||
|
|
e6cb758e0e | ||
|
|
6d774de5a6 | ||
|
|
0a2ca1febc | ||
|
|
6d3ff67efd | ||
|
|
d37a52dcf4 | ||
|
|
c03fa0e955 | ||
|
|
b3549edf51 | ||
|
|
e09d159935 | ||
|
|
66f0da433e | ||
|
|
4cb2610b1c | ||
|
|
c44f11cf09 | ||
|
|
b69c31ed8a | ||
|
|
6a2231f8fb | ||
|
|
a3a6c71c42 | ||
|
|
8d5c0c6f8b | ||
|
|
56603fd00c | ||
|
|
ed69411d2e | ||
|
|
d8c8aec2ee | ||
|
|
e1d017f077 | ||
|
|
9269af7a13 | ||
|
|
8ffdba5021 | ||
|
|
e00aecd886 | ||
|
|
98f859f2fb | ||
|
|
55a15d23b2 | ||
|
|
38189388f6 | ||
|
|
8bb1b74b1c | ||
|
|
465d32af25 | ||
|
|
13b8a023a3 | ||
|
|
54ca3488df | ||
|
|
26bf69effc | ||
|
|
307580aed8 | ||
|
|
d2d93004e0 | ||
|
|
e1df424bfd | ||
|
|
6a75347b05 | ||
|
|
cfd513ea80 | ||
|
|
edcc47a6b3 | ||
|
|
6593118f3d | ||
|
|
8f29faa28a | ||
|
|
fd724d147a | ||
|
|
1e6716f8ec | ||
|
|
787395494c | ||
|
|
b0b6ffb963 | ||
|
|
d3d57ab0df | ||
|
|
375515937d | ||
|
|
b2e1b2dc9b | ||
|
|
6c869cab98 | ||
|
|
212f857692 | ||
|
|
c40adda51c | ||
|
|
35f7ba6153 | ||
|
|
327b7bba87 | ||
|
|
defc47000b | ||
|
|
694cd8103a | ||
|
|
f50e7281c5 | ||
|
|
0a37ad0666 | ||
|
|
13d4907bff | ||
|
|
78725009c1 | ||
|
|
a1bc9144bd | ||
|
|
1034111985 | ||
|
|
b897056824 | ||
|
|
0c27bf850c | ||
|
|
87563b6c97 | ||
|
|
62d6294da2 | ||
|
|
78489a6146 | ||
|
|
b4d71543db | ||
|
|
b4db0f32e4 | ||
|
|
8ad42a8918 | ||
|
|
96ed44a186 | ||
|
|
4e17804997 | ||
|
|
e391d06f32 | ||
|
|
353fcb1ba7 | ||
|
|
73db1a608a | ||
|
|
322327e1f4 | ||
|
|
1c6b60122e | ||
|
|
c2ca77ecae | ||
|
|
441f57d027 | ||
|
|
1e7a042b53 | ||
|
|
2e0bb5a3b2 | ||
|
|
bf08336bc5 | ||
|
|
62cbf31ac2 | ||
|
|
a2eac214b4 | ||
|
|
32933ce90b | ||
|
|
44cdc191fc | ||
|
|
e4f77e42d3 | ||
|
|
9f91832c7e |
No files matched your search
Executable → Regular
+9
-17
@@ -5,15 +5,17 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.47"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "com.matthewprenger.cursegradle" version "1.0.9"
|
||||
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32"
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: "se.bjurr.gitchangelog.git-changelog-gradle-plugin"
|
||||
|
||||
version = version_major + '.' + version_minor + '.' + version_patch + '.' + getBuildNumber()
|
||||
if (project.hasProperty('buildQualifier')) {
|
||||
@@ -60,9 +62,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "net.darkhax.tesla:Tesla-${mcversion}:${tesla_version}"
|
||||
deobfCompile "mezz.jei:jei_${mcversion}:${jei_version}:api"
|
||||
runtime "mezz.jei:jei_${mcversion}:${jei_version}"
|
||||
deobfCompile "net.darkhax.tesla:Tesla-${tesla_mcversion}:${tesla_version}"
|
||||
deobfCompile "mezz.jei:jei_${jei_mcversion}:${jei_version}:api"
|
||||
runtime "mezz.jei:jei_${jei_mcversion}:${jei_version}"
|
||||
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
}
|
||||
|
||||
@@ -149,26 +151,16 @@ task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||
untaggedName = "Current release ${project.version}"
|
||||
fromCommit = "5a3850c2642e535656d090d1473054d5fa8d3331"
|
||||
toRef = "HEAD"
|
||||
templateContent = """
|
||||
Please help the Forestry project by <a href="https://github.com/ForestryMC/ForestryMC/issues">reporting issues here.</a><br/>
|
||||
{{#tags}}
|
||||
<h3>{{name}}</h3>
|
||||
<ul>
|
||||
{{#commits}}
|
||||
<li>{{{message}}} - {{authorName}}</li>
|
||||
{{/commits}}
|
||||
</ul>
|
||||
{{/tags}}
|
||||
"""
|
||||
templateContent = file('changelog.mustache').getText('UTF-8')
|
||||
}
|
||||
|
||||
curseforge {
|
||||
apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0'
|
||||
project {
|
||||
id = '59751'
|
||||
id = curse_project_id
|
||||
changelog = file('changelog.html')
|
||||
changelogType = 'html'
|
||||
releaseType = 'alpha'
|
||||
releaseType = 'beta'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Please help the Forestry project by <a href="https://github.com/ForestryMC/ForestryMC/issues">reporting issues here.</a><br/>
|
||||
{{#tags}}
|
||||
<h3>{{name}}</h3>
|
||||
<ul>
|
||||
{{#commits}}
|
||||
<li>{{{message}}} - {{authorName}}</li>
|
||||
{{/commits}}
|
||||
</ul>
|
||||
{{/tags}}
|
||||
Binary file not shown.
Executable → Regular
+10
-7
@@ -1,11 +1,14 @@
|
||||
mcversion=1.12
|
||||
forgeversion=14.21.1.2389
|
||||
mcp_mappings=snapshot_20170702
|
||||
mcversion=1.12.2
|
||||
forgeversion=14.23.1.2582
|
||||
mcp_mappings=snapshot_20170918
|
||||
curse_project_id=59751
|
||||
|
||||
tesla_version=1.0.60
|
||||
jei_version=4.7.0.67
|
||||
ic2_version=2.7.30-ex111
|
||||
tesla_mcversion=1.12
|
||||
jei_version=4.8.5.138
|
||||
jei_mcversion=1.12.2
|
||||
ic2_version=2.8.24-ex112
|
||||
|
||||
version_major=5
|
||||
version_minor=4
|
||||
version_patch=2
|
||||
version_minor=8
|
||||
version_patch=0
|
||||
Vendored
BIN
Binary file not shown.
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Sat Jun 24 19:47:39 PDT 2017
|
||||
#Mon Jul 03 15:24:47 PDT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
|
||||
@@ -42,11 +42,6 @@ case "`uname`" in
|
||||
;;
|
||||
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"
|
||||
@@ -114,6 +109,7 @@ fi
|
||||
if $cygwin ; 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`
|
||||
|
||||
+1
-1
Submodule lang updated: f5300f059b...c560d52707.
@@ -15,12 +15,13 @@ import com.google.common.base.Preconditions;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
@@ -29,12 +30,16 @@ import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.core.EventHandlerCore;
|
||||
import forestry.core.climate.ClimateEventHandler;
|
||||
import forestry.core.advancements.AdvancementManager;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.GameMode;
|
||||
@@ -44,10 +49,12 @@ import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.multiblock.MultiblockEventHandler;
|
||||
import forestry.core.network.PacketHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.MigrationHelper;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import forestry.modules.ForestryModules;
|
||||
import forestry.modules.ModuleManager;
|
||||
import forestry.plugins.ForestryCompatPlugins;
|
||||
import forestry.plugins.PluginIC2;
|
||||
import forestry.plugins.PluginNatura;
|
||||
|
||||
/**
|
||||
* Forestry Minecraft Mod
|
||||
@@ -59,10 +66,12 @@ import forestry.plugins.compat.PluginIC2;
|
||||
name = Constants.MOD_NAME,
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.12]",
|
||||
dependencies = "required-after:forge@[14.21.0.2363,);"
|
||||
+ "after:JEI@[4.7.0,);"
|
||||
+ "after:" + PluginIC2.modId + ";")
|
||||
acceptedMinecraftVersions = "[1.12.2,1.13.0)",
|
||||
dependencies = "required-after:forge@[14.23.0.2500,);"
|
||||
+ "after:jei@[4.7.8.91,);"
|
||||
+ "after:" + PluginIC2.modId + ";"
|
||||
+ "after:" + PluginNatura.modId + ";"
|
||||
+ "after:toughasnails;")
|
||||
public class Forestry {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@@ -75,8 +84,13 @@ public class Forestry {
|
||||
ForestryAPI.instance = this;
|
||||
ForestryAPI.forestryConstants = new Constants();
|
||||
ForestryAPI.errorStateRegistry = new ErrorStateRegistry();
|
||||
ForestryAPI.states = ClimateStates.INSTANCE;
|
||||
EnumErrorCode.init();
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
ModuleManager moduleManager = ModuleManager.getInstance();
|
||||
ForestryAPI.moduleManager = moduleManager;
|
||||
moduleManager.registerContainers(new ForestryModules(), new ForestryCompatPlugins());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -95,20 +109,31 @@ public class Forestry {
|
||||
EventHandlerCore eventHandlerCore = new EventHandlerCore();
|
||||
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new ClimateEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(Config.class);
|
||||
Proxies.common.registerEventHandlers();
|
||||
|
||||
configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID);
|
||||
Config.load(event.getSide());
|
||||
|
||||
PluginManager.runSetup(event);
|
||||
MinecraftForge.EVENT_BUS.post(new ForestryEvent.PreInit(this, event));
|
||||
|
||||
ModuleManager.runSetup(event);
|
||||
ModuleManager.getInternalHandler().runSetup();
|
||||
|
||||
String gameMode = Config.gameMode;
|
||||
Preconditions.checkState(gameMode != null);
|
||||
ForestryAPI.activeMode = new GameMode(gameMode);
|
||||
|
||||
PluginManager.runPreInit(event.getSide());
|
||||
ModuleManager.getInternalHandler().runPreInit(event.getSide());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void registerItems(RegistryEvent.Register<Item> event) {
|
||||
ModuleManager.getInternalHandler().runRegisterBackpacksAndCrates();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerModels(ModelRegistryEvent event) {
|
||||
Proxies.render.registerModels();
|
||||
}
|
||||
|
||||
@@ -117,14 +142,15 @@ public class Forestry {
|
||||
// Register gui handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
|
||||
|
||||
PluginManager.runInit();
|
||||
ModuleManager.getInternalHandler().runInit();
|
||||
|
||||
Proxies.render.registerItemAndBlockColors();
|
||||
AdvancementManager.registerTriggers();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
PluginManager.runPostInit();
|
||||
ModuleManager.getInternalHandler().runPostInit();
|
||||
|
||||
// Register world generator
|
||||
WorldGenerator worldGenerator = new WorldGenerator();
|
||||
@@ -134,12 +160,12 @@ public class Forestry {
|
||||
Proxies.common.registerTickHandlers(worldGenerator);
|
||||
|
||||
// Handle IMC messages.
|
||||
PluginManager.processIMCMessages(FMLInterModComms.fetchRuntimeMessages(ForestryAPI.instance));
|
||||
ModuleManager.getInternalHandler().processIMCMessages(FMLInterModComms.fetchRuntimeMessages(ForestryAPI.instance));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
PluginManager.serverStarting(event.getServer());
|
||||
ModuleManager.serverStarting(event.getServer());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -149,16 +175,6 @@ public class Forestry {
|
||||
|
||||
@EventHandler
|
||||
public void processIMCMessages(IMCEvent event) {
|
||||
PluginManager.processIMCMessages(event.getMessages());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMissingBlockMappings(RegistryEvent.MissingMappings<Block> event) {
|
||||
MigrationHelper.onMissingBlockMappings(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMissingItemMappings(RegistryEvent.MissingMappings<Item> event) {
|
||||
MigrationHelper.onMissingItemMappings(event);
|
||||
ModuleManager.getInternalHandler().processIMCMessages(event.getMessages());
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* 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.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
@@ -9,15 +9,19 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Other implementations than Forestry's default one are not supported.
|
||||
@@ -85,8 +89,27 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
List<IBee> spawnDrones(IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 5.5.4. Use {@link #plantFlowerRandom(IBeeHousing, List)}
|
||||
*/
|
||||
@Deprecated
|
||||
void plantFlowerRandom(IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* Plants a random flower from the given list near the housing
|
||||
*
|
||||
* @param housing the location the bee is living
|
||||
* @param potentialFlowers the flowers to choose from
|
||||
* @return the position of the planted flower, or null of none were planted
|
||||
* @since Forestry 5.5.4
|
||||
*/
|
||||
@Nullable
|
||||
default BlockPos plantFlowerRandom(IBeeHousing housing, List<IBlockState> potentialFlowers) {
|
||||
//noinspection deprecation
|
||||
plantFlowerRandom(housing);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
IIndividual retrievePollen(IBeeHousing housing);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ public interface IBeeFactory {
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleBeeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
|
||||
*
|
||||
* @param modId The modId of the mod that is creating the 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.
|
||||
@@ -24,8 +25,9 @@ public interface IBeeFactory {
|
||||
* @param primaryColor The outline color of this species
|
||||
* @param secondaryColor The body color of this species
|
||||
* @return a new bee species allele.
|
||||
* @since Forestry 5.6.0.
|
||||
*/
|
||||
IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
IAlleleBeeSpeciesBuilder createSpecies(String modId, String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
|
||||
/**
|
||||
* Creates a new bee branch.
|
||||
@@ -36,4 +38,10 @@ public interface IBeeFactory {
|
||||
* @return a new bee branch
|
||||
*/
|
||||
IClassification createBranch(String uid, String scientific);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 5.6.0. use {@link #createSpecies(String, String, boolean, String, String, String, IClassification, String, int, int)}
|
||||
*/
|
||||
@Deprecated
|
||||
IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
}
|
||||
@@ -5,16 +5,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Stores beekeeping logic for bee housings.
|
||||
@@ -79,4 +83,12 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
|
||||
* These positions are synced to the client from the server.
|
||||
*/
|
||||
List<BlockPos> getFlowerPositions();
|
||||
|
||||
default void readData(PacketBuffer data) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
default void writeData(PacketBuffer data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -37,10 +37,15 @@ public interface IBeekeepingMode {
|
||||
*/
|
||||
boolean isFatigued(IBee queen, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* @return true if the queen is being overworked in the bee housing (with chance). will trigger a negative effect.
|
||||
/**
|
||||
* @return true if the queen is being overworked in the bee housing (with chance). will trigger a negative effect.
|
||||
* @deprecated bees max out at 16x productivity instead of being overworked.
|
||||
* TODO remove this method in 1.13
|
||||
*/
|
||||
boolean isOverworked(IBee queen, IBeeHousing housing);
|
||||
@Deprecated
|
||||
default boolean isOverworked(IBee queen, IBeeHousing housing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the genetic structure of the queen is breaking down during spawning of the offspring (with chance). will trigger a negative effect.
|
||||
|
||||
@@ -20,5 +20,18 @@ public interface IHiveFrame {
|
||||
*/
|
||||
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
|
||||
|
||||
/**
|
||||
* @param frame ItemStack containing the actual frame.
|
||||
* @return the {@link IBeeModifier} for this frame.
|
||||
* @since Forestry 5.5.1
|
||||
*/
|
||||
default IBeeModifier getBeeModifier(ItemStack frame) {
|
||||
return getBeeModifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 5.5.1. Use {@link #getBeeModifier(ItemStack)}
|
||||
*/
|
||||
@Deprecated
|
||||
IBeeModifier getBeeModifier();
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
@@ -8,9 +8,10 @@ package forestry.api.apiculture.hives;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
|
||||
public interface IHiveRegistry {
|
||||
|
||||
/* Forestry Hive Names */
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* 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.core.IArmorNaturalist;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
|
||||
public class ArboricultureCapabilities {
|
||||
/**
|
||||
* Capability for {@link IArmorNaturalist}.
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public enum EnumFruitFamily implements IFruitFamily {
|
||||
PRUNES("prunes", "Prunus domestica"),
|
||||
@@ -37,12 +38,12 @@ public enum EnumFruitFamily implements IFruitFamily {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Translator.translateToLocal("for.family." + uid);
|
||||
return I18n.translateToLocal("for.family." + uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return Translator.translateToLocal("for.family." + uid + ".description");
|
||||
return I18n.translateToLocal("for.family." + uid + ".description");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* 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.Locale;
|
||||
|
||||
@@ -19,6 +19,4 @@ public interface IAlleleFruit extends IAlleleProperty<IAlleleFruit> {
|
||||
@Nullable
|
||||
String getModelName();
|
||||
|
||||
String getModID();
|
||||
|
||||
}
|
||||
@@ -7,15 +7,18 @@ package forestry.api.arboriculture;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.genetics.IAlleleProperty;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleTreeSpecies> {
|
||||
|
||||
@@ -36,11 +39,6 @@ public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAll
|
||||
* @return Tree generator for this species.
|
||||
*/
|
||||
ITreeGenerator getGenerator();
|
||||
|
||||
/**
|
||||
* @return The modid from the mod of the species.
|
||||
*/
|
||||
String getModID();
|
||||
|
||||
/**
|
||||
* @return Float between 0 and 1 representing the rarity of the species, will affect spawn rate. If it's 0, it will not spawn.
|
||||
|
||||
@@ -14,7 +14,10 @@ public interface ICharcoalPileWall {
|
||||
int getCharcoalAmount();
|
||||
|
||||
boolean matches(IBlockState state);
|
||||
|
||||
|
||||
@Deprecated
|
||||
NonNullList<ItemStack> getDisplyItems();
|
||||
|
||||
NonNullList<ItemStack> getDisplayItems();
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
@@ -5,32 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Color;
|
||||
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface ITreeFactory {
|
||||
/**
|
||||
* Creates a new tree species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleTreeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
|
||||
*
|
||||
* @param uid Unique Identifier for this species
|
||||
* @param unlocalizedName Unlocalized name for this species
|
||||
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
|
||||
* @param unlocalizedDescription Unlocalized description for this species
|
||||
* @param dominant Whether this species is genetically dominant (false means it is recessive)
|
||||
* @param branch Classification of this species
|
||||
* @param binomial Binomial name of the species sans genus. "humboldti" will have the bee species flavour name be "Apis humboldti". Feel free to use fun names or null.
|
||||
* @param modID The modID from the mod of the species
|
||||
* @param leafSpriteProvider The leaf sprite provider for this species
|
||||
* @param germlingModelProvider The germling model provider for this species
|
||||
* @param woodProvider The wood texture provider. It is used to get wood textures for the charcoal pile.
|
||||
* @param generator The tree generator
|
||||
* @return a new tree species allele.
|
||||
*/
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator);
|
||||
|
||||
/**
|
||||
* Creates a new tree species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
@@ -48,10 +28,18 @@ public interface ITreeFactory {
|
||||
* @param germlingModelProvider The germling model provider for this species
|
||||
* @param woodProvider The wood texture provider. It is used to get wood textures for the charcoal pile.
|
||||
* @param generator The tree generator
|
||||
* @param leafProvider The leaf provider
|
||||
* @return a new tree species allele.
|
||||
*/
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator, ILeafProvider leafProvider);
|
||||
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator, @Nullable ILeafProvider leafProvider);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 5.6.0. use {@link #createSpecies(String, String, String, String, boolean, IClassification, String, String, ILeafSpriteProvider, IGermlingModelProvider, IWoodProvider, ITreeGenerator, ILeafProvider)}
|
||||
*/
|
||||
@Deprecated
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator);
|
||||
|
||||
|
||||
/**
|
||||
* Get one of the built-in Forestry leaf types. Default type is deciduous.
|
||||
*/
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface ITreeGenome extends IGenome {
|
||||
|
||||
@Override
|
||||
@@ -37,6 +38,8 @@ public interface ITreeGenome extends IGenome {
|
||||
|
||||
int getGirth();
|
||||
|
||||
boolean getFireproof();
|
||||
|
||||
IAlleleLeafEffect getEffect();
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,15 +9,18 @@ import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRootPollinatable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.ISpeciesRootPollinatable;
|
||||
|
||||
public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
|
||||
@Override
|
||||
@@ -101,4 +104,6 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
List<ITreeMutation> getMutations(boolean shuffle);
|
||||
|
||||
Collection<IFruitProvider> getFruitProvidersForFruitFamily(IFruitFamily fruitFamily);
|
||||
}
|
||||
@@ -5,13 +5,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.core.ITextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ITextureManager;
|
||||
|
||||
public interface IWoodProvider {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerSprites(Item item, ITextureManager manager);
|
||||
@@ -29,11 +31,15 @@ public interface IWoodProvider {
|
||||
|
||||
/**
|
||||
* The amount of charcoal dropped from a charcoal pile of this wood.
|
||||
* @deprecated Will be removed in 1.13
|
||||
*/
|
||||
@Deprecated
|
||||
int getCarbonization();
|
||||
|
||||
/**
|
||||
* The chance that a pile has to drop a extra charcoal
|
||||
* @deprecated Will be removed in 1.13
|
||||
*/
|
||||
@Deprecated
|
||||
float getCharcoalChance(int numberOfCharcoal);
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* 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.util.IStringSerializable;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -57,6 +62,6 @@ public enum WoodBlockKind {
|
||||
break;
|
||||
}
|
||||
textures.putAll(customTextures);
|
||||
return model.retexture(new ImmutableMap.Builder<String, String>().putAll(textures).build());
|
||||
return model.retexture(ImmutableMap.copyOf(textures));
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "4.2.1", owner = "ForestryAPI|core", provides = "ForestryAPI|arboriculture")
|
||||
@API(apiVersion = "4.3.0", owner = "ForestryAPI|core", provides = "ForestryAPI|arboriculture")
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -8,6 +8,7 @@ package forestry.api.circuits;
|
||||
public enum CircuitSocketType implements ICircuitSocketType {
|
||||
NONE("none"),
|
||||
FARM("forestry.farm"),
|
||||
GREENHOUSE_CLIMATISER("forestry.greenhouse.climatiser"),
|
||||
ELECTRIC_ENGINE("forestry.electric.engine"),
|
||||
MACHINE("forestry.machine");
|
||||
|
||||
|
||||
@@ -7,11 +7,17 @@ package forestry.api.circuits;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public interface ICircuit {
|
||||
String getUID();
|
||||
|
||||
String getUnlocalizedName();
|
||||
|
||||
default String getLocalizedName(){
|
||||
return I18n.translateToLocal(getUnlocalizedName());
|
||||
}
|
||||
|
||||
boolean isCircuitable(Object tile);
|
||||
|
||||
void onInsertion(int slot, Object tile);
|
||||
|
||||
@@ -18,6 +18,8 @@ public interface ICircuitRegistry {
|
||||
|
||||
void registerCircuit(ICircuit circuit);
|
||||
|
||||
void registerDeprecatedCircuitReplacement(String deprecatedCircuit, ICircuit replacement);
|
||||
|
||||
@Nullable
|
||||
ICircuit getCircuit(String uid);
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public enum ClimateStateType {
|
||||
DEFAULT(0.0F, 2.0F),
|
||||
EXTENDED(-3.0F, 3.0F);
|
||||
|
||||
public final float boundDown, boundUp;
|
||||
|
||||
ClimateStateType(Float boundDown, Float boundUp) {
|
||||
this.boundDown = boundDown;
|
||||
this.boundUp = boundUp;
|
||||
}
|
||||
|
||||
public float clamp(float value) {
|
||||
return MathHelper.clamp(value, boundDown, boundUp);
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -5,14 +5,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimatiserDefinition {
|
||||
import java.util.Locale;
|
||||
|
||||
float getChange();
|
||||
|
||||
float getRange();
|
||||
|
||||
EnumClimatiserModes getMode();
|
||||
|
||||
EnumClimatiserTypes getType();
|
||||
public enum ClimateType {
|
||||
TEMPERATURE, HUMIDITY;
|
||||
|
||||
public String getName(){
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum EnumClimatiserModes {
|
||||
|
||||
POSITIVE, NEGATIVE, BOTH
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum EnumClimatiserTypes {
|
||||
|
||||
TEMPERATURE, HUMIDITY, BOTH
|
||||
|
||||
}
|
||||
@@ -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.climate;
|
||||
|
||||
public interface IClimateControl {
|
||||
|
||||
IClimateInfo getControlClimate();
|
||||
|
||||
void setControlClimate(IClimateInfo climateInfo);
|
||||
|
||||
float getControlTemperature();
|
||||
|
||||
float getControlHumidity();
|
||||
|
||||
void setControlTemperature(float temperature);
|
||||
|
||||
void setControlHumidity(float humidity);
|
||||
|
||||
}
|
||||
@@ -1,9 +1,16 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
/**
|
||||
* @deprecated TODO: Remove in 1.13, Use IClimateState
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IClimateInfo {
|
||||
|
||||
float getTemperature();
|
||||
|
||||
float getHumidity();
|
||||
|
||||
}
|
||||
@@ -5,37 +5,37 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateManager {
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link IClimateStates#create(float, float, ClimateStateType)}
|
||||
*/
|
||||
@Deprecated
|
||||
IClimateInfo createInfo(float temperature, float humidity);
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getClimateState(World, BlockPos)}
|
||||
*/
|
||||
@Deprecated
|
||||
IClimateInfo getInfo(World world, BlockPos pos);
|
||||
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
void addRegion(IClimateRegion region);
|
||||
|
||||
void removeRegion(IClimateRegion region);
|
||||
|
||||
void addSource(IClimateSourceProvider source);
|
||||
|
||||
void removeSource(IClimateSourceProvider source);
|
||||
|
||||
void onWorldUnload(World world);
|
||||
/**
|
||||
* Gets the current state of a container at this position or setSettings one with the datas from the biome.
|
||||
* @since 5.3.4
|
||||
*/
|
||||
IClimateState getClimateState(World world, BlockPos pos);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(World world, BlockPos pos);
|
||||
|
||||
@Nullable
|
||||
IClimateRegion getRegionForPos(World world, BlockPos pos);
|
||||
|
||||
Map<World, List<IClimateRegion>> getRegions();
|
||||
/**
|
||||
* Creates a climate state with the help of the biome on this position.
|
||||
* @since 5.3.4
|
||||
*/
|
||||
IClimateState getBiomeState(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return Create a climate manager.
|
||||
*/
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* A IClimatePosition contains the climate infos (temperature and humidity) of one position.
|
||||
*/
|
||||
public interface IClimatePosition extends INbtReadable, INbtWritable {
|
||||
|
||||
IClimateRegion getClimateRegion();
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
void setTemperature(float temperature);
|
||||
|
||||
void addTemperature(float temperature);
|
||||
|
||||
float getTemperature();
|
||||
|
||||
void setHumidity(float humidity);
|
||||
|
||||
void addHumidity(float humidity);
|
||||
|
||||
float getHumidity();
|
||||
|
||||
IClimateInfo getInfo();
|
||||
|
||||
}
|
||||
@@ -5,9 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IClimateProvider {
|
||||
Biome getBiome();
|
||||
|
||||
@@ -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.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateRegion extends INbtReadable, INbtWritable {
|
||||
|
||||
World getWorld();
|
||||
|
||||
int getTicksPerUpdate();
|
||||
|
||||
void setPosition(BlockPos pos, float temperature, float humidity);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(BlockPos pos);
|
||||
|
||||
Collection<IClimatePosition> getPositions();
|
||||
|
||||
void addSource(IClimateSource source);
|
||||
|
||||
void removeSource(IClimateSource source);
|
||||
|
||||
Collection<IClimateSource> getSources();
|
||||
|
||||
void calculateAverageClimate();
|
||||
|
||||
float getAverageTemperature();
|
||||
|
||||
float getAverageHumidity();
|
||||
|
||||
/**
|
||||
* Update the climate in a region.
|
||||
*/
|
||||
void updateClimate(int ticks);
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A climate source is used to change the climate in a region.
|
||||
*/
|
||||
public interface IClimateSource {
|
||||
|
||||
/**
|
||||
* @param tickCount The current tick count.
|
||||
* @param region The climate region, in that the source stands.
|
||||
* @return Return true if the the climate has changed.
|
||||
*/
|
||||
boolean changeClimate(int tickCount, IClimateRegion region);
|
||||
|
||||
/**
|
||||
* @return The ticks that are required for one change.
|
||||
*/
|
||||
int getTicksForChange(IClimateRegion region);
|
||||
|
||||
@Nullable
|
||||
IClimateSourceProvider getProvider();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
* A {@link IClimateState} is used to store and handle temperature and humidity.
|
||||
*
|
||||
* The values are oriented on the values of {@link Biome#getTemperature()} and {@link Biome#getRainfall()}.
|
||||
*/
|
||||
public interface IClimateState extends INbtWritable {
|
||||
|
||||
float getTemperature();
|
||||
|
||||
float getHumidity();
|
||||
|
||||
IClimateState addTemperature(float temperature);
|
||||
|
||||
IClimateState addHumidity(float humidity);
|
||||
|
||||
IClimateState add(IClimateState state);
|
||||
|
||||
IClimateState scale(double factor);
|
||||
|
||||
IClimateState remove(IClimateState state);
|
||||
|
||||
default float get(ClimateType type){
|
||||
return type == ClimateType.HUMIDITY ? getHumidity() : getTemperature();
|
||||
}
|
||||
|
||||
IClimateState copy(ClimateStateType type);
|
||||
|
||||
IClimateState copy();
|
||||
|
||||
boolean isPresent();
|
||||
|
||||
ClimateStateType getType();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface IClimateStates {
|
||||
|
||||
IClimateState create(NBTTagCompound compound);
|
||||
|
||||
IClimateState create(NBTTagCompound compound, ClimateStateType type);
|
||||
|
||||
IClimateState create(float temperature, float humidity, ClimateStateType type);
|
||||
|
||||
IClimateState create(IClimateState climateState, ClimateStateType type);
|
||||
|
||||
IClimateState absent();
|
||||
|
||||
IClimateState min();
|
||||
|
||||
IClimateState max();
|
||||
}
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "2.1.0", owner = "Forestry", provides = "ForestryAPI|climate")
|
||||
@API(apiVersion = "5.0.0", owner = "Forestry", provides = "ForestryAPI|climate")
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -9,12 +9,4 @@ public class CamouflageManager {
|
||||
|
||||
public static ICamouflageAccess camouflageAccess;
|
||||
|
||||
public static final String BLOCK = "block";
|
||||
|
||||
public static final String GLASS = "glass";
|
||||
|
||||
public static final String DOOR = "door";
|
||||
|
||||
public static final String NONE = "none";
|
||||
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public enum EnumHumidity {
|
||||
*/
|
||||
DAMP("Damp");
|
||||
|
||||
public static final EnumHumidity[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
|
||||
EnumHumidity(String name) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import forestry.api.climate.IClimateState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -73,7 +74,8 @@ public enum EnumTemperature {
|
||||
if (BiomeHelper.isBiomeHellish(biome)) {
|
||||
return HELLISH;
|
||||
}
|
||||
float temperature = ForestryAPI.climateManager.getInfo(world, pos).getTemperature();
|
||||
IClimateState state = ForestryAPI.climateManager.getClimateState(world, pos);
|
||||
float temperature = state.getTemperature();
|
||||
return getFromValue(temperature);
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,19 @@ package forestry.api.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.climate.IClimateManager;
|
||||
import forestry.api.farming.IFarmRegistry;
|
||||
import forestry.api.farming.ISimpleFarmLogic;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateManager;
|
||||
import forestry.api.climate.IClimateStates;
|
||||
import forestry.api.farming.IFarmRegistry;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.api.farming.ISimpleFarmLogic;
|
||||
import forestry.api.modules.IModuleContainer;
|
||||
import forestry.api.modules.IModuleManager;
|
||||
|
||||
/**
|
||||
* Forestry's API is divided into several subcategories to make it easier to understand.
|
||||
* <p>
|
||||
@@ -50,7 +57,18 @@ public class ForestryAPI {
|
||||
public static IClimateManager climateManager;
|
||||
|
||||
/**
|
||||
* A registry for register fertilizers, {@link IFarmabeles}s and {@link ISimpleFarmLogic}s
|
||||
* Instance of the module manager of forestry.
|
||||
* This can be used to register {@link IModuleContainer}s in the constructor of your mod.
|
||||
*/
|
||||
public static IModuleManager moduleManager;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static IClimateStates states;
|
||||
|
||||
/**
|
||||
* A registry for register fertilizers, {@link IFarmable}s and {@link ISimpleFarmLogic}s
|
||||
*/
|
||||
public static IFarmRegistry farmRegistry;
|
||||
|
||||
@@ -65,10 +83,20 @@ public class ForestryAPI {
|
||||
public static IForestryConstants forestryConstants;
|
||||
|
||||
/**
|
||||
* The currently enabled Forestry plugins.
|
||||
* The currently enabled Forestry modules.
|
||||
* Can be used to check if certain features are available, for example:
|
||||
* ForestryAPI.enabledPlugins.contains("APICULTURE")
|
||||
* ForestryAPI.enabledModules.contains(new ResourceLocation("forestry", "apiculture"))
|
||||
*/
|
||||
public static Set<ResourceLocation> enabledModules;
|
||||
|
||||
/**
|
||||
* The currently enabled Forestry modules.
|
||||
* Can be used to check if certain features are available, for example:
|
||||
* ForestryAPI.enabledPlugins.contains("forestry.apiculture")
|
||||
*
|
||||
* @deprecated Use {@link #enabledModules}
|
||||
*/
|
||||
@Deprecated
|
||||
public static Set<String> enabledPlugins;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,13 +5,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public abstract class ForestryEvent extends Event {
|
||||
|
||||
@@ -53,6 +57,24 @@ public abstract class ForestryEvent extends Event {
|
||||
this.tracker = tracker;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Posted before forestry registers all items and blocks.
|
||||
*
|
||||
* @deprecated removed in 1.13
|
||||
*/
|
||||
@Deprecated
|
||||
public static class PreInit extends ForestryEvent{
|
||||
/**
|
||||
* The main mod instance for Forestry.
|
||||
*/
|
||||
public Object instance;
|
||||
public final FMLPreInitializationEvent event;
|
||||
|
||||
public PreInit(Object instance, FMLPreInitializationEvent event) {
|
||||
this.instance = instance;
|
||||
this.event = event;
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -3,10 +3,11 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
public class GreenhouseManager {
|
||||
|
||||
public static IGreenhouseHelper greenhouseHelper;
|
||||
package forestry.api.core;
|
||||
|
||||
/**
|
||||
* The alignment of the text in a text gui element.
|
||||
*/
|
||||
public enum GuiElementAlignment {
|
||||
LEFT, CENTER, RIGHT
|
||||
}
|
||||
+4
-9
@@ -3,16 +3,11 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.core.ILocatable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateSourceProvider extends ILocatable {
|
||||
|
||||
IClimateSource getClimateSource();
|
||||
|
||||
Set<BlockPos> getPositionsInRange();
|
||||
public interface IBlockPosPredicate {
|
||||
boolean test(World world, BlockPos blockPos);
|
||||
}
|
||||
@@ -7,6 +7,8 @@ package forestry.api.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ICamouflageAccess {
|
||||
@@ -16,21 +18,20 @@ public interface ICamouflageAccess {
|
||||
*
|
||||
* @param itemHandler The handler that is to register.
|
||||
*/
|
||||
void registerCamouflageItemHandler(ICamouflageItemHandler itemHandler);
|
||||
void registerItemHandler(ICamouflageItemHandler itemHandler);
|
||||
|
||||
/**
|
||||
* @return A list of all item camouflage handler's that are registered for that camouflage type.
|
||||
*/
|
||||
List<ICamouflageItemHandler> getCamouflageItemHandler(String type);
|
||||
List<ICamouflageItemHandler> getItemHandlers();
|
||||
|
||||
void addItemToBlackList(String type, ItemStack camouflageBlock);
|
||||
void addItemToBlackList(ItemStack camouflageBlock);
|
||||
|
||||
void addModIdToBlackList(String type, String modID);
|
||||
void addModIdToBlackList(String modID);
|
||||
|
||||
boolean isItemBlackListed(String type, ItemStack camouflageBlock);
|
||||
|
||||
ICamouflageItemHandler getNoneItemHandler();
|
||||
boolean isItemBlackListed(ItemStack camouflageBlock);
|
||||
|
||||
ICamouflageItemHandler getHandlerFromItem(ItemStack stack);
|
||||
@Nullable
|
||||
ICamouflageItemHandler getHandler(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -12,22 +12,17 @@ public interface ICamouflageHandler extends ILocatable {
|
||||
/**
|
||||
* @return The item of the block that is the camouflage of this handler for the type.
|
||||
*/
|
||||
ItemStack getCamouflageBlock(String type);
|
||||
ItemStack getCamouflageBlock();
|
||||
|
||||
/**
|
||||
* @return The default camouflage block item for the type.
|
||||
*/
|
||||
ItemStack getDefaultCamouflageBlock(String type);
|
||||
|
||||
/**
|
||||
* @return True if the handler can handle this type of camouflage.
|
||||
*/
|
||||
boolean canHandleType(String type);
|
||||
ItemStack getDefaultCamouflageBlock();
|
||||
|
||||
/**
|
||||
* Set the camouflage block item for the type.
|
||||
*
|
||||
* @return True if the block has chanced.
|
||||
*/
|
||||
boolean setCamouflageBlock(String type, ItemStack camouflageBlock, boolean sendClientUpdate);
|
||||
boolean setCamouflageBlock(ItemStack camouflageBlock, boolean sendClientUpdate);
|
||||
}
|
||||
@@ -5,22 +5,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public interface ICamouflageItemHandler {
|
||||
|
||||
|
||||
boolean canHandle(ItemStack stack);
|
||||
|
||||
String getType();
|
||||
|
||||
float getLightTransmittance(ItemStack stack, ICamouflageHandler camouflageHandler);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile);
|
||||
Pair<IBlockState, IBakedModel> getModel(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -5,12 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface ICamouflagedTile {
|
||||
|
||||
String getCamouflageType();
|
||||
|
||||
BlockPos getCoordinates();
|
||||
public interface ICamouflagedTile extends ILocatable {
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IErrorStateRegistry {
|
||||
@@ -12,6 +13,7 @@ public interface IErrorStateRegistry {
|
||||
|
||||
void addAlias(IErrorState state, String name);
|
||||
|
||||
@Nullable
|
||||
IErrorState getErrorState(short id);
|
||||
|
||||
IErrorState getErrorState(String name);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IGuiElement {
|
||||
int getX();
|
||||
|
||||
int getY();
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
void setXOffset(int xOffset);
|
||||
|
||||
void setYOffset(int yOffset);
|
||||
|
||||
@Nullable
|
||||
IGuiElement getParent();
|
||||
|
||||
void setParent(@Nullable IGuiElement parent);
|
||||
|
||||
void draw(int startX, int startY);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
default List<String> getToolTip(int mouseX, int mouseY){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
boolean isMouseOver(int mouseX, int mouseY);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* 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.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
/**
|
||||
* A helper interface to create gui elements.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IGuiElementFactory {
|
||||
|
||||
IGuiElementHelper createHelper(IGuiElementLayout element);
|
||||
|
||||
/* GENETIC*/
|
||||
/**
|
||||
* @param dominant True if you want the dominant color and false if you want the recessive color.
|
||||
*
|
||||
* @return The color code that forestry uses to show if a allele is dominant (true) or recessive (false).
|
||||
*/
|
||||
int getColorCoding(boolean dominant);
|
||||
|
||||
/**
|
||||
* @return Null if the mutation is secret and undiscovered. {@link IMutation#isSecret()}
|
||||
*/
|
||||
IGuiElement createMutation(int x, int y, int width, int height, IMutation mutation, IAllele species, IBreedingTracker breedingTracker);
|
||||
|
||||
/**
|
||||
* @return Null if the mutation is secret and undiscovered. {@link IMutation#isSecret()}
|
||||
*/
|
||||
IGuiElement createMutationResultant(int x, int y, int width, int height, IMutation mutation, IBreedingTracker breedingTracker);
|
||||
|
||||
IGuiElement createFertilityInfo(IAlleleInteger fertilityAllele, int x, int texOffset);
|
||||
|
||||
IGuiElement createToleranceInfo(IAlleleTolerance toleranceAllele, IAlleleSpecies species, String text);
|
||||
|
||||
/* LAYOUTS */
|
||||
IGuiElementLayout createHorizontal(int xPos, int yPos, int height);
|
||||
|
||||
IGuiElementLayout createVertical(int xPos, int yPos, int width);
|
||||
|
||||
IGuiElementLayout createPanel(int xPos, int yPos, int width, int height);
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IGuiElementLayoutHelper.LayoutFactory;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
/**
|
||||
* A helper interface to add gui elements.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IGuiElementHelper {
|
||||
/**
|
||||
* Adds a {@link IGuiElement} to the parent of this.
|
||||
*/
|
||||
void add(IGuiElement element);
|
||||
|
||||
/**
|
||||
* Centers a element to the center of the x axis of the parent element.
|
||||
*
|
||||
* @return the element
|
||||
*/
|
||||
IGuiElement centerElement(IGuiElement element);
|
||||
|
||||
/**
|
||||
* Creates and adds an item gui element.
|
||||
*/
|
||||
void addItem(int x, ItemStack itemStack);
|
||||
|
||||
IGuiElementLayoutHelper layoutHelper(LayoutFactory layoutFactory, int width, int height);
|
||||
|
||||
/**
|
||||
* Adds the chromosomeName and the name of the active/not active allele, of the chromosome, with {@link #addText}.
|
||||
*/
|
||||
void addAllele(String chromosomeName, IIndividual individual, IChromosomeType chromosome, boolean active);
|
||||
|
||||
/**
|
||||
* Adds the chromosomeName and the result of toString with {@link #addText}.
|
||||
*/
|
||||
<A extends IAllele> void addAllele(String chromosomeName, Function<A, String> toString, IIndividual individual, IChromosomeType chromosome, boolean active);
|
||||
|
||||
void addFertilityInfo(IAlleleInteger fertilityAllele, int x, int texOffset);
|
||||
|
||||
void addToleranceInfo(IAlleleTolerance toleranceAllele, IAlleleSpecies species, String text);
|
||||
|
||||
void addMutation(int x, int y, int width, int height, IMutation mutation, IAllele species, IBreedingTracker breedingTracker);
|
||||
|
||||
void addMutationResultant(int x, int y, int width, int height, IMutation mutation, IBreedingTracker breedingTracker);
|
||||
|
||||
/**
|
||||
* Adds a text element with the default color,the align {@link GuiElementAlignment#LEFT} and the height 12.
|
||||
*/
|
||||
void addText(String text);
|
||||
|
||||
/**
|
||||
* Adds a text element with the align {@link GuiElementAlignment#LEFT} and the height 12.
|
||||
*/
|
||||
void addText(String text, int color);
|
||||
|
||||
/**
|
||||
* Adds a text element with the default color and the height 12.
|
||||
*/
|
||||
void addText(String text, GuiElementAlignment align);
|
||||
|
||||
/**
|
||||
* Adds a text element with the height 12.
|
||||
*/
|
||||
void addText(String text,GuiElementAlignment align, int color);
|
||||
|
||||
/**
|
||||
* Adds a text element.
|
||||
*/
|
||||
void addText(int x, int height, String text, GuiElementAlignment align, int color);
|
||||
|
||||
/**
|
||||
* @return The element to which all elements are added.
|
||||
*/
|
||||
IGuiElement getParent();
|
||||
|
||||
IGuiElementFactory factory();
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IGuiElementLayout extends IGuiElement {
|
||||
/**
|
||||
* Adds a element to this layout.
|
||||
*/
|
||||
IGuiElementLayout addElement(IGuiElement element);
|
||||
|
||||
/**
|
||||
* Removes a element from this layout.
|
||||
*/
|
||||
IGuiElementLayout removeElement(IGuiElement element);
|
||||
|
||||
default IGuiElementLayout addElements(IGuiElement... elements){
|
||||
for(IGuiElement element : elements){
|
||||
addElement(element);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
default IGuiElementLayout removeElements(IGuiElement... elements){
|
||||
for(IGuiElement element : elements){
|
||||
removeElement(element);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
default IGuiElementLayout addElements(Collection<IGuiElement> elements){
|
||||
elements.forEach(element -> addElement(element));
|
||||
return this;
|
||||
}
|
||||
|
||||
default IGuiElementLayout removeElements(Collection<IGuiElement> elements){
|
||||
elements.forEach(element -> removeElement(element));
|
||||
return this;
|
||||
}
|
||||
|
||||
List<IGuiElement> getElements();
|
||||
|
||||
IGuiElementLayout setDistance(int distance);
|
||||
|
||||
void addTooltip(String line);
|
||||
|
||||
/**
|
||||
* @return The tooltip that is displayed if the mouse is over this element and no element of this layout is under it.
|
||||
*/
|
||||
List<String> getTooltip();
|
||||
|
||||
/**
|
||||
* @return The distance between the different elements of this layout.
|
||||
*/
|
||||
int getDistance();
|
||||
|
||||
int getSize();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IGuiElementLayoutHelper {
|
||||
/**
|
||||
* @return Only false if the helper has no space to add this element.
|
||||
*/
|
||||
boolean add(IGuiElement element);
|
||||
|
||||
/**
|
||||
* Removes all layouts and resets all variables of this helper.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Adds the layouts to the parent of the {@link IGuiElementHelper}. And calls {@link #clear()}
|
||||
*/
|
||||
void finish();
|
||||
|
||||
/**
|
||||
* @return All layouts that were created with the help of this helper since the last {@link #clear()} or {@link #finish()}.
|
||||
*/
|
||||
Collection<IGuiElementLayout> layouts();
|
||||
|
||||
interface LayoutFactory {
|
||||
/**
|
||||
* A factory method to create new layouts if the last layout is full.
|
||||
*/
|
||||
IGuiElementLayout createLayout(int xOffset, int yOffset);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Interface for things, that have a location.
|
||||
* Must not be named "getWorld" and "getPos" to avoid
|
||||
* SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*/
|
||||
public interface ILocatable {
|
||||
BlockPos getCoordinates();
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*/
|
||||
World getWorldObj();
|
||||
}
|
||||
@@ -12,13 +12,17 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A model baker to make custom models
|
||||
*
|
||||
* @deprecated TODO Remove in 1.13: Not needed in the api
|
||||
*/
|
||||
@Deprecated
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IModelBaker {
|
||||
|
||||
@@ -34,6 +38,8 @@ public interface IModelBaker {
|
||||
|
||||
void addBakedModel(@Nullable IBlockState state, IBakedModel model);
|
||||
|
||||
void addBakedModelPost(@Nullable IBlockState state, IBakedModel model);
|
||||
|
||||
void addFace(EnumFacing facing, TextureAtlasSprite sprite);
|
||||
|
||||
void setModelState(@Nullable IModelState modelState);
|
||||
|
||||
@@ -15,6 +15,10 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* @deprecated TODO Remove in 1.13: Not needed in the api
|
||||
*/
|
||||
@Deprecated
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IModelBakerModel extends IBakedModel {
|
||||
|
||||
|
||||
@@ -8,9 +8,14 @@ package forestry.api.core;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* @deprecated TODO Remove in 1.13: Not needed in the api
|
||||
*/
|
||||
@Deprecated
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IModelManager {
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* 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.nbt.NBTTagCompound;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "5.1.0", owner = "Forestry", provides = "ForestryAPI|core")
|
||||
@API(apiVersion = "5.7.0", owner = "Forestry", provides = "ForestryAPI|core")
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -5,14 +5,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
//TODO: Remove this class in 1.13
|
||||
@Deprecated
|
||||
public class Farmables {
|
||||
/**
|
||||
* Can be used to add IFarmables to some of the vanilla farm logics.
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
|
||||
public interface IFarmHousing extends IErrorLogicSource {
|
||||
|
||||
BlockPos getCoords();
|
||||
@@ -33,10 +35,36 @@ public interface IFarmHousing extends IErrorLogicSource {
|
||||
* Will remove the appropriate germling from the farm's inventory.
|
||||
* It's up to the logic to only call this on a valid location.
|
||||
*
|
||||
* @deprecated TODO remove this method in 1.13
|
||||
*
|
||||
* @return true if planting was successful, false otherwise.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean plantGermling(IFarmable farmable, World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Callback for {@link IFarmLogic}s to plant a sapling, seed, germling, stem.
|
||||
* Will remove the appropriate germling from the farm's inventory.
|
||||
* It's up to the logic to only call this on a valid location.
|
||||
*
|
||||
* @return true if planting was successful, false otherwise.
|
||||
*/
|
||||
default boolean plantGermling(IFarmable farmable, World world, BlockPos pos, FarmDirection direction){
|
||||
return plantGermling(farmable, world, pos);
|
||||
}
|
||||
|
||||
default boolean isValidPlatform(World world, BlockPos pos){
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean isSquare(){
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean canPlantSoil(boolean manual){
|
||||
return true;
|
||||
}
|
||||
|
||||
/* INTERACTION WITH HATCHES */
|
||||
IFarmInventory getFarmInventory();
|
||||
|
||||
|
||||
@@ -27,4 +27,6 @@ public interface IFarmInventory {
|
||||
IInventory getResourcesInventory();
|
||||
|
||||
IInventory getFertilizerInventory();
|
||||
|
||||
|
||||
}
|
||||
@@ -7,37 +7,137 @@ package forestry.api.farming;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
/**
|
||||
* The IFarmLogic is used by farm blocks and multi-blocks to cultivate and harvest crops and plants.
|
||||
*
|
||||
* Every farm block has only ony one logic a multi-block farm has four, one for every direction.
|
||||
*/
|
||||
public interface IFarmLogic {
|
||||
|
||||
/**
|
||||
* @return The amount of fertilizer that the {@link IFarmHousing} automatically removes after this logic cultivated
|
||||
* a block or harvested a crop.
|
||||
*/
|
||||
int getFertilizerConsumption();
|
||||
|
||||
/**
|
||||
* @param hydrationModifier A modifier that depends on the weather and the biome of the farm.
|
||||
*
|
||||
* @return The amount of water that the {@link IFarmHousing} automatically removes after this logic cultivated
|
||||
* a block or harvested a crop.
|
||||
*/
|
||||
int getWaterConsumption(float hydrationModifier);
|
||||
|
||||
/**
|
||||
* Checks if the given stack is a resource or a soil that this logic uses to grow plants on or to create other
|
||||
* products like peat.
|
||||
*/
|
||||
boolean isAcceptedResource(ItemStack itemstack);
|
||||
|
||||
/**
|
||||
* Checks if the given stack is a germling (plantable sapling, seed, etc.) for any {@link IFarmable} of this farm.
|
||||
*/
|
||||
boolean isAcceptedGermling(ItemStack itemstack);
|
||||
|
||||
/**
|
||||
* Collects all items that are laying on the ground and are in the {@link IFarmHousing#getArea()} of the farm.
|
||||
*
|
||||
* @param world The world of the farm.
|
||||
* @param farmHousing The farm that uses this logic.
|
||||
*
|
||||
* @return A collection that contains all items that were collected.
|
||||
*/
|
||||
NonNullList<ItemStack> collect(World world, IFarmHousing farmHousing);
|
||||
|
||||
/**
|
||||
* Tries to cultivate one or more blocks at the given position and with the given extent.
|
||||
*
|
||||
* @param world The world of the farm.
|
||||
* @param farmHousing The farm that uses this logic.
|
||||
* @param pos The position at that the logic should start to cultivate.
|
||||
* @param direction The direction of the extension.
|
||||
* @param extent How many blocks this logic has to cultivate after it cultivated the block at the given position.
|
||||
* The positions of the next blocks are having a offset in the given direction.
|
||||
* @return True if the logic has cultivated any block.
|
||||
*/
|
||||
boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent);
|
||||
|
||||
/**
|
||||
* Tries to harvest one or more blocks at the given position and with the given extent.
|
||||
*
|
||||
* @param world The world of the farm.
|
||||
* @param pos The position at that the logic should start to harvest.
|
||||
* @param direction The direction of the extension.
|
||||
* @param extent How many blocks this logic tries to harvest after it has tried to harvested the block at the given position.
|
||||
* The positions of the next blocks are having a offset in the given direction.
|
||||
* @return True if the logic has cultivated any block.
|
||||
*/
|
||||
Collection<ICrop> harvest(World world, BlockPos pos, FarmDirection direction, int extent);
|
||||
|
||||
IFarmLogic setManual(boolean manual);
|
||||
/**
|
||||
* Returns the {@link IFarmProperties} that created this logic.
|
||||
*
|
||||
* @since Forestry 5.8
|
||||
*
|
||||
* @return Returns the {@link IFarmProperties} that created this logic. Returns a fake instance from
|
||||
* {@link IFarmRegistry#createFakeInstance(IFarmLogic)} if the logic is older that Forestry 5.8.
|
||||
* TODO: Remove "default" from this method in 1.13
|
||||
*/
|
||||
default IFarmProperties getProperties(){
|
||||
return ForestryAPI.farmRegistry.createFakeInstance(this);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ResourceLocation getTextureMap();
|
||||
/**
|
||||
* @deprecated Since Forestry 5.8 logic instances are created at the constructor of the {@link IFarmProperties} and
|
||||
* have a immutable manual state. TODO Remove this method in 1.13
|
||||
*/
|
||||
@Deprecated
|
||||
default IFarmLogic setManual(boolean manual){
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link IFarmRegistry#getProperties(String)} to get the {@link IFarmProperties} for the farm logic and register the soil
|
||||
* with {@link IFarmProperties#registerSoil(ItemStack, IBlockState, boolean)}.
|
||||
*/
|
||||
@Deprecated
|
||||
default void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData){
|
||||
//
|
||||
}
|
||||
|
||||
default String getUnlocalizedName(){
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Localized short, human-readable identifier used in the farm gui and in tooltips.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/* GUI ONLY */
|
||||
/**
|
||||
* @deprecated No longer needed because mc always uses the same map for blocks and items.
|
||||
* TODO remove this method in 1.13
|
||||
*/
|
||||
@Deprecated
|
||||
@SideOnly(Side.CLIENT)
|
||||
default ResourceLocation getTextureMap(){
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the itemStack that represents this farm logic. Used as an icon for the farm logic.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package forestry.api.farming;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* @since Forestry 5.8
|
||||
*/
|
||||
public interface IFarmProperties {
|
||||
|
||||
/**
|
||||
* Can be used to register a {@link IBlockState} as a valid soil.
|
||||
*/
|
||||
default void registerSoil(ItemStack resource, IBlockState soilState){
|
||||
registerSoil(resource, soilState, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to register a {@link IBlockState} as a valid soil.
|
||||
*/
|
||||
void registerSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData);
|
||||
|
||||
/**
|
||||
* Adds the {@link IFarmable}s that where registered with the given identifier.
|
||||
*/
|
||||
void registerFarmables(String identifier);
|
||||
|
||||
/**
|
||||
* @return true if the given block state is a valid soil state.
|
||||
*/
|
||||
boolean isAcceptedSoil(IBlockState blockState);
|
||||
|
||||
/**
|
||||
* @return true if the given stack is the {@link ItemStack} of a soil.
|
||||
*/
|
||||
boolean isAcceptedResource(ItemStack itemStack);
|
||||
|
||||
Collection<ISoil> getSoils();
|
||||
|
||||
Collection<IFarmable> getFarmables();
|
||||
|
||||
/**
|
||||
* Returns the instance of the manual or managed {@link IFarmLogic}.
|
||||
*/
|
||||
IFarmLogic getLogic(boolean manuel);
|
||||
}
|
||||
@@ -5,16 +5,45 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFarmRegistry {
|
||||
|
||||
/**
|
||||
* Registers farming logic in registry under given identifier
|
||||
* @param identifier Valid identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
|
||||
* @param logic corresponding instance of logic
|
||||
*
|
||||
* @deprecated Since Forestry 5.8. Use {@link #registerLogic(String, BiFunction, String...)} or
|
||||
* {@link #registerLogic(String, IFarmProperties)}.
|
||||
*/
|
||||
@Deprecated
|
||||
void registerLogic(String identifier, IFarmLogic logic);
|
||||
|
||||
/**
|
||||
* Registers farming logic in registry
|
||||
* @since Forestry 5.8
|
||||
*/
|
||||
IFarmProperties registerLogic(String identifier, IFarmProperties farmInstance);
|
||||
|
||||
/**
|
||||
* Registers farming logic in registry under given identifier
|
||||
*
|
||||
* @param identifier Valid identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
|
||||
* @param logicFactory factory that creates the corresponding instance of logic
|
||||
* @param farmablesIdentifiers Identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
|
||||
* @since Forestry 5.8
|
||||
*/
|
||||
IFarmProperties registerLogic(String identifier, BiFunction<IFarmProperties, Boolean, IFarmLogic> logicFactory, String... farmablesIdentifiers);
|
||||
|
||||
/**
|
||||
* Can be used to add IFarmables to some of the vanilla farm logics.
|
||||
* <p>
|
||||
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
|
||||
* Identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
|
||||
*/
|
||||
void registerFarmables(String identifier, IFarmable... farmable);
|
||||
|
||||
@@ -22,13 +51,20 @@ public interface IFarmRegistry {
|
||||
|
||||
/**
|
||||
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
|
||||
*
|
||||
* @return Null if the farming plugin is not active.
|
||||
*
|
||||
* @deprecated Since Forestry 5.8. Use {@link #createCropLogic(IFarmProperties, boolean, ISimpleFarmLogic)} instead.
|
||||
*/
|
||||
IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic);
|
||||
@Nullable
|
||||
@Deprecated
|
||||
default IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param itemStack
|
||||
* @param value The value of the fertitlizer.The value of the forestry fertelizer is 500.
|
||||
* @param value The value of the fertitlizer. The value of the forestry fertelizer is 500.
|
||||
*/
|
||||
void registerFertilizer(ItemStack itemStack, int value);
|
||||
|
||||
@@ -36,5 +72,28 @@ public interface IFarmRegistry {
|
||||
* @return The value of the fertitlizer
|
||||
*/
|
||||
int getFertilizeValue(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Returns a fake {@link IFarmProperties} that returns the given logic at {@link IFarmProperties#getLogic(boolean)}.
|
||||
*
|
||||
* @since Forestry 5.8
|
||||
* @deprecated Only for backwards comparability.
|
||||
*/
|
||||
@Deprecated
|
||||
IFarmProperties createFakeInstance(IFarmLogic logic);
|
||||
|
||||
/**
|
||||
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
|
||||
*
|
||||
* @return Null if the farming plugin is not active.
|
||||
*/
|
||||
@Nullable
|
||||
IFarmLogic createCropLogic(IFarmProperties instance, boolean isManual, ISimpleFarmLogic simpleFarmLogic);
|
||||
|
||||
/**
|
||||
* @since Forestry 5.8
|
||||
*/
|
||||
@Nullable
|
||||
IFarmProperties getProperties(String identifier);
|
||||
|
||||
}
|
||||
@@ -20,8 +20,19 @@ public interface IFarmable {
|
||||
|
||||
/**
|
||||
* @return true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
|
||||
* @deprecated Since Forestry 5.8. Use the version below. TODO Remove this method in 1.13
|
||||
*/
|
||||
boolean isSaplingAt(World world, BlockPos pos);
|
||||
@Deprecated
|
||||
default boolean isSaplingAt(World world, BlockPos pos){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
|
||||
*/
|
||||
default boolean isSaplingAt(World world, BlockPos pos, IBlockState blockState){
|
||||
return isSaplingAt(world, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link ICrop} if the block at the given location is a harvestable and mature crop, null otherwise.
|
||||
|
||||
@@ -8,7 +8,9 @@ package forestry.api.farming;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* A simple version of the IFarmLogic.
|
||||
* A simple version of the IFarmLogic.
|
||||
*
|
||||
* @apiNote TODO Remove this in 1.13
|
||||
*/
|
||||
public interface ISimpleFarmLogic {
|
||||
|
||||
@@ -16,7 +18,11 @@ public interface ISimpleFarmLogic {
|
||||
* @return the itemStack that represents this farm logic. Used as an icon for the farm logic.
|
||||
*/
|
||||
ItemStack getIconItemStack();
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Since 5.8
|
||||
*/
|
||||
@Deprecated
|
||||
Iterable<IFarmable> getSeeds();
|
||||
|
||||
String getName();
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package forestry.api.farming;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* @since Forestry 5.8
|
||||
*/
|
||||
public interface ISoil {
|
||||
|
||||
ItemStack getResource();
|
||||
|
||||
IBlockState getSoilState();
|
||||
|
||||
boolean hasMetaData();
|
||||
}
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "2.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
|
||||
@API(apiVersion = "5.8.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -23,4 +23,9 @@ public class AlleleManager {
|
||||
* Creates Forestry alleles.
|
||||
*/
|
||||
public static IAlleleFactory alleleFactory;
|
||||
|
||||
/**
|
||||
* @since 5.8
|
||||
*/
|
||||
public static IFilterRegistry filterRegistry;
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
/**
|
||||
* Every instance of this enum represents a tab in the database.
|
||||
*/
|
||||
public enum EnumDatabaseTab {
|
||||
//Used to display information about the active species of the individual.
|
||||
ACTIVE_SPECIES,
|
||||
//Used to display information about the inactive species of the individual.
|
||||
INACTIVE_SPECIES,
|
||||
//Used to display information about the products of the active species of the individual.
|
||||
PRODUCTS,
|
||||
//Used to display information about the mutations of the active species of the individual.
|
||||
MUTATIONS;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
public class GeneticCapabilities {
|
||||
/**
|
||||
* Capability for {@link IFilterLogic}.
|
||||
*/
|
||||
@CapabilityInject(IFilterLogic.class)
|
||||
public static Capability<IFilterLogic> FILTER_LOGIC;
|
||||
}
|
||||
@@ -21,6 +21,14 @@ public interface IAllele {
|
||||
*/
|
||||
String getUID();
|
||||
|
||||
/**
|
||||
* @return modId of the mod that created this allele
|
||||
* @since Forestry 5.6.0
|
||||
*/
|
||||
default String getModID() {
|
||||
return "forestry";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the allele is dominant, false otherwise.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
public interface IAlleleProperty<A extends IAlleleProperty<A>> extends IAllele, Comparable<A> {
|
||||
|
||||
@@ -207,7 +207,7 @@ public interface IAlleleRegistry {
|
||||
* @param handler IAlleleHandler to register.
|
||||
*/
|
||||
void registerAlleleHandler(IAlleleHandler handler);
|
||||
|
||||
|
||||
/* BLACKLIST */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -5,10 +5,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
|
||||
/**
|
||||
* Keeps track of who bred, discovered, and researched which species in a world.
|
||||
*
|
||||
@@ -67,6 +71,13 @@ public interface IBreedingTracker {
|
||||
*/
|
||||
boolean isDiscovered(IAlleleSpecies species);
|
||||
|
||||
/**
|
||||
* @return A collection that contains the {@link IAllele#getUID()}s of all discovered species.
|
||||
*/
|
||||
default Collection<String> getDiscoveredSpecies(){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a successfully researched mutation.
|
||||
* Mutations are normally researched in the Escritoire.
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IGuiElementHelper;
|
||||
|
||||
/**
|
||||
* A tab of the database screen that shows some information about a {@link IIndividual}.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IDatabaseTab<I extends IIndividual> {
|
||||
/**
|
||||
* Creates the gui elements that are displayed if this tab is selected in the database.
|
||||
*
|
||||
* @param individual The individual that is currently in the database selected.
|
||||
* @param elementHelper A helper to create the gui elements.
|
||||
*/
|
||||
void createElements(IGuiElementHelper elementHelper, I individual, ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* @return The slot of this tab.
|
||||
*/
|
||||
EnumDatabaseTab getTab();
|
||||
|
||||
/**
|
||||
* Can be used to give the tab a custom tooltip.
|
||||
*/
|
||||
@Nullable
|
||||
default String getTooltip(I individual){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
public interface IFilterData {
|
||||
|
||||
/**
|
||||
* If the root is present, returns the root,
|
||||
* otherwise throws {@code NoSuchElementException}.
|
||||
*/
|
||||
ISpeciesRoot getRoot();
|
||||
|
||||
/**
|
||||
* If the individual is present, returns the individual,
|
||||
* otherwise throws {@code NoSuchElementException}.
|
||||
*/
|
||||
IIndividual getIndividual();
|
||||
|
||||
/**
|
||||
* If the type is present, returns the type,
|
||||
* otherwise throws {@code NoSuchElementException}.
|
||||
*/
|
||||
ISpeciesType getType();
|
||||
|
||||
/**
|
||||
* @return True if this data contains a root, individual and type.
|
||||
*/
|
||||
boolean isPresent();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
public interface IFilterLogic extends INbtWritable, INbtReadable {
|
||||
void writeGuiData(PacketBuffer data);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void readGuiData(PacketBuffer data) throws IOException;
|
||||
|
||||
Collection<EnumFacing> getValidDirections(ItemStack itemStack, EnumFacing from);
|
||||
|
||||
boolean isValid(ItemStack itemStack, EnumFacing facing);
|
||||
|
||||
boolean isValid(EnumFacing facing, ItemStack itemStack, IFilterData filterData);
|
||||
|
||||
boolean isValidAllelePair(EnumFacing orientation, String activeUID, String inactiveUID);
|
||||
|
||||
IFilterRuleType getRule(EnumFacing facing);
|
||||
|
||||
boolean setRule(EnumFacing facing, IFilterRuleType rule);
|
||||
|
||||
@Nullable
|
||||
IAllele getGenomeFilter(EnumFacing facing, int index, boolean active);
|
||||
|
||||
boolean setGenomeFilter(EnumFacing facing, int index, boolean active, @Nullable IAllele allele);
|
||||
|
||||
void sendToServer(EnumFacing facing, int index, boolean active, @Nullable IAllele allele);
|
||||
|
||||
void sendToServer(EnumFacing facing, IFilterRuleType rule);
|
||||
|
||||
INetworkHandler getNetworkHandler();
|
||||
|
||||
interface INetworkHandler{
|
||||
/**
|
||||
* Sends the data of the logic to the client of all players that have the gui currently open.
|
||||
*
|
||||
* @param player The player that changed the filter.
|
||||
*/
|
||||
void sendToPlayers(IFilterLogic logic, WorldServer server, EntityPlayer player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import forestry.api.core.ILocatable;
|
||||
|
||||
/**
|
||||
* @since 5.8
|
||||
*/
|
||||
public interface IFilterRegistry {
|
||||
/**
|
||||
* Registers a filter rule.
|
||||
*/
|
||||
void registerFilter(IFilterRuleType rule);
|
||||
|
||||
Collection<IFilterRuleType> getRules();
|
||||
|
||||
IFilterRuleType getDefaultRule();
|
||||
|
||||
@Nullable
|
||||
IFilterRuleType getRule(String uid);
|
||||
|
||||
@Nullable
|
||||
IFilterRuleType getRule(int id);
|
||||
|
||||
int getId(IFilterRuleType rule);
|
||||
|
||||
IFilterLogic createLogic(ILocatable locatable, IFilterLogic.INetworkHandler networkHandler);
|
||||
|
||||
default IFilterRuleType getRuleOrDefault(String uid){
|
||||
IFilterRuleType rule = getRule(uid);
|
||||
return rule != null ? rule : getDefaultRule();
|
||||
}
|
||||
|
||||
default IFilterRuleType getRuleOrDefault(int id){
|
||||
IFilterRuleType rule = getRule(id);
|
||||
return rule != null ? rule : getDefaultRule();
|
||||
}
|
||||
}
|
||||
Loaded 100 of 1035 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user