mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 09:34:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ebced9609 | ||
|
|
b9924ea98b | ||
|
|
5707d27598 | ||
|
|
42bde9e576 | ||
|
|
76f09be39d | ||
|
|
e6cb758e0e | ||
|
|
b3549edf51 | ||
|
|
e09d159935 | ||
|
|
4cb2610b1c | ||
|
|
c44f11cf09 | ||
|
|
b69c31ed8a | ||
|
|
6a2231f8fb | ||
|
|
a3a6c71c42 | ||
|
|
8d5c0c6f8b | ||
|
|
56603fd00c | ||
|
|
ed69411d2e | ||
|
|
e1d017f077 | ||
|
|
9269af7a13 | ||
|
|
8ffdba5021 | ||
|
|
e00aecd886 | ||
|
|
98f859f2fb | ||
|
|
55a15d23b2 | ||
|
|
307580aed8 | ||
|
|
d2d93004e0 | ||
|
|
e1df424bfd | ||
|
|
6a75347b05 | ||
|
|
cfd513ea80 | ||
|
|
edcc47a6b3 | ||
|
|
6593118f3d | ||
|
|
fd724d147a | ||
|
|
b2e1b2dc9b | ||
|
|
defc47000b | ||
|
|
0a37ad0666 | ||
|
|
13d4907bff | ||
|
|
78725009c1 | ||
|
|
a1bc9144bd | ||
|
|
b897056824 | ||
|
|
87563b6c97 | ||
|
|
62d6294da2 | ||
|
|
b4d71543db | ||
|
|
73db1a608a | ||
|
|
1c6b60122e | ||
|
|
1e7a042b53 | ||
|
|
bf08336bc5 | ||
|
|
62cbf31ac2 | ||
|
|
a2eac214b4 | ||
|
|
32933ce90b | ||
|
|
44cdc191fc | ||
|
|
e4f77e42d3 | ||
|
|
9f91832c7e | ||
|
|
6d4af0fb5d | ||
|
|
4345739a87 | ||
|
|
0a881a81f8 | ||
|
|
b066f7ad4c | ||
|
|
a19380347a | ||
|
|
9bc1211e57 | ||
|
|
cbce5d0fc0 | ||
|
|
b20b56c5d4 | ||
|
|
27041c205c | ||
|
|
00504d4096 | ||
|
|
ed0c5e1a7e | ||
|
|
ddf90f4ee0 | ||
|
|
39290512cf | ||
|
|
09ea20729d | ||
|
|
736e6c5fa2 | ||
|
|
e96f4fc8a0 | ||
|
|
bbe1f539dd | ||
|
|
1fcaacd41b | ||
|
|
7306764c51 | ||
|
|
d3c7280f3f | ||
|
|
2c6ed06574 | ||
|
|
81e2e18089 | ||
|
|
7b7e7eb7e7 | ||
|
|
944aaf3297 | ||
|
|
5a5793f243 | ||
|
|
5e41a4d2c0 | ||
|
|
c4ac0bc7a5 | ||
|
|
5549cfaaa1 | ||
|
|
ae4d246c59 | ||
|
|
2622557a00 | ||
|
|
339abedeee | ||
|
|
149b35224a | ||
|
|
d148279224 | ||
|
|
554fe8bad1 | ||
|
|
27e8259ff6 | ||
|
|
3a51df154a | ||
|
|
a3c79c0427 | ||
|
|
f569a04797 | ||
|
|
610ddfed12 | ||
|
|
438883bb8e | ||
|
|
828dd63acd | ||
|
|
f7cc35d949 | ||
|
|
ec9004b50b | ||
|
|
8b4c1a5dab | ||
|
|
853355062e | ||
|
|
834e3ed55a | ||
|
|
5b2b0bfc95 | ||
|
|
4fae8c26d9 | ||
|
|
0aa4a0f794 | ||
|
|
ac0864303c | ||
|
|
8811b24811 | ||
|
|
904293f407 | ||
|
|
3e175aa8e6 | ||
|
|
c4ecdde110 | ||
|
|
4aa978023d | ||
|
|
50009786d8 | ||
|
|
032d706fc4 | ||
|
|
dcd9e90898 | ||
|
|
bab3479cde | ||
|
|
a5b79c97d2 | ||
|
|
05d6dc3d4a | ||
|
|
6e2ed37e80 | ||
|
|
c840945706 | ||
|
|
ca7d6dbc66 | ||
|
|
81ef5d536f | ||
|
|
f911100c3d | ||
|
|
386f0645a5 | ||
|
|
91d46d1331 | ||
|
|
e1eb4d25fb | ||
|
|
72234d9b5d | ||
|
|
97f21bfda8 | ||
|
|
c8c30073a2 | ||
|
|
dc27154c1f | ||
|
|
5b15e6f405 | ||
|
|
2530a7fb15 | ||
|
|
4ec1381fbe | ||
|
|
d97f6f69b0 | ||
|
|
c8fcb292d4 | ||
|
|
e075fe8fbf | ||
|
|
5ce9b9f65b | ||
|
|
2c9a30db73 | ||
|
|
4a31215ce1 | ||
|
|
4da5e86813 | ||
|
|
66bdedd65b | ||
|
|
0149013579 | ||
|
|
bebf5b3aec | ||
|
|
0356a3f479 | ||
|
|
d29aa13377 | ||
|
|
c2313c7569 | ||
|
|
bb28a6db48 | ||
|
|
f61f7a0aff | ||
|
|
84f01de7f9 | ||
|
|
ced6f3cbf2 | ||
|
|
bbec31fc6e | ||
|
|
67024ffb2b | ||
|
|
1945c4ff70 | ||
|
|
7a1e35e05f | ||
|
|
06adb53944 | ||
|
|
919ce8238b | ||
|
|
6f285d1c88 | ||
|
|
af9ddb4928 | ||
|
|
1d2f3f16ab | ||
|
|
7f63ae8450 | ||
|
|
77ecd03416 | ||
|
|
56a907dbec | ||
|
|
e93633d999 | ||
|
|
fc0d144508 | ||
|
|
252dd8ab22 | ||
|
|
6ef41d4cd8 | ||
|
|
0b08780964 | ||
|
|
1cf24982fd | ||
|
|
9555005ac0 | ||
|
|
00b4b6552c | ||
|
|
23a9af3020 | ||
|
|
84a14811d8 | ||
|
|
7b340fdb49 | ||
|
|
9044a72aee | ||
|
|
cc40bd1cc3 | ||
|
|
a13e63cb2d | ||
|
|
6cb3b73200 | ||
|
|
7c8d81470d | ||
|
|
ef3f64fdd9 | ||
|
|
fdd6d75d0e | ||
|
|
46bb2cdccd | ||
|
|
aa21b31392 | ||
|
|
6a12e19798 | ||
|
|
81dd20b41c | ||
|
|
0b491f26fc | ||
|
|
bb0a0343c1 | ||
|
|
17e38e7c5e | ||
|
|
0ad3baecda | ||
|
|
a72971e042 | ||
|
|
b5e24e84cb | ||
|
|
c210886400 | ||
|
|
1bdbb7e9f8 | ||
|
|
f91c0574ad | ||
|
|
50f0efb7a0 | ||
|
|
3d932700cd | ||
|
|
6a00a65aac | ||
|
|
1b781684a0 | ||
|
|
f2d280a861 | ||
|
|
87ce642235 | ||
|
|
b297bbb2c4 | ||
|
|
931e518ca2 | ||
|
|
7ff4944281 |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
Thank you for reporting!
|
||||
|
||||
For issues:
|
||||
* Try the latest version, it may have fixed the issue already.
|
||||
* If you crashed, please paste the crash log to [gist](https://gist.github.com/) and link it here.
|
||||
+3
-3
@@ -2,11 +2,10 @@
|
||||
/*
|
||||
|
||||
# folders
|
||||
!/.github
|
||||
!/forestry_techne
|
||||
!/gradle/wrapper
|
||||
!/src
|
||||
!/api
|
||||
!/test
|
||||
|
||||
# files
|
||||
!/.gitignore
|
||||
@@ -21,4 +20,5 @@
|
||||
!/build.xml
|
||||
!/gradlew
|
||||
!/gradlew.bat
|
||||
.DS_Store
|
||||
!/cla-signatures.txt
|
||||
!/formatting-settings.jar
|
||||
@@ -1,4 +1,4 @@
|
||||
Forestry
|
||||
[Forestry](https://minecraft.curseforge.com/projects/forestry/files)
|
||||
====================================
|
||||
|
||||
### What is it?
|
||||
@@ -9,7 +9,7 @@ Forestry is a modification for the game Minecraft and known primarily for its fa
|
||||
|
||||
[Wiki](http://forestry.sengir.net/)
|
||||
|
||||
[Latest Builds for 1.10 / 1.10.2](http://jenkins.ic2.player.to/job/Forestry_5/)
|
||||
[Latest Builds for 1.11 / 1.11.2](http://jenkins.ic2.player.to/job/Forestry_1.11/)
|
||||
|
||||
[IRC #forestry on esper.net](http://webchat.esper.net/?nick=ForestryGithub...&channels=forestry&prompt=1)
|
||||
|
||||
@@ -17,7 +17,7 @@ For those interested in developement, you can also visit #forestry-dev.
|
||||
|
||||
### Building
|
||||
|
||||
The API and localization files reside in their own repository. It is pulled in automatically.
|
||||
The localization files reside in their own repository. It is pulled in automatically.
|
||||
|
||||
You may want to adjust the "./gradle.properties" file to set your mc account as needed.
|
||||
|
||||
|
||||
Executable → Regular
+15
-23
@@ -4,16 +4,18 @@ buildscript {
|
||||
maven { url = "http://files.minecraftforge.net/maven" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||
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.7"
|
||||
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32"
|
||||
id "com.matthewprenger.cursegradle" version "1.0.9"
|
||||
}
|
||||
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')) {
|
||||
@@ -26,8 +28,8 @@ ext.dirDest = './build/dist'
|
||||
ext.dirLang = "./lang"
|
||||
|
||||
// java version
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
minecraft {
|
||||
version = mcversion + "-" + forgeversion
|
||||
@@ -60,10 +62,10 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "net.darkhax.tesla:Tesla:${tesla_version}"
|
||||
deobfCompile "mezz.jei:jei_${mcversion}:${jei_version}:api"
|
||||
runtime "mezz.jei:jei_${mcversion}:${jei_version}"
|
||||
// deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
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"
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -149,27 +151,17 @@ task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||
untaggedName = "Current release ${project.version}"
|
||||
fromCommit = "5a3850c2642e535656d090d1473054d5fa8d3331"
|
||||
toRef = "HEAD"
|
||||
templateContent = """
|
||||
Alpha version, still buggy. Do not create a world you care about with this version, it can and will break things severely.<br/>
|
||||
Please help the project by trying it out and <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'
|
||||
addGameVersion '1.12'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
Regular → Executable
+11
-8
@@ -1,11 +1,14 @@
|
||||
mcversion=1.11.2
|
||||
forgeversion=13.20.0.2201
|
||||
mcp_mappings=snapshot_20161220
|
||||
mcversion=1.12.1
|
||||
forgeversion=14.22.0.2469
|
||||
mcp_mappings=snapshot_20170904
|
||||
curse_project_id=59751
|
||||
|
||||
tesla_version=1.11-1.3.0.51
|
||||
jei_version=4.2.0.211
|
||||
#ic2_version=2.6.76-ex110
|
||||
tesla_version=1.0.60
|
||||
tesla_mcversion=1.12
|
||||
jei_version=4.7.8.92
|
||||
jei_mcversion=1.12.1
|
||||
ic2_version=2.8.24-ex112
|
||||
|
||||
version_major=5
|
||||
version_minor=3
|
||||
version_patch=0
|
||||
version_minor=5
|
||||
version_patch=3
|
||||
Vendored
BIN
Binary file not shown.
+6
-6
@@ -1,6 +1,6 @@
|
||||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
|
||||
#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-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: d39f07201c...192d6f8584.
Regular → Executable
+35
-27
@@ -10,10 +10,28 @@
|
||||
******************************************************************************/
|
||||
package forestry;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.plugins.compat.PluginNatura;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
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;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
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.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.EventHandlerCore;
|
||||
import forestry.core.climate.ClimateEventHandler;
|
||||
@@ -26,22 +44,9 @@ 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 net.minecraftforge.common.MinecraftForge;
|
||||
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;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
|
||||
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.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
|
||||
/**
|
||||
* Forestry Minecraft Mod
|
||||
@@ -50,13 +55,14 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
*/
|
||||
@Mod(
|
||||
modid = Constants.MOD_ID,
|
||||
name = "Forestry",
|
||||
name = Constants.MOD_NAME,
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.11]",
|
||||
dependencies = "required-after:forge@[13.19.1.2189,);"
|
||||
+ "after:JEI@[4.1.1,);")
|
||||
// + "after:" + PluginIC2.modId + ";")
|
||||
acceptedMinecraftVersions = "[1.12, 1.12.1]",
|
||||
dependencies = "required-after:forge@[14.21.1.2395,);"
|
||||
+ "after:jei@[4.7.8.91,);"
|
||||
+ "after:" + PluginIC2.modId + ";"
|
||||
+ "after:" + PluginNatura.modId + ";")
|
||||
public class Forestry {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@@ -71,6 +77,7 @@ public class Forestry {
|
||||
ForestryAPI.errorStateRegistry = new ErrorStateRegistry();
|
||||
EnumErrorCode.init();
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -90,9 +97,10 @@ public class Forestry {
|
||||
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new ClimateEventHandler());
|
||||
Proxies.common.registerEventHandlers();
|
||||
|
||||
configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID);
|
||||
Config.load();
|
||||
Config.load(event.getSide());
|
||||
|
||||
PluginManager.runSetup(event);
|
||||
|
||||
@@ -100,8 +108,13 @@ public class Forestry {
|
||||
Preconditions.checkState(gameMode != null);
|
||||
ForestryAPI.activeMode = new GameMode(gameMode);
|
||||
|
||||
PluginManager.runPreInit();
|
||||
PluginManager.runPreInit(event.getSide());
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerModels(ModelRegistryEvent event) {
|
||||
PluginManager.runRegisterBackpacksAndCrates();
|
||||
Proxies.render.registerModels();
|
||||
}
|
||||
|
||||
@@ -144,9 +157,4 @@ public class Forestry {
|
||||
public void processIMCMessages(IMCEvent event) {
|
||||
PluginManager.processIMCMessages(event.getMessages());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMissingMappings(FMLMissingMappingsEvent event) {
|
||||
MigrationHelper.onMissingMappings(event);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IAlleleBeeEffect extends IAlleleEffect {
|
||||
|
||||
@@ -28,6 +30,7 @@ public interface IAlleleBeeEffect extends IAlleleEffect {
|
||||
* @param housing {@link IBeeHousing} the bee currently resides in.
|
||||
* @return storedData, may have been manipulated.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
|
||||
|
||||
}
|
||||
@@ -16,6 +16,8 @@ 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.
|
||||
@@ -54,6 +56,7 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
IEffectData[] doEffect(IEffectData[] storedData, IBeeHousing housing);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IEffectData[] doFX(IEffectData[] storedData, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,14 +5,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Stores beekeeping logic for bee housings.
|
||||
@@ -62,12 +66,14 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
|
||||
* Whether bee fx should be active.
|
||||
* Internally, this is automatically synced to the client.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
boolean canDoBeeFX();
|
||||
|
||||
/**
|
||||
* Display bee fx. Calls IBee.doFX(IEffectData[] storedData, IBeeHousing housing) on the queen.
|
||||
* Internally, the queen is automatically synced to the client for the fx.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void doBeeFX();
|
||||
|
||||
/**
|
||||
@@ -75,4 +81,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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -8,7 +8,6 @@ package forestry.api.arboriculture;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumFruitFamily implements IFruitFamily {
|
||||
PRUNES("prunes", "Prunus domestica"),
|
||||
|
||||
@@ -41,8 +41,17 @@ public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAll
|
||||
* @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.
|
||||
*/
|
||||
float getRarity();
|
||||
|
||||
IWoodProvider getWoodProvider();
|
||||
|
||||
ILeafProvider getLeafProvider();
|
||||
|
||||
IGrowthProvider getGrowthProvider();
|
||||
|
||||
/* MODELS AND OVERRIDES */
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -23,5 +23,15 @@ public interface IAlleleTreeSpeciesBuilder extends IAlleleSpeciesBuilder {
|
||||
* Set the minecraft plant type for this tree. Default is Plains.
|
||||
*/
|
||||
IAlleleTreeSpeciesBuilder setPlantType(EnumPlantType type);
|
||||
|
||||
/**
|
||||
* Set rarity of the species, will affect spawn rate in the world. Must be a float between 0 and 1. If it's 0, it will not spawn.
|
||||
*/
|
||||
IAlleleTreeSpeciesBuilder setRarity(float rarity);
|
||||
|
||||
/**
|
||||
* Set the growth provider.
|
||||
*/
|
||||
IAlleleTreeSpeciesBuilder setGrowthProvider(IGrowthProvider growthProvider);
|
||||
|
||||
}
|
||||
+10
-13
@@ -3,21 +3,18 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public interface ITerrainRecipe {
|
||||
|
||||
boolean matches(IBlockState blockState);
|
||||
|
||||
IBlockState getResult();
|
||||
|
||||
IClimateInfo getMinClimate();
|
||||
|
||||
IClimateInfo getMaxClimate();
|
||||
|
||||
float getChance();
|
||||
public interface ICharcoalPileWall {
|
||||
|
||||
int getCharcoalAmount();
|
||||
|
||||
boolean matches(IBlockState state);
|
||||
|
||||
NonNullList<ItemStack> getDisplyItems();
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public interface IGermlingModelProvider {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumGermlingType type);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ModelResourceLocation getModel(EnumGermlingType type);
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* 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.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IGrowthProvider {
|
||||
|
||||
boolean canSpawn(ITree tree, World world, BlockPos pos);
|
||||
|
||||
boolean isBiomeValid(ITree tree, Biome biome);
|
||||
|
||||
}
|
||||
+9
-3
@@ -5,6 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
public enum EnumGrowthConditions {
|
||||
HOSTILE, PALTRY, NORMAL, GOOD, EXCELLENT
|
||||
}
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ILeafProvider {
|
||||
|
||||
void init(IAlleleTreeSpecies treeSpecies);
|
||||
|
||||
ItemStack getDecorativeLeaves();
|
||||
|
||||
}
|
||||
@@ -19,6 +19,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface ITree extends IIndividual, ITreeGenData {
|
||||
|
||||
@@ -26,6 +28,7 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
|
||||
IEffectData[] doEffect(IEffectData[] storedData, World world, BlockPos pos);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IEffectData[] doFX(IEffectData[] storedData, World world, BlockPos pos);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,27 @@ public interface ITreeFactory {
|
||||
*/
|
||||
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()
|
||||
* 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, ILeafProvider leafProvider);
|
||||
|
||||
/**
|
||||
* Get one of the built-in Forestry leaf types. Default type is deciduous.
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ITreeGenome extends IGenome {
|
||||
|
||||
@@ -37,4 +38,15 @@ public interface ITreeGenome extends IGenome {
|
||||
int getGirth();
|
||||
|
||||
IAlleleLeafEffect getEffect();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return A ItemStack that is used in getPickBlock of the leave block.
|
||||
*/
|
||||
ItemStack getDecorativeLeaves();
|
||||
|
||||
/**
|
||||
* @return true if this genome matches one of the default template genomes
|
||||
*/
|
||||
boolean matchesTemplateGenome();
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
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;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -101,4 +102,6 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
List<ITreeMutation> getMutations(boolean shuffle);
|
||||
|
||||
Collection<IFruitProvider> getFruitProvidersForFruitFamily(IFruitFamily fruitFamily);
|
||||
}
|
||||
@@ -27,4 +27,5 @@ public interface IWoodAccess {
|
||||
|
||||
List<IWoodType> getRegisteredWoodTypes();
|
||||
|
||||
void register(IWoodType woodType, WoodBlockKind woodBlockKind, boolean fireproof, IBlockState blockState, ItemStack itemStack);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public interface IWoodProvider {
|
||||
* @return A stack of wood from the tree to craft wood pile's or other things.
|
||||
*/
|
||||
ItemStack getWoodStack();
|
||||
|
||||
|
||||
/**
|
||||
* The amount of charcoal dropped from a charcoal pile of this wood.
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TreeManager {
|
||||
|
||||
/**
|
||||
@@ -26,4 +29,6 @@ public class TreeManager {
|
||||
* Used to create new tree mutations.
|
||||
*/
|
||||
public static ITreeMutationFactory treeMutationFactory;
|
||||
|
||||
public static List<ICharcoalPileWall> pileWalls = new ArrayList<>();
|
||||
}
|
||||
Regular → Executable
+8
-14
@@ -1,29 +1,23 @@
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelProcessingHelper;
|
||||
|
||||
public enum WoodBlockKind {
|
||||
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR(false);
|
||||
|
||||
public final boolean retextureItem;
|
||||
|
||||
WoodBlockKind() {
|
||||
this(true);
|
||||
}
|
||||
|
||||
WoodBlockKind(boolean retextureItem) {
|
||||
this.retextureItem = retextureItem;
|
||||
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR;
|
||||
|
||||
public String getName(){
|
||||
return super.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase(Locale.ENGLISH);
|
||||
return getName();
|
||||
}
|
||||
|
||||
public IModel retextureModel(IModel model, IWoodType type, ImmutableMap<String, String> customTextures) {
|
||||
@@ -63,6 +57,6 @@ public enum WoodBlockKind {
|
||||
break;
|
||||
}
|
||||
textures.putAll(customTextures);
|
||||
return ModelProcessingHelper.retexture(model, new ImmutableMap.Builder<String, String>().putAll(textures).build());
|
||||
return model.retexture(ImmutableMap.copyOf(textures));
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,17 @@ package forestry.api.circuits;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface ICircuitBoard extends INbtWritable {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
int getPrimaryColor();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
int getSecondaryColor();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void addTooltip(List<String> list);
|
||||
|
||||
void onInsertion(Object tile);
|
||||
|
||||
@@ -8,6 +8,8 @@ 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.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -42,14 +44,16 @@ public class ForestryAPI {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static ITextureManager textureManager;
|
||||
|
||||
/**
|
||||
* A {@link IModelManager} needed for some things in the API.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IModelManager modelManager;
|
||||
|
||||
public static IClimateManager climateManager;
|
||||
|
||||
/**
|
||||
* A registry for register fertilizers, {@link IFarmabeles}s and {@link ISimpleFarmLogic}s
|
||||
*/
|
||||
public static IFarmRegistry farmRegistry;
|
||||
|
||||
/**
|
||||
* The currently active {@link IGameMode}.
|
||||
*/
|
||||
|
||||
+5
-4
@@ -3,10 +3,11 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
package forestry.api.core;
|
||||
|
||||
public enum EnumGreenhouseEventType {
|
||||
|
||||
CAMOUFLAGE
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockPosPredicate {
|
||||
boolean test(World world, BlockPos blockPos);
|
||||
}
|
||||
Regular → Executable
+3
-2
@@ -8,14 +8,15 @@ package forestry.api.core;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IModelBakerModel extends IPerspectiveAwareModel {
|
||||
public interface IModelBakerModel extends IBakedModel {
|
||||
|
||||
void setGui3d(boolean gui3d);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -18,7 +19,7 @@ public interface ITextureManager {
|
||||
|
||||
/**
|
||||
* Location of the Forestry Gui Texture Map.
|
||||
* Used for binding with {@link net.minecraft.client.renderer.texture.TextureManager#bindTexture(ResourceLocation)}
|
||||
* Used for binding with {@link TextureManager#bindTexture(ResourceLocation)}
|
||||
*/
|
||||
ResourceLocation getGuiTextureMap();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Farmables {
|
||||
@@ -17,9 +18,15 @@ public class Farmables {
|
||||
* Can be used to add IFarmables to some of the vanilla farm logics.
|
||||
* <p>
|
||||
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
|
||||
* @deprecated Please use {@link IFarmRegistry#registerFarmables(String, IFarmable...)} and {@link IFarmRegistry#getFarmables(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Multimap<String, IFarmable> farmables = HashMultimap.create();
|
||||
|
||||
/**
|
||||
* @deprecated Please use {@link IFarmRegistry#registerFertilizer(ItemStack, int)} and {@link IFarmRegistry#getFertilizeValue(ItemStack)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Map<ItemStack, Integer> fertilizers = new LinkedHashMap<>();
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ package forestry.api.farming;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -33,6 +34,8 @@ public interface IFarmLogic {
|
||||
|
||||
IFarmLogic setManual(boolean manual);
|
||||
|
||||
void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ResourceLocation getTextureMap();
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFarmRegistry {
|
||||
|
||||
/**
|
||||
* Registers farming logic in registry under given identifier
|
||||
* @param identifier Valid identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
|
||||
* @param logic corresponding instance of logic
|
||||
*/
|
||||
void registerFarmLogic(String identifier, IFarmLogic logic);
|
||||
|
||||
/**
|
||||
* Can be used to add IFarmables to some of the vanilla farm logics.
|
||||
* <p>
|
||||
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
|
||||
*/
|
||||
void registerFarmables(String identifier, IFarmable... farmable);
|
||||
|
||||
Collection<IFarmable> getFarmables(String identifier);
|
||||
|
||||
/**
|
||||
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
|
||||
*/
|
||||
IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param itemStack
|
||||
* @param value The value of the fertitlizer.The value of the forestry fertelizer is 500.
|
||||
*/
|
||||
void registerFertilizer(ItemStack itemStack, int value);
|
||||
|
||||
/**
|
||||
* @return The value of the fertitlizer
|
||||
*/
|
||||
int getFertilizeValue(ItemStack itemStack);
|
||||
|
||||
}
|
||||
@@ -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.farming;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* A simple version of the IFarmLogic.
|
||||
*/
|
||||
public interface ISimpleFarmLogic {
|
||||
|
||||
/**
|
||||
* @return the itemStack that represents this farm logic. Used as an icon for the farm logic.
|
||||
*/
|
||||
ItemStack getIconItemStack();
|
||||
|
||||
Iterable<IFarmable> getSeeds();
|
||||
|
||||
String getName();
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "2.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
|
||||
@API(apiVersion = "2.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.food;
|
||||
|
||||
public class BeverageManager {
|
||||
public static final IBeverageEffect[] effectList = new IBeverageEffect[128];
|
||||
|
||||
public static IInfuserManager infuserManager;
|
||||
public static IIngredientManager ingredientManager;
|
||||
}
|
||||
@@ -5,12 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
/**
|
||||
* Holds a static reference to the {@link IAlleleRegistry}.
|
||||
*/
|
||||
@@ -20,16 +14,6 @@ public class AlleleManager {
|
||||
*/
|
||||
public static IAlleleRegistry alleleRegistry;
|
||||
|
||||
/**
|
||||
* Translates plain leaf blocks into genetic data. Used by bees and butterflies to convert and pollinate foreign leaf blocks.
|
||||
*/
|
||||
public static final Map<Block, ILeafTranslator> leafTranslators = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
|
||||
*/
|
||||
public static final Map<Item, ISaplingTranslator> saplingTranslation = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Queryable instance of an {@link IClimateHelper} for easier implementation.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Called after Forestry has registered all his alleles of an specific type. Like IAlleleFruit or IAlleleSpecies
|
||||
* @since 5.3.3
|
||||
*/
|
||||
public class AlleleRegisterEvent<A extends IAllele> extends Event {
|
||||
|
||||
private final Class<? extends A> alleleClass;
|
||||
|
||||
public AlleleRegisterEvent(Class<? extends A> alleleClass) {
|
||||
this.alleleClass = alleleClass;
|
||||
}
|
||||
|
||||
public Class<? extends A> getAlleleClass() {
|
||||
return alleleClass;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Called after Forestry has registered all his species alleles of a individual.
|
||||
*/
|
||||
public class AlleleSpeciesRegisterEvent extends Event {
|
||||
public class AlleleSpeciesRegisterEvent<A extends IAlleleSpecies> extends AlleleRegisterEvent<A> {
|
||||
|
||||
private final ISpeciesRoot root;
|
||||
|
||||
public AlleleSpeciesRegisterEvent(ISpeciesRoot root) {
|
||||
public AlleleSpeciesRegisterEvent(ISpeciesRoot root, Class<? extends A> alleleClass) {
|
||||
super(alleleClass);
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,20 @@ public interface IAllele {
|
||||
|
||||
/**
|
||||
* @return Localized short, human-readable identifier used in tooltips and beealyzer.
|
||||
* @deprecated since Forestry 5.3.4. Use {@link #getAlleleName()}.
|
||||
*/
|
||||
@Deprecated
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return Localized short, human-readable identifier used in tooltips and beealyzer.
|
||||
* @since Forestry 5.3.4
|
||||
* @apiNote This can't be named "getName" or it can conflict during obfuscation. https://github.com/md-5/SpecialSource/issues/12
|
||||
*/
|
||||
default String getAlleleName() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The unlocalized identifier
|
||||
*/
|
||||
|
||||
@@ -109,6 +109,13 @@ public interface IAlleleRegistry {
|
||||
*/
|
||||
void registerAllele(IAllele allele, IChromosomeType... chromosomeTypes);
|
||||
|
||||
/**
|
||||
* Add more valid chromosome types for an allele.
|
||||
* Used by addons that create new chromosome types beyond bees, trees, and butterflies.
|
||||
* @since Forestry 5.3.1
|
||||
*/
|
||||
void addValidAlleleTypes(IAllele allele, IChromosomeType... chromosomeTypes);
|
||||
|
||||
/**
|
||||
* @return HashMap of all registered deprecated alleles and their corresponding replacements
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
/**
|
||||
* Translates blockStates into genetic data.
|
||||
* Used by bees and butterflies to convert and pollinate foreign leaf blocks.
|
||||
*/
|
||||
public interface IBlockTranslator<I extends IIndividual> extends IIndividualTranslator<I, IBlockState> {
|
||||
@Nullable
|
||||
@Override
|
||||
I getIndividualFromObject(IBlockState blockState);
|
||||
}
|
||||
@@ -5,10 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.IBlockPosPredicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -60,17 +62,38 @@ public interface IFlowerRegistry {
|
||||
*/
|
||||
boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Gets an iterator over the area a bee can travel from its beeHousing.
|
||||
* Starts at the bee housing and spirals outward.
|
||||
*
|
||||
* @param beeHousing The bee housing that will help determine the size of the area to check.
|
||||
* @param bee The bee that will help determine the size of the area to check.
|
||||
* @return an iterator over the area a bee can travel from its beeHousing.
|
||||
* @since Forestry 5.5.2
|
||||
*/
|
||||
Iterator<BlockPos.MutableBlockPos> getAreaIterator(IBeeHousing beeHousing, IBee bee);
|
||||
|
||||
/**
|
||||
* Checks a single coordinate to see if it is an accepted flower.
|
||||
* @since Forestry 5.5.2
|
||||
*/
|
||||
IBlockPosPredicate createAcceptedFlowerPredicate(String flowerType);
|
||||
|
||||
/**
|
||||
* @param beeHousing The bee housing that will help determine the size of the area to check.
|
||||
* @param bee The bee that will help determine the size of the area to check.
|
||||
* @param flowerType See {@link forestry.api.apiculture.FlowerManager}.FlowerTypeXXX
|
||||
* @param maxFlowers the largest number of flowers to check for before returning. Use 1 if you only need 1.
|
||||
* @return the coordinates of nearby accepted flowers, with size from 0 to maxFlowers.
|
||||
* @deprecated since Forestry 5.5.2. Use {@link #getAreaIterator(IBeeHousing, IBee)} and {@link #createAcceptedFlowerPredicate(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
List<BlockPos> getAcceptedFlowerCoordinates(IBeeHousing beeHousing, IBee bee, String flowerType, int maxFlowers);
|
||||
|
||||
/**
|
||||
* Checks a single coordinate to see if it is an accepted flower.
|
||||
* @deprecated since Forestry 5.5.2. Use {@link #createAcceptedFlowerPredicate(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isAcceptedFlower(String flowerType, World world, BlockPos pos);
|
||||
}
|
||||
+5
-3
@@ -3,9 +3,11 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
public interface IGreenhouseClimaLogic extends IGreenhouseLogic {
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface IIndividualTranslator<I extends IIndividual, O> {
|
||||
@Nullable
|
||||
I getIndividualFromObject(O objectToTranslator);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
/**
|
||||
* Translates items into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
|
||||
*/
|
||||
public interface IItemTranslator<I extends IIndividual> extends IIndividualTranslator<I, ItemStack> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
I getIndividualFromObject(ItemStack itemStack);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
/**
|
||||
* Translates blockStates for a single plain leaf block into genetic data.
|
||||
* Used by bees and butterflies to convert and pollinate foreign leaf blocks.
|
||||
* Kept in a map with Block keys: {@link AlleleManager#leafTranslators}
|
||||
*/
|
||||
public interface ILeafTranslator {
|
||||
@Nullable
|
||||
ITree getTreeFromLeaf(IBlockState leafBlockState);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ISaplingTranslator {
|
||||
@Nullable
|
||||
ITree getTreeFromSapling(ItemStack sapling);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
@@ -65,6 +66,11 @@ public interface ISpeciesRoot {
|
||||
IIndividual getMember(ItemStack stack);
|
||||
|
||||
IIndividual getMember(NBTTagCompound compound);
|
||||
|
||||
<O extends Object, I extends IIndividual> void registerTranslator(Object translatorKey, IIndividualTranslator<I, O> translator);
|
||||
|
||||
@Nullable
|
||||
<O extends Object, I extends IIndividual> IIndividualTranslator<I, O> getTranslator(Object translatorKey);
|
||||
|
||||
@Nullable
|
||||
ISpeciesType getType(ItemStack itemStack);
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class DefaultGreenhouseLogic implements IGreenhouseLogic {
|
||||
|
||||
public final IGreenhouseController controller;
|
||||
private final String name;
|
||||
|
||||
public DefaultGreenhouseLogic(IGreenhouseController controller, String name) {
|
||||
this.controller = controller;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void work() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(EnumGreenhouseEventType type, Object event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGreenhouseController getController() {
|
||||
return controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMachineAssembled() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMachineDisassembled() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,10 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
@@ -20,24 +16,6 @@ public class GreenhouseEvents extends Event {
|
||||
this.controller = state;
|
||||
}
|
||||
|
||||
public static class CamouflageChangeEvent extends GreenhouseEvents {
|
||||
|
||||
@Nullable
|
||||
public final ICamouflagedTile camouflagedBlock;
|
||||
|
||||
public final ICamouflageHandler camouflageHandler;
|
||||
|
||||
public final String camouflageType;
|
||||
|
||||
public CamouflageChangeEvent(IGreenhouseController controller, @Nullable ICamouflagedTile camouflagedBlock, ICamouflageHandler camouflageHandler, String camouflageType) {
|
||||
super(controller);
|
||||
|
||||
this.camouflagedBlock = camouflagedBlock;
|
||||
this.camouflageHandler = camouflageHandler;
|
||||
this.camouflageType = camouflageType;
|
||||
}
|
||||
}
|
||||
|
||||
public static class InternalBlockEvent extends GreenhouseEvents {
|
||||
public final IInternalBlock internalBlock;
|
||||
|
||||
|
||||
@@ -6,12 +6,7 @@
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -23,14 +18,4 @@ public interface IGreenhouseHelper {
|
||||
@Nullable
|
||||
IGreenhouseController getGreenhouseController(World world, BlockPos pos);
|
||||
|
||||
void registerGreenhouseLogic(Class<? extends IGreenhouseLogic> logic);
|
||||
|
||||
List<Class<? extends IGreenhouseLogic>> getGreenhouseLogics();
|
||||
|
||||
void registerTerrainRecipe(Block inputBlock, IBlockState outputState, IClimateInfo minClimate, IClimateInfo maxClimate, float chance);
|
||||
|
||||
void registerTerrainRecipe(IBlockState inputState, IBlockState outputState, IClimateInfo minClimate, IClimateInfo maxClimate, float chance);
|
||||
|
||||
ITerrainRecipe getValidTerrainRecipe(IBlockState blockState, IClimateInfo climateInfo);
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
|
||||
public interface IGreenhouseLogic extends INbtWritable, INbtReadable {
|
||||
|
||||
void work();
|
||||
|
||||
void onEvent(EnumGreenhouseEventType type, Object event);
|
||||
|
||||
void onMachineAssembled();
|
||||
|
||||
void onMachineDisassembled();
|
||||
|
||||
IGreenhouseController getController();
|
||||
|
||||
String getName();
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
|
||||
public interface IOvergrowth {
|
||||
|
||||
IClimateInfo getMinClimate();
|
||||
|
||||
IClimateInfo getMaxClimate();
|
||||
|
||||
float getChance();
|
||||
|
||||
}
|
||||
@@ -23,5 +23,8 @@ public interface IAlleleButterflyCocoon extends IAlleleProperty<IAlleleButterfly
|
||||
String getCocoonName();
|
||||
|
||||
Map<ItemStack, Float> getCocoonLoot();
|
||||
|
||||
void clearLoot();
|
||||
|
||||
void addLoot(ItemStack loot, float chance);
|
||||
}
|
||||
@@ -5,8 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
@@ -48,6 +51,27 @@ public interface IButterfly extends IIndividualLiving {
|
||||
*/
|
||||
@Nullable
|
||||
IButterfly spawnCaterpillar(World world, IButterflyNursery nursery);
|
||||
|
||||
/**
|
||||
* Determines whether the caterpillar can grow.
|
||||
*
|
||||
* @param cocoon the {@link IButterflyCocoon} the caterpillar resides in.
|
||||
* @param nursery the {@link IButterflyNursery} of the caterpillar.
|
||||
* @return an empty set if the caterpillar can grow, a set of error states if the caterpillar can not grow
|
||||
* @since 5.3.3
|
||||
*/
|
||||
Set<IErrorState> getCanGrow(IButterflyNursery nursery, @Nullable IButterflyCocoon cocoon);
|
||||
|
||||
/**
|
||||
* Determines whether the caterpillar can spawn. (Used to auto-spawn butterflies out of a cocoon.)
|
||||
*
|
||||
* @param cocoon the {@link IButterflyCocoon} the caterpillar resides in.
|
||||
* @param nursery the {@link IButterflyNursery} of the caterpillar.
|
||||
* @return an empty set if the caterpillar can spawn, a set of error states if the caterpillar can not spawn
|
||||
* @since 5.3.3
|
||||
*/
|
||||
Set<IErrorState> getCanSpawn(IButterflyNursery nursery, @Nullable IButterflyCocoon cocoon);
|
||||
|
||||
|
||||
/**
|
||||
* @param playerKill Whether or not the butterfly was killed by a player.
|
||||
|
||||
@@ -10,21 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.genetics.IHousing;
|
||||
|
||||
public interface IButterflyCocoon extends IHousing {
|
||||
|
||||
|
||||
IButterfly getCaterpillar();
|
||||
|
||||
void setCaterpillar(IButterfly butterfly);
|
||||
|
||||
@Nullable
|
||||
IButterflyNursery getNursery();
|
||||
|
||||
void setNursery(IButterflyNursery nursery);
|
||||
|
||||
boolean isSolid();
|
||||
|
||||
}
|
||||
@@ -10,15 +10,19 @@ import javax.annotation.Nullable;
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IButterflyNursery extends IHousing, IClimateProvider {
|
||||
@Nullable
|
||||
IButterfly getCaterpillar();
|
||||
|
||||
@Nullable
|
||||
IIndividual getNanny();
|
||||
|
||||
void setCaterpillar(@Nullable IButterfly caterpillar);
|
||||
|
||||
boolean canNurse(IButterfly caterpillar);
|
||||
|
||||
World getWorldObj();
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IButterflyRoot extends ISpeciesRoot {
|
||||
@@ -52,7 +53,7 @@ public interface IButterflyRoot extends ISpeciesRoot {
|
||||
*/
|
||||
EntityLiving spawnButterflyInWorld(World world, IButterfly butterfly, double x, double y, double z);
|
||||
|
||||
boolean plantCocoon(World world, IButterflyNursery nursery, GameProfile owner, int age);
|
||||
BlockPos plantCocoon(World world, BlockPos pos, IButterfly caterpillar, GameProfile owner, int age, boolean createNursery);
|
||||
|
||||
/**
|
||||
* @return true if passed item is mated.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "1.3.0", owner = "ForestryAPI|core", provides = "ForestryAPI|lepidopterology")
|
||||
@API(apiVersion = "1.4.0", owner = "ForestryAPI|core", provides = "ForestryAPI|lepidopterology")
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.arboriculture.EnumPileType;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Needs to be implemented by TileEntities that want to be part of an charcoal pile.
|
||||
* The sub-interfaces can be implemented to alter the operation of the charcoal pile.
|
||||
* They are automatically detected and handled by the charcoal pile when they join its structure.
|
||||
*/
|
||||
public interface ICharcoalPileComponent<T extends IMultiblockLogicCharcoalPile> extends IMultiblockComponent {
|
||||
|
||||
@Override
|
||||
T getMultiblockLogic();
|
||||
|
||||
IAlleleTreeSpecies getTreeSpecies();
|
||||
|
||||
void setTreeSpecies(IAlleleTreeSpecies treeSpecies);
|
||||
|
||||
@Override
|
||||
GameProfile getOwner();
|
||||
|
||||
void setOwner(GameProfile owner);
|
||||
|
||||
EnumPileType getPileType();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IAlleleTreeSpecies getNextWoodPile();
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package forestry.api.multiblock;
|
||||
|
||||
public interface ICharcoalPileController extends IMultiblockController {
|
||||
|
||||
boolean isActive();
|
||||
|
||||
void setActive(boolean active);
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import forestry.api.climate.IClimateSourceProvider;
|
||||
import forestry.api.climate.IClimatiserDefinition;
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
import forestry.api.lepidopterology.IButterflyNursery;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
@@ -32,8 +33,8 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
|
||||
IClimatiserDefinition getDefinition();
|
||||
}
|
||||
|
||||
interface ButterflyHatch extends IGreenhouseComponent {
|
||||
NonNullList<ItemStack> addCocoonLoot(IButterflyCocoon cocoon);
|
||||
interface Nursery extends IGreenhouseComponent, IButterflyNursery {
|
||||
void addCocoonLoot(IButterflyCocoon cocoon, NonNullList<ItemStack> loot);
|
||||
}
|
||||
|
||||
interface Active extends IGreenhouseComponent {
|
||||
|
||||
@@ -5,34 +5,35 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.climate.IClimateControlProvider;
|
||||
import forestry.api.climate.IClimateRegion;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.greenhouse.EnumGreenhouseEventType;
|
||||
import forestry.api.greenhouse.IGreenhouseHousing;
|
||||
import forestry.api.greenhouse.IGreenhouseLogic;
|
||||
import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlProvider {
|
||||
|
||||
/**
|
||||
* Handle change events.
|
||||
*/
|
||||
void onChange(EnumGreenhouseEventType type, Object event);
|
||||
|
||||
/**
|
||||
* @return The logics of the greenhouse.
|
||||
*/
|
||||
List<IGreenhouseLogic> getLogics();
|
||||
|
||||
/**
|
||||
* @return All internal blocks of the greenhouse.
|
||||
*/
|
||||
Set<IInternalBlock> getInternalBlocks();
|
||||
|
||||
/**
|
||||
* spawns a butterfly in a greenhouse
|
||||
* @return true if it has spawned it, and false if it has not
|
||||
*/
|
||||
boolean spawnButterfly(IGreenhouseComponent.Nursery nursery);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #spawnButterfly(IButterflyCocoon)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean spawnButterfly(IButterfly butterfly);
|
||||
|
||||
IClimateRegion getRegion();
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
public interface IMultiblockLogicCharcoalPile extends IMultiblockLogic {
|
||||
|
||||
/**
|
||||
* @return the multiblock controller for this logic
|
||||
*/
|
||||
@Override
|
||||
ICharcoalPileController getController();
|
||||
|
||||
}
|
||||
@@ -15,6 +15,4 @@ public interface IMultiblockLogicFactory {
|
||||
IMultiblockLogicFarm createFarmLogic();
|
||||
|
||||
IMultiblockLogicGreenhouse createGreenhouseLogic();
|
||||
|
||||
IMultiblockLogicCharcoalPile createCharcoalPileLogic();
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Base logic class for Multiblock-connected tile entities.
|
||||
@@ -86,6 +88,7 @@ public abstract class MultiblockTileEntityBase<T extends IMultiblockLogic> exten
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final void onDataPacket(NetworkManager network, SPacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(network, packet);
|
||||
NBTTagCompound nbtData = packet.getNbtCompound();
|
||||
|
||||
Regular → Executable
+8
-2
@@ -6,6 +6,7 @@
|
||||
package forestry.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,12 @@ public interface IDescriptiveRecipe {
|
||||
* @return array of all the ingredients in the crafting table.
|
||||
* Each inner list represents one slot's accepted ItemStacks
|
||||
*/
|
||||
NonNullList<NonNullList<ItemStack>> getIngredients();
|
||||
NonNullList<NonNullList<ItemStack>> getRawIngredients();
|
||||
|
||||
NonNullList<String> getOreDicts();
|
||||
|
||||
ItemStack getRecipeOutput();
|
||||
/**
|
||||
* Must not be named the same as {@link IRecipe#getRecipeOutput()} to avoid obfuscation for recipes that implement both.
|
||||
*/
|
||||
ItemStack getOutput();
|
||||
}
|
||||
@@ -21,6 +21,8 @@ public interface IFabricatorRecipe extends IForestryRecipe {
|
||||
* Each inner list represents one slot's accepted ItemStacks
|
||||
*/
|
||||
NonNullList<NonNullList<ItemStack>> getIngredients();
|
||||
|
||||
NonNullList<String> getOreDicts();
|
||||
|
||||
/**
|
||||
* @return the width of ingredients in the crafting grid to create this recipe.
|
||||
|
||||
Regular → Executable
+4
-2
@@ -8,12 +8,14 @@ package forestry.api.storage;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
/**
|
||||
* The Backpack Interface allows you to add items to Forestry backpacks or create your own backpacks.
|
||||
|
||||
@@ -38,20 +38,22 @@ import forestry.apiculture.network.packets.PacketBeeLogicActive;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActiveEntity;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
private static final int totalBreedingTime = Constants.APIARY_BREEDING_TIME;
|
||||
|
||||
@@ -133,7 +135,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(PacketBufferForestry data) {
|
||||
public void writeData(PacketBuffer data) {
|
||||
data.writeBoolean(active);
|
||||
if (active) {
|
||||
data.writeItemStack(queenStack);
|
||||
@@ -142,7 +144,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(PacketBufferForestry data) throws IOException {
|
||||
public void readData(PacketBuffer data) throws IOException {
|
||||
boolean active = data.readBoolean();
|
||||
setActive(active);
|
||||
if (active) {
|
||||
@@ -219,7 +221,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
errorLogic.setCondition(true, errorState);
|
||||
}
|
||||
|
||||
boolean hasFlowers = hasFlowersCache.hasFlowers(queen, housing);
|
||||
hasFlowersCache.update(queen, housing);
|
||||
boolean hasFlowers = hasFlowersCache.hasFlowers();
|
||||
boolean flowerCacheNeedsSync = hasFlowersCache.needsSync();
|
||||
errorLogic.setCondition(!hasFlowers, EnumErrorCode.NO_FLOWER);
|
||||
|
||||
@@ -457,9 +460,9 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
if (world != null && !world.isRemote) {
|
||||
if (housing instanceof Entity) {
|
||||
Entity housingEntity = (Entity) this.housing;
|
||||
Proxies.net.sendNetworkPacket(new PacketBeeLogicActiveEntity(this.housing, housingEntity), housingEntity.getPosition(), world);
|
||||
NetworkUtil.sendNetworkPacket(new PacketBeeLogicActiveEntity(this.housing, housingEntity), housingEntity.getPosition(), world);
|
||||
} else {
|
||||
Proxies.net.sendNetworkPacket(new PacketBeeLogicActive(housing), housing.getCoordinates(), world);
|
||||
NetworkUtil.sendNetworkPacket(new PacketBeeLogicActive(housing), housing.getCoordinates(), world);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -469,9 +472,9 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
World world = housing.getWorldObj();
|
||||
if (world != null && !world.isRemote) {
|
||||
if (housing instanceof TileEntity) {
|
||||
Proxies.net.sendToPlayer(new PacketBeeLogicActive(housing), player);
|
||||
NetworkUtil.sendToPlayer(new PacketBeeLogicActive(housing), player);
|
||||
} else if (housing instanceof Entity) {
|
||||
Proxies.net.sendToPlayer(new PacketBeeLogicActiveEntity(housing, (Entity) housing), player);
|
||||
NetworkUtil.sendToPlayer(new PacketBeeLogicActiveEntity(housing, (Entity) housing), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -486,11 +489,13 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean canDoBeeFX() {
|
||||
return !Proxies.common.getClientInstance().isGamePaused() && active;
|
||||
return !Minecraft.getMinecraft().isGamePaused() && active;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void doBeeFX() {
|
||||
if (queen != null) {
|
||||
queen.doFX(effectData, housing);
|
||||
@@ -498,7 +503,6 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<BlockPos> getFlowerPositions() {
|
||||
return hasFlowersCache.getFlowerCoords();
|
||||
}
|
||||
|
||||
@@ -10,80 +10,92 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.core.IBlockPosPredicate;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.utils.VectUtil;
|
||||
import forestry.core.utils.TickHelper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable {
|
||||
private static final String nbtKey = "hasFlowerCache";
|
||||
private static final String nbtKeyFlowers = "flowers";
|
||||
private static final String nbtKeyCooldown = "cooldown";
|
||||
public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
private static final String NBT_KEY = "hasFlowerCache";
|
||||
private static final String NBT_KEY_FLOWERS = "flowers";
|
||||
private static final int FLOWER_CHECK_INTERVAL = 200;
|
||||
|
||||
private static final Random random = new Random();
|
||||
private static final int flowerCheckInterval = 128;
|
||||
private final TickHelper tickHelper = new TickHelper();
|
||||
|
||||
private final int flowerCheckTime = random.nextInt(flowerCheckInterval);
|
||||
private List<BlockPos> flowerCoords = new ArrayList<>();
|
||||
private int cooldown = 0;
|
||||
@Nullable
|
||||
private FlowerData flowerData;
|
||||
private final List<BlockPos> flowerCoords = new ArrayList<>();
|
||||
|
||||
private boolean needsSync = false;
|
||||
|
||||
public boolean hasFlowers(IBee queen, IBeeHousing beeHousing) {
|
||||
IFlowerProvider flowerProvider = queen.getGenome().getFlowerProvider();
|
||||
String flowerType = flowerProvider.getFlowerType();
|
||||
private static class FlowerData {
|
||||
public final String flowerType;
|
||||
public final IBlockPosPredicate flowerPredicate;
|
||||
public Iterator<BlockPos.MutableBlockPos> areaIterator;
|
||||
|
||||
public FlowerData(IBee queen, IBeeHousing beeHousing) {
|
||||
IFlowerProvider flowerProvider = queen.getGenome().getFlowerProvider();
|
||||
this.flowerType = flowerProvider.getFlowerType();
|
||||
this.flowerPredicate = FlowerManager.flowerRegistry.createAcceptedFlowerPredicate(flowerType);
|
||||
this.areaIterator = FlowerManager.flowerRegistry.getAreaIterator(beeHousing, queen);
|
||||
}
|
||||
|
||||
public void resetIterator(IBee queen, IBeeHousing beeHousing) {
|
||||
this.areaIterator = FlowerManager.flowerRegistry.getAreaIterator(beeHousing, queen);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(IBee queen, IBeeHousing beeHousing) {
|
||||
if (flowerData == null) {
|
||||
this.flowerData = new FlowerData(queen, beeHousing);
|
||||
this.flowerCoords.clear();
|
||||
}
|
||||
World world = beeHousing.getWorldObj();
|
||||
tickHelper.onTick();
|
||||
|
||||
if (!flowerCoords.isEmpty()) {
|
||||
if (world.getTotalWorldTime() % flowerCheckInterval != flowerCheckTime) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
BlockPos housingCoords = beeHousing.getCoordinates();
|
||||
|
||||
Vec3i genomeTerritory = queen.getGenome().getTerritory();
|
||||
float housingModifier = beeModifier.getTerritoryModifier(queen.getGenome(), 1f);
|
||||
Vec3i area = VectUtil.scale(genomeTerritory, housingModifier * 3.0f);
|
||||
BlockPos min = VectUtil.scale(area, -0.5f).add(housingCoords);
|
||||
BlockPos max = VectUtil.scale(area, 0.5f).add(housingCoords);
|
||||
|
||||
for (BlockPos flowerPos : flowerCoords) {
|
||||
if (!isFlowerValid(world, flowerPos, flowerType, min, max)) {
|
||||
cooldown = 0;
|
||||
break;
|
||||
if (!flowerCoords.isEmpty() && tickHelper.updateOnInterval(FLOWER_CHECK_INTERVAL)) {
|
||||
Iterator<BlockPos> iterator = flowerCoords.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BlockPos flowerPos = iterator.next();
|
||||
if (!flowerData.flowerPredicate.test(world, flowerPos) && world.isBlockLoaded(flowerPos)) {
|
||||
iterator.remove();
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cooldown <= 0) {
|
||||
List<BlockPos> newFlowerCoords = FlowerManager.flowerRegistry.getAcceptedFlowerCoordinates(beeHousing, queen, flowerType, 5);
|
||||
cooldown = PluginApiculture.ticksPerBeeWorkCycle;
|
||||
if (!flowerCoords.equals(newFlowerCoords)) {
|
||||
flowerCoords = newFlowerCoords;
|
||||
needsSync = true;
|
||||
}
|
||||
} else {
|
||||
cooldown--;
|
||||
}
|
||||
final int flowerCount = flowerCoords.size();
|
||||
final int ticksPerCheck = 1 + (flowerCount * flowerCount);
|
||||
|
||||
if (tickHelper.updateOnInterval(ticksPerCheck)) {
|
||||
if (flowerData.areaIterator.hasNext()) {
|
||||
BlockPos.MutableBlockPos blockPos = flowerData.areaIterator.next();
|
||||
if (flowerData.flowerPredicate.test(world, blockPos)) {
|
||||
flowerCoords.add(blockPos.toImmutable());
|
||||
needsSync = true;
|
||||
}
|
||||
} else {
|
||||
flowerData.resetIterator(queen, beeHousing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasFlowers() {
|
||||
return !flowerCoords.isEmpty();
|
||||
}
|
||||
|
||||
@@ -95,35 +107,23 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
|
||||
|
||||
public void clear() {
|
||||
flowerCoords.clear();
|
||||
cooldown = 0;
|
||||
flowerData = null;
|
||||
}
|
||||
|
||||
|
||||
public List<BlockPos> getFlowerCoords() {
|
||||
return Collections.unmodifiableList(flowerCoords);
|
||||
}
|
||||
|
||||
private static boolean isFlowerValid(World world, BlockPos flowerCoords, String flowerType, BlockPos min, BlockPos max) {
|
||||
if (!isFlowerCoordInRange(flowerCoords, min, max)) {
|
||||
return false;
|
||||
}
|
||||
return FlowerManager.flowerRegistry.isAcceptedFlower(flowerType, world, flowerCoords);
|
||||
}
|
||||
|
||||
private static boolean isFlowerCoordInRange(BlockPos flowerCoords, BlockPos min, BlockPos max) {
|
||||
return flowerCoords.getX() >= min.getX() && flowerCoords.getX() <= max.getX() && flowerCoords.getY() >= min.getY() && flowerCoords.getY() <= max.getY() && flowerCoords.getZ() >= min.getZ() && flowerCoords.getZ() <= max.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
if (!nbttagcompound.hasKey(nbtKey)) {
|
||||
if (!nbttagcompound.hasKey(NBT_KEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound hasFlowerCacheNBT = nbttagcompound.getCompoundTag(nbtKey);
|
||||
NBTTagCompound hasFlowerCacheNBT = nbttagcompound.getCompoundTag(NBT_KEY);
|
||||
|
||||
if (hasFlowerCacheNBT.hasKey(nbtKeyFlowers)) {
|
||||
int[] flowersList = hasFlowerCacheNBT.getIntArray(nbtKeyFlowers);
|
||||
if (hasFlowerCacheNBT.hasKey(NBT_KEY_FLOWERS)) {
|
||||
int[] flowersList = hasFlowerCacheNBT.getIntArray(NBT_KEY_FLOWERS);
|
||||
if (flowersList.length % 3 == 0) {
|
||||
int flowerCount = flowersList.length / 3;
|
||||
for (int i = 0; i < flowerCount; i++) {
|
||||
@@ -133,8 +133,6 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
|
||||
cooldown = hasFlowerCacheNBT.getInteger(nbtKeyCooldown);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,17 +149,14 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
|
||||
i++;
|
||||
}
|
||||
|
||||
hasFlowerCacheNBT.setIntArray(nbtKeyFlowers, flowersList);
|
||||
hasFlowerCacheNBT.setIntArray(NBT_KEY_FLOWERS, flowersList);
|
||||
}
|
||||
|
||||
hasFlowerCacheNBT.setInteger(nbtKeyCooldown, cooldown);
|
||||
|
||||
nbttagcompound.setTag(nbtKey, hasFlowerCacheNBT);
|
||||
nbttagcompound.setTag(NBT_KEY, hasFlowerCacheNBT);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(PacketBufferForestry data) {
|
||||
public void writeData(PacketBuffer data) {
|
||||
int size = flowerCoords.size();
|
||||
data.writeVarInt(size);
|
||||
if (size > 0) {
|
||||
@@ -173,8 +168,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(PacketBufferForestry data) throws IOException {
|
||||
public void readData(PacketBuffer data) throws IOException {
|
||||
flowerCoords.clear();
|
||||
|
||||
int size = data.readVarInt();
|
||||
|
||||
Regular → Executable
+122
-74
@@ -10,6 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -18,8 +21,42 @@ import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.PotionTypes;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -38,6 +75,7 @@ import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.apiculture.blocks.BlockHoneyComb;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.capabilities.ArmorApiarist;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
@@ -65,8 +103,6 @@ import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.apiculture.multiblock.TileAlvearyStabiliser;
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.apiculture.network.PacketRegistryApiculture;
|
||||
import forestry.apiculture.proxy.ProxyApiculture;
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.apiculture.worldgen.HiveDecorator;
|
||||
@@ -97,51 +133,24 @@ import forestry.food.items.ItemRegistryFood;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
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.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.APICULTURE, name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description")
|
||||
public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@SidedProxy(clientSide = "forestry.apiculture.proxy.ProxyApicultureClient", serverSide = "forestry.apiculture.proxy.ProxyApiculture")
|
||||
public static ProxyApiculture proxy;
|
||||
private static final String CONFIG_CATEGORY = "apiculture";
|
||||
public static String beekeepingMode = "NORMAL";
|
||||
private static float secondPrincessChance = 0;
|
||||
public static final int ticksPerBeeWorkCycle = 550;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nullable
|
||||
private static TextureAtlasSprite beeSprite;
|
||||
@Nullable
|
||||
private static ItemRegistryApiculture items;
|
||||
@Nullable
|
||||
private static BlockRegistryApiculture blocks;
|
||||
@Nullable
|
||||
private static HiveRegistry hiveRegistry;
|
||||
|
||||
public static String beekeepingMode = "NORMAL";
|
||||
public static final int ticksPerBeeWorkCycle = 550;
|
||||
@Nullable
|
||||
public static VillagerRegistry.VillagerProfession villagerApiarist;
|
||||
|
||||
@@ -160,6 +169,12 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
return hiveRegistry;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite getBeeSprite() {
|
||||
Preconditions.checkState(beeSprite != null, "Bee sprite has not been registered");
|
||||
return beeSprite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAPI() {
|
||||
super.setupAPI();
|
||||
@@ -298,7 +313,8 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
villagerRegistry.registerVillageCreationHandler(villageHandler);
|
||||
|
||||
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER, Constants.TEXTURE_SKIN_ZOMBIE_BEEKPEEPER);
|
||||
villagerRegistry.register(villagerApiarist);
|
||||
IForgeRegistry<VillagerRegistry.VillagerProfession> villagerProfessions = ForgeRegistries.VILLAGER_PROFESSIONS;
|
||||
villagerProfessions.register(villagerApiarist);
|
||||
|
||||
ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
|
||||
ItemStack wildcardDrone = new ItemStack(items.beeDroneGE, 1);
|
||||
@@ -423,115 +439,126 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
// / APIARIST'S ARMOR
|
||||
|
||||
ItemStack wovenSilk = coreItems.craftingMaterial.getWovenSilk();
|
||||
RecipeUtil.addRecipe(items.apiaristHat,
|
||||
RecipeUtil.addRecipe("apiarist_hat", items.apiaristHat,
|
||||
"###", "# #",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristChest,
|
||||
RecipeUtil.addRecipe("apiarist_chest", items.apiaristChest,
|
||||
"# #", "###", "###",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristLegs,
|
||||
RecipeUtil.addRecipe("apiarist_legs", items.apiaristLegs,
|
||||
"###", "# #", "# #",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristBoots,
|
||||
RecipeUtil.addRecipe("apiarist_boots", items.apiaristBoots,
|
||||
"# #", "# #",
|
||||
'#', wovenSilk);
|
||||
|
||||
// / HABITAT LOCATOR
|
||||
RecipeUtil.addRecipe(items.habitatLocator,
|
||||
RecipeUtil.addRecipe("habitat_locator", items.habitatLocator,
|
||||
" X ",
|
||||
"X#X",
|
||||
" X ",
|
||||
'#', OreDictUtil.DUST_REDSTONE, 'X', OreDictUtil.INGOT_BRONZE);
|
||||
|
||||
// Bees
|
||||
RecipeUtil.addRecipe(items.scoop,
|
||||
RecipeUtil.addRecipe("scoop", items.scoop,
|
||||
"#X#", "###", " # ",
|
||||
'#', OreDictUtil.STICK_WOOD,
|
||||
'X', Blocks.WOOL);
|
||||
RecipeUtil.addRecipe(items.smoker,
|
||||
RecipeUtil.addRecipe("smoker", items.smoker,
|
||||
"LS#",
|
||||
"LF#",
|
||||
"###",
|
||||
'#', "ingotTin", 'S', OreDictUtil.STICK_WOOD, 'F', Items.FLINT_AND_STEEL, 'L', OreDictUtil.LEATHER);
|
||||
RecipeUtil.addRecipe(new ItemStack(Items.SLIME_BALL),
|
||||
RecipeUtil.addRecipe("propolis_to_slime", new ItemStack(Items.SLIME_BALL),
|
||||
"#X#", "#X#", "#X#",
|
||||
'#', items.propolis,
|
||||
'X', items.pollenCluster.get(EnumPollenCluster.NORMAL, 1));
|
||||
RecipeUtil.addRecipe(new ItemStack(Items.SPECKLED_MELON),
|
||||
RecipeUtil.addRecipe("honey_melon", new ItemStack(Items.SPECKLED_MELON),
|
||||
"#X#", "#Y#", "#X#",
|
||||
'#', items.honeyDrop,
|
||||
'X', items.honeydew,
|
||||
'Y', Items.MELON);
|
||||
RecipeUtil.addRecipe(items.frameUntreated,
|
||||
RecipeUtil.addRecipe("frame_untreated", items.frameUntreated,
|
||||
"###", "#S#", "###",
|
||||
'#', OreDictUtil.STICK_WOOD,
|
||||
'S', Items.STRING);
|
||||
RecipeUtil.addRecipe(items.frameImpregnated,
|
||||
RecipeUtil.addRecipe("frame_impregnated", items.frameImpregnated,
|
||||
"###", "#S#", "###",
|
||||
'#', coreItems.stickImpregnated,
|
||||
'S', Items.STRING);
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getBeeHouseMinecart(),
|
||||
RecipeUtil.addRecipe("bee_house_minecart", items.minecartBeehouse.getBeeHouseMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', new ItemStack(blocks.beeHouse),
|
||||
'C', Items.MINECART);
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getApiaryMinecart(),
|
||||
RecipeUtil.addRecipe("apiary_minecart", items.minecartBeehouse.getApiaryMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', new ItemStack(blocks.apiary),
|
||||
'C', Items.MINECART);
|
||||
for(int blockCount = 0;blockCount < blocks.beeCombs.length;blockCount++){
|
||||
BlockHoneyComb block = blocks.beeCombs[blockCount];
|
||||
for(int blockMeta = 0;blockMeta < EnumHoneyComb.VALUES.length - blockCount * 16;blockMeta++){
|
||||
int itemMeta = blockMeta + blockCount * 16;
|
||||
RecipeUtil.addRecipe("comb." + itemMeta, new ItemStack(block, 1, blockMeta),
|
||||
"###",
|
||||
"###",
|
||||
"###", '#', items.beeComb.get(EnumHoneyComb.get(itemMeta), 1));
|
||||
}
|
||||
}
|
||||
|
||||
// FOOD STUFF
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FOOD)) {
|
||||
ItemRegistryFood foodItems = PluginFood.getItems();
|
||||
RecipeUtil.addRecipe(new ItemStack(foodItems.honeyedSlice, 4),
|
||||
RecipeUtil.addRecipe("honeyed_slice", new ItemStack(foodItems.honeyedSlice, 4),
|
||||
"###", "#X#", "###",
|
||||
'#', items.honeyDrop,
|
||||
'X', Items.BREAD);
|
||||
|
||||
RecipeUtil.addRecipe(foodItems.honeyPot,
|
||||
RecipeUtil.addRecipe("honey_pot", foodItems.honeyPot,
|
||||
"# #", " X ", "# #",
|
||||
'#', items.honeyDrop,
|
||||
'X', fluidItems.waxCapsuleEmpty);
|
||||
|
||||
RecipeUtil.addRecipe(foodItems.ambrosia,
|
||||
RecipeUtil.addRecipe("ambrosia", foodItems.ambrosia,
|
||||
"#Y#", "XXX", "###",
|
||||
'#', items.honeydew,
|
||||
'X', items.royalJelly,
|
||||
'Y', fluidItems.waxCapsuleEmpty);
|
||||
|
||||
}
|
||||
|
||||
// / CAPSULES
|
||||
int outputCapsuleAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule");
|
||||
if (outputCapsuleAmount > 0) {
|
||||
ItemStack capsule = fluidItems.waxCapsuleEmpty.getItemStack(outputCapsuleAmount);
|
||||
RecipeUtil.addRecipe(capsule, "###", '#', coreItems.beeswax);
|
||||
RecipeUtil.addRecipe("wax_capsule", capsule, "###", '#', coreItems.beeswax);
|
||||
}
|
||||
|
||||
int outputRefractoryAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.refractory");
|
||||
if (outputRefractoryAmount > 0) {
|
||||
ItemStack capsule = fluidItems.refractoryEmpty.getItemStack(outputRefractoryAmount);
|
||||
RecipeUtil.addRecipe(capsule, "###", '#', coreItems.refractoryWax);
|
||||
RecipeUtil.addRecipe("refractory_capsule", capsule, "###", '#', coreItems.refractoryWax);
|
||||
}
|
||||
|
||||
// / BITUMINOUS PEAT
|
||||
RecipeUtil.addRecipe(coreItems.bituminousPeat.getItemStack(),
|
||||
RecipeUtil.addRecipe("bituminous_peat", coreItems.bituminousPeat.getItemStack(),
|
||||
" # ", "XYX", " # ",
|
||||
'#', OreDictUtil.DUST_ASH,
|
||||
'X', coreItems.peat,
|
||||
'Y', items.propolis);
|
||||
|
||||
// / TORCHES
|
||||
RecipeUtil.addRecipe(new ItemStack(Blocks.TORCH, 3),
|
||||
RecipeUtil.addRecipe("beeswax_worth", new ItemStack(Blocks.TORCH, 3),
|
||||
" # ", " # ", " Y ",
|
||||
'#', coreItems.beeswax,
|
||||
'Y', OreDictUtil.STICK_WOOD);
|
||||
RecipeUtil.addRecipe(coreItems.craftingMaterial.getPulsatingMesh(),
|
||||
RecipeUtil.addRecipe("pulsating_mesh", coreItems.craftingMaterial.getPulsatingMesh(),
|
||||
"# #", " # ", "# #",
|
||||
'#', items.propolis.get(EnumPropolis.PULSATING, 1));
|
||||
|
||||
// / WAX CAST
|
||||
RecipeUtil.addRecipe(items.waxCast,
|
||||
RecipeUtil.addRecipe("wax_cast", items.waxCast,
|
||||
"###",
|
||||
"# #",
|
||||
"###",
|
||||
@@ -539,14 +566,14 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
// / ALVEARY
|
||||
ItemStack alvearyPlainBlock = blocks.getAlvearyBlock(BlockAlvearyType.PLAIN);
|
||||
RecipeUtil.addRecipe(alvearyPlainBlock,
|
||||
RecipeUtil.addRecipe("alveary_plain", alvearyPlainBlock,
|
||||
"###",
|
||||
"#X#",
|
||||
"###",
|
||||
'X', coreItems.impregnatedCasing,
|
||||
'#', coreItems.craftingMaterial.getScentedPaneling());
|
||||
// SWARMER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.SWARMER),
|
||||
RecipeUtil.addRecipe("alveary_swarmer", blocks.getAlvearyBlock(BlockAlvearyType.SWARMER),
|
||||
"#G#",
|
||||
" X ",
|
||||
"#G#",
|
||||
@@ -554,7 +581,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'G', OreDictUtil.INGOT_GOLD);
|
||||
// FAN
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.FAN),
|
||||
RecipeUtil.addRecipe("alveary_fan", blocks.getAlvearyBlock(BlockAlvearyType.FAN),
|
||||
"I I",
|
||||
" X ",
|
||||
"I#I",
|
||||
@@ -562,7 +589,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'I', OreDictUtil.INGOT_IRON);
|
||||
// HEATER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.HEATER),
|
||||
RecipeUtil.addRecipe("alveary_heater", blocks.getAlvearyBlock(BlockAlvearyType.HEATER),
|
||||
"#I#",
|
||||
" X ",
|
||||
"YYY",
|
||||
@@ -570,7 +597,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'I', OreDictUtil.INGOT_IRON, 'Y', OreDictUtil.STONE);
|
||||
// HYGROREGULATOR
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.HYGRO),
|
||||
RecipeUtil.addRecipe("alveary_hygro", blocks.getAlvearyBlock(BlockAlvearyType.HYGRO),
|
||||
"GIG",
|
||||
"GXG",
|
||||
"GIG",
|
||||
@@ -578,14 +605,14 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'I', OreDictUtil.INGOT_IRON,
|
||||
'G', OreDictUtil.BLOCK_GLASS);
|
||||
// STABILISER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.STABILISER),
|
||||
RecipeUtil.addRecipe("alveary_stabiliser", blocks.getAlvearyBlock(BlockAlvearyType.STABILISER),
|
||||
"G G",
|
||||
"GXG",
|
||||
"G G",
|
||||
'X', alvearyPlainBlock,
|
||||
'G', OreDictUtil.GEM_QUARTZ);
|
||||
// SIEVE
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.SIEVE),
|
||||
RecipeUtil.addRecipe("alveary_sieve", blocks.getAlvearyBlock(BlockAlvearyType.SIEVE),
|
||||
"III",
|
||||
" X ",
|
||||
"WWW",
|
||||
@@ -633,8 +660,8 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
"#X#",
|
||||
'#', coreItems.beeswax,
|
||||
'X', coreItems.craftingMaterial.getSilkWisp());
|
||||
RecipeUtil.addShapelessRecipe(blocks.candle.getUnlitCandle(1), blocks.candle.getUnlitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe(blocks.candle.getLitCandle(1), blocks.candle.getLitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe("candle_unlit_reset", blocks.candle.getUnlitCandle(1), blocks.candle.getUnlitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe("candle_lit_reset", blocks.candle.getLitCandle(1), blocks.candle.getLitCandle(1));
|
||||
|
||||
// / CENTRIFUGE
|
||||
// Honey combs
|
||||
@@ -734,7 +761,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
RecipeManagers.fermenterManager.addRecipe(items.honeydew.getItemStack(), 500, 1.0f, Fluids.SHORT_MEAD.getFluid(1), Fluids.FOR_HONEY.getFluid(1));
|
||||
}
|
||||
|
||||
RecipeUtil.addRecipe(blocks.apiary,
|
||||
RecipeUtil.addRecipe("apiary", blocks.apiary,
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
@@ -742,7 +769,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'#', OreDictUtil.PLANK_WOOD,
|
||||
'C', coreItems.impregnatedCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.beeChest,
|
||||
RecipeUtil.addRecipe("bee_chest", blocks.beeChest,
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
@@ -750,13 +777,24 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', OreDictUtil.BEE_COMB,
|
||||
'Y', OreDictUtil.CHEST_WOOD);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.beeHouse,
|
||||
RecipeUtil.addRecipe("bee_house", blocks.beeHouse,
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
'X', OreDictUtil.SLAB_WOOD,
|
||||
'#', OreDictUtil.PLANK_WOOD,
|
||||
'C', OreDictUtil.BEE_COMB);
|
||||
|
||||
// BREWING RECIPES
|
||||
BrewingRecipeRegistry.addRecipe(
|
||||
PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.AWKWARD),
|
||||
items.pollenCluster.get(EnumPollenCluster.NORMAL, 1),
|
||||
PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.HEALING));
|
||||
BrewingRecipeRegistry.addRecipe(
|
||||
PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.AWKWARD),
|
||||
items.pollenCluster.get(EnumPollenCluster.CRYSTALLINE, 1),
|
||||
PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.REGENERATION));
|
||||
|
||||
}
|
||||
|
||||
private static void registerBeehiveDrops() {
|
||||
@@ -864,8 +902,18 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
@Override
|
||||
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
|
||||
if(!world.provider.getDimensionType().equals(DimensionType.THE_END)) return;
|
||||
if (Config.getBeehivesAmount() > 0.0) {
|
||||
HiveDecorator.decorateHives(chunkGenerator, world, rand, chunkX, chunkZ, hasVillageGenerated);
|
||||
HiveDecorator.decorateHives(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorateBiome(World world, Random rand, BlockPos pos) {
|
||||
if (Config.getBeehivesAmount() > 0.0) {
|
||||
int chunkX = pos.getX() >> 4;
|
||||
int chunkZ = pos.getZ() >> 4;
|
||||
HiveDecorator.decorateHives(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,7 +949,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
for (int i = 0; i < ParticleSnow.sprites.length; i++) {
|
||||
ParticleSnow.sprites[i] = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1)));
|
||||
}
|
||||
ProxyApicultureClient.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
|
||||
beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
|
||||
}
|
||||
|
||||
private static class EndFlowerAcceptableRule implements IFlowerAcceptableRule {
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SaveEventHandlerApiculture implements ISaveEventHandler {
|
||||
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActive;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.TickHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class WorldgenBeekeepingLogic implements IBeekeepingLogic {
|
||||
private final TileHive housing;
|
||||
private IEffectData effectData[] = new IEffectData[2];
|
||||
private final HasFlowersCache hasFlowersCache = new HasFlowersCache();
|
||||
private final TickHelper tickHelper = new TickHelper();
|
||||
|
||||
// Client
|
||||
private boolean active;
|
||||
|
||||
public WorldgenBeekeepingLogic(TileHive housing) {
|
||||
this.housing = housing;
|
||||
}
|
||||
|
||||
// / SAVING & LOADING
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
setActive(nbttagcompound.getBoolean("Active"));
|
||||
hasFlowersCache.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setBoolean("Active", active);
|
||||
hasFlowersCache.writeToNBT(nbttagcompound);
|
||||
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(PacketBuffer data) {
|
||||
data.writeBoolean(active);
|
||||
if (active) {
|
||||
hasFlowersCache.writeData(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(PacketBuffer data) throws IOException {
|
||||
boolean active = data.readBoolean();
|
||||
setActive(active);
|
||||
if (active) {
|
||||
hasFlowersCache.readData(data);
|
||||
}
|
||||
}
|
||||
|
||||
/* Activatable */
|
||||
private void setActive(boolean active) {
|
||||
if (this.active == active) {
|
||||
return;
|
||||
}
|
||||
this.active = active;
|
||||
|
||||
syncToClient();
|
||||
}
|
||||
|
||||
/* UPDATING */
|
||||
|
||||
@Override
|
||||
public boolean canWork() {
|
||||
tickHelper.onTick();
|
||||
|
||||
IBee queen = housing.getContainedBee();
|
||||
hasFlowersCache.update(queen, housing);
|
||||
|
||||
if (tickHelper.updateOnInterval(200)) {
|
||||
World world = housing.getWorldObj();
|
||||
boolean canWork = (world.isDaytime() || queen.getGenome().getNeverSleeps()) &&
|
||||
(!housing.isRaining() || queen.getGenome().getToleratesRain());
|
||||
boolean flowerCacheNeedsSync = hasFlowersCache.needsSync();
|
||||
|
||||
if (active != canWork) {
|
||||
setActive(canWork);
|
||||
} else if (flowerCacheNeedsSync) {
|
||||
syncToClient();
|
||||
}
|
||||
}
|
||||
|
||||
return active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
if (!housing.getWorldObj().isRemote) {
|
||||
hasFlowersCache.clear();
|
||||
canWork();
|
||||
}
|
||||
}
|
||||
|
||||
/* CLIENT */
|
||||
|
||||
@Override
|
||||
public void syncToClient() {
|
||||
World world = housing.getWorldObj();
|
||||
if (world != null && !world.isRemote) {
|
||||
NetworkUtil.sendNetworkPacket(new PacketBeeLogicActive(housing), housing.getCoordinates(), world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToClient(EntityPlayerMP player) {
|
||||
World world = housing.getWorldObj();
|
||||
if (world != null && !world.isRemote) {
|
||||
NetworkUtil.sendToPlayer(new PacketBeeLogicActive(housing), player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeeProgressPercent() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean canDoBeeFX() {
|
||||
return !Minecraft.getMinecraft().isGamePaused() && active;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void doBeeFX() {
|
||||
IBee queen = housing.getContainedBee();
|
||||
queen.doFX(effectData, housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockPos> getFlowerPositions() {
|
||||
return hasFlowersCache.getFlowerCoords();
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+34
-24
@@ -10,12 +10,34 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
@@ -31,26 +53,11 @@ import forestry.apiculture.multiblock.TileAlvearyStabiliser;
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.apiculture.network.packets.PacketAlvearyChange;
|
||||
import forestry.core.blocks.BlockStructure;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IActivatable;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public abstract class BlockAlveary extends BlockStructure implements IStateMapperRegister {
|
||||
private static final PropertyEnum<State> STATE = PropertyEnum.create("state", State.class);
|
||||
@@ -221,7 +228,7 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerStateMapper() {
|
||||
Proxies.render.registerStateMapper(this, new AlvearyStateMapper(getAlvearyType()));
|
||||
ModelLoader.setCustomStateMapper(this, new AlvearyStateMapper(getAlvearyType()));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -244,15 +251,18 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
if (tileEntity instanceof TileAlveary) {
|
||||
TileAlveary tileAlveary = (TileAlveary) tileEntity;
|
||||
|
||||
TileUtil.actOnTile(worldIn, pos, TileAlveary.class, tileAlveary -> {
|
||||
// We must check that the slabs on top were not removed
|
||||
IAlvearyControllerInternal alveary = tileAlveary.getMultiblockLogic().getController();
|
||||
alveary.reassemble();
|
||||
BlockPos referenceCoord = alveary.getReferenceCoord();
|
||||
Proxies.net.sendNetworkPacket(new PacketAlvearyChange(referenceCoord), referenceCoord, worldIn);
|
||||
}
|
||||
NetworkUtil.sendNetworkPacket(new PacketAlvearyChange(referenceCoord), referenceCoord, worldIn);
|
||||
});
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag advanced) {
|
||||
tooltip.add(Translator.translateToLocal("tile.for.alveary.tooltip"));
|
||||
}
|
||||
}
|
||||
Regular → Executable
+20
-30
@@ -11,24 +11,10 @@
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.apiculture.IHiveTile;
|
||||
import forestry.api.apiculture.hives.IHiveRegistry.HiveType;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.MaterialBeehive;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.core.blocks.IBlockWithMeta;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
@@ -43,9 +29,25 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.apiculture.IHiveTile;
|
||||
import forestry.api.apiculture.hives.IHiveRegistry.HiveType;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.MaterialBeehive;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.core.blocks.IBlockWithMeta;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class BlockBeeHives extends BlockContainer implements IItemModelRegister, IBlockWithMeta {
|
||||
private static final PropertyEnum<HiveType> HIVE_TYPES = PropertyEnum.create("hive", HiveType.class);
|
||||
|
||||
@@ -85,27 +87,17 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
@Override
|
||||
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
|
||||
super.onBlockClicked(world, pos, player);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof IHiveTile) {
|
||||
IHiveTile hive = (IHiveTile) tile;
|
||||
hive.onAttack(world, pos, player);
|
||||
}
|
||||
TileUtil.actOnTile(world, pos, IHiveTile.class, tile -> tile.onAttack(world, pos, player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
boolean canHarvest = canHarvestBlock(world, pos, player);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof IHiveTile) {
|
||||
IHiveTile hive = (IHiveTile) tile;
|
||||
hive.onBroken(world, pos, player, canHarvest);
|
||||
}
|
||||
TileUtil.actOnTile(world, pos, IHiveTile.class, tile -> tile.onBroken(world, pos, player, canHarvest));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
Random random = world instanceof World ? ((World) world).rand : RANDOM;
|
||||
|
||||
List<IHiveDrop> hiveDrops = getDropsForHive(getMetaFromState(state));
|
||||
@@ -149,8 +141,6 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
// / CREATIVE INVENTORY
|
||||
@@ -180,7 +170,7 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (IBlockState blockState : getBlockState().getValidStates()) {
|
||||
if (getHiveType(blockState) != HiveType.SWARM) {
|
||||
int meta = getMetaFromState(blockState);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum BlockBeeProductType implements IStringSerializable {
|
||||
BEE_COMBS,
|
||||
BEESWAX;
|
||||
|
||||
public static final BlockBeeProductType[] VALUES = values();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+26
-27
@@ -10,24 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -51,9 +43,19 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class BlockCandle extends BlockTorch implements IItemModelRegister, ITileEntityProvider, IColoredBlock {
|
||||
|
||||
@@ -140,26 +142,24 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
if (tileEntity instanceof TileCandle && ((TileCandle) tileEntity).isLit()) {
|
||||
TileCandle candle = TileUtil.getTile(world, pos, TileCandle.class);
|
||||
if (candle != null && candle.isLit()) {
|
||||
return 14;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
if (!(tileEntity instanceof TileCandle)) {
|
||||
TileCandle tileCandle = TileUtil.getTile(worldIn, pos, TileCandle.class);
|
||||
if (tileCandle == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileCandle tileCandle = (TileCandle) tileEntity;
|
||||
final boolean isLit = tileCandle.isLit();
|
||||
|
||||
boolean flag = false;
|
||||
@@ -202,9 +202,9 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
if (toggleLitState) {
|
||||
tileCandle.setLit(!isLit);
|
||||
worldIn.markBlockRangeForRenderUpdate(pos, pos);
|
||||
worldIn.theProfiler.startSection("checkLight");
|
||||
worldIn.profiler.startSection("checkLight");
|
||||
worldIn.checkLight(pos);
|
||||
worldIn.theProfiler.endSection();
|
||||
worldIn.profiler.endSection();
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
@@ -240,9 +240,9 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
drop.set(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ItemStack dropStack = drop.get();
|
||||
drop.remove();
|
||||
|
||||
@@ -251,10 +251,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
dropStack = getCandleDrop(world, pos);
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> drops = new ArrayList<>(1);
|
||||
drops.add(dropStack);
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -289,14 +286,15 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
tileCandle.setColour(colour);
|
||||
tileCandle.setLit(isLit);
|
||||
if (tileCandle.isLit()) {
|
||||
world.theProfiler.startSection("checkLight");
|
||||
world.profiler.startSection("checkLight");
|
||||
world.checkLight(pos);
|
||||
world.theProfiler.endSection();
|
||||
world.profiler.endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
TileCandle tileCandle = TileUtil.getTile(worldIn, pos, TileCandle.class);
|
||||
if (tileCandle != null && tileCandle.isLit()) {
|
||||
@@ -333,6 +331,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
return new ItemStack(this, amount, 1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (worldIn != null && pos != null) {
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.items.EnumHoneyComb;
|
||||
import forestry.core.blocks.IBlockWithMeta;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
public abstract class BlockHoneyComb extends Block implements IItemModelRegister, IBlockWithMeta, IColoredBlock, IStateMapperRegister {
|
||||
public final int minMeta;
|
||||
|
||||
public static final BlockHoneyComb[] create(){
|
||||
BlockHoneyComb[] blocks = new BlockHoneyComb[2];
|
||||
for(int i = 0;i < blocks.length;i++){
|
||||
HoneyCombPredicate filter = new HoneyCombPredicate(i, 16);
|
||||
PropertyEnum<EnumHoneyComb> variant = PropertyEnum.create("type", EnumHoneyComb.class, filter);
|
||||
blocks[i] = new BlockHoneyComb(filter.minMeta) {
|
||||
@Override
|
||||
protected PropertyEnum<EnumHoneyComb> getVariant() {
|
||||
return variant;
|
||||
}
|
||||
};
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public BlockHoneyComb(int minMeta) {
|
||||
super(Material.CLOTH);
|
||||
setHardness(1F);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(getVariant(), getVariant().getAllowedValues().iterator().next()));
|
||||
this.minMeta = minMeta;
|
||||
}
|
||||
|
||||
protected abstract PropertyEnum<EnumHoneyComb> getVariant();
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, getVariant());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(getVariant()).ordinal()-minMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(getVariant(), EnumHoneyComb.get(minMeta + meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (EnumHoneyComb honeyComb : getVariant().getAllowedValues()) {
|
||||
if(!honeyComb.isSecret() || Config.isDebug){
|
||||
list.add(get(honeyComb));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "tile.for.bee_combs";
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (EnumHoneyComb comb : getVariant().getAllowedValues()) {
|
||||
manager.registerItemModel(item, comb.ordinal()-minMeta, "block_bee_combs");
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack get(EnumHoneyComb honeyComb) {
|
||||
return new ItemStack(this, 1, honeyComb.ordinal() - minMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameFromMeta(int meta) {
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(minMeta + meta);
|
||||
return honeyComb.name;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
|
||||
int meta = getMetaFromState(state);
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(minMeta + meta);
|
||||
if (tintIndex == 1) {
|
||||
return honeyComb.primaryColor;
|
||||
} else {
|
||||
return honeyComb.secondaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerStateMapper() {
|
||||
ModelLoader.setCustomStateMapper(this, new HoneyCombStateMapper());
|
||||
}
|
||||
|
||||
private static class HoneyCombPredicate implements Predicate<EnumHoneyComb> {
|
||||
private final int minMeta;
|
||||
private final int maxMeta;
|
||||
|
||||
public HoneyCombPredicate(int blockNumber, int variantsPerBlock) {
|
||||
this.minMeta = blockNumber * variantsPerBlock;
|
||||
this.maxMeta = minMeta + variantsPerBlock - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(@Nullable EnumHoneyComb honeyComb) {
|
||||
return honeyComb != null && honeyComb.ordinal() >= minMeta && honeyComb.ordinal() <= maxMeta;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class HoneyCombStateMapper extends StateMapperBase {
|
||||
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
return new ModelResourceLocation(Constants.MOD_ID + ":bee_combs", "normal");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.util.Map;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.items.ItemBlockCandle;
|
||||
import forestry.apiculture.items.ItemBlockHoneyComb;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
@@ -27,31 +28,38 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public final BlockBeeHives beehives;
|
||||
public final BlockCandle candle;
|
||||
public final BlockStump stump;
|
||||
public final BlockHoneyComb[] beeCombs;
|
||||
private final Map<BlockAlvearyType, BlockAlveary> alvearyBlockMap;
|
||||
|
||||
public BlockRegistryApiculture() {
|
||||
apiary = new BlockApiculture(BlockTypeApiculture.APIARY);
|
||||
registerBlock(apiary, new ItemBlockForestry(apiary), "apiary");
|
||||
registerBlock(apiary, new ItemBlockForestry<>(apiary), "apiary");
|
||||
|
||||
beeHouse = new BlockApiculture(BlockTypeApiculture.BEE_HOUSE);
|
||||
registerBlock(beeHouse, new ItemBlockForestry(beeHouse), "bee_house");
|
||||
registerBlock(beeHouse, new ItemBlockForestry<>(beeHouse), "bee_house");
|
||||
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST, Material.WOOD);
|
||||
registerBlock(beeChest, new ItemBlockForestry(beeChest), "bee_chest");
|
||||
registerBlock(beeChest, new ItemBlockForestry<>(beeChest), "bee_chest");
|
||||
beeChest.setCreativeTab(Tabs.tabApiculture);
|
||||
beeChest.setHarvestLevel("axe", 0);
|
||||
|
||||
beehives = new BlockBeeHives();
|
||||
registerBlock(beehives, new ItemBlockForestry(beehives), "beehives");
|
||||
registerBlock(beehives, new ItemBlockForestry<>(beehives), "beehives");
|
||||
|
||||
candle = new BlockCandle();
|
||||
registerBlock(candle, new ItemBlockCandle(candle), "candle");
|
||||
stump = new BlockStump();
|
||||
registerBlock(stump, new ItemBlockForestry(stump), "stump");
|
||||
registerBlock(stump, new ItemBlockForestry<>(stump), "stump");
|
||||
|
||||
beeCombs = BlockHoneyComb.create();
|
||||
for(int i = 0;i < beeCombs.length;i++){
|
||||
BlockHoneyComb block = beeCombs[i];
|
||||
registerBlock(block, new ItemBlockHoneyComb(block), "bee_combs_" + i);
|
||||
}
|
||||
|
||||
alvearyBlockMap = BlockAlveary.create();
|
||||
for (BlockAlveary block : alvearyBlockMap.values()) {
|
||||
registerBlock(block, new ItemBlockForestry(block), "alveary." + block.getAlvearyType());
|
||||
registerBlock(block, new ItemBlockForestry<>(block), "alveary." + block.getAlvearyType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
+9
-7
@@ -12,12 +12,6 @@ package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -31,9 +25,17 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
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.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
|
||||
public BlockStump() {
|
||||
@@ -49,7 +51,7 @@ public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,28 +10,26 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.apiculture.tiles.TileApiaristChest;
|
||||
import forestry.core.blocks.IBlockTypeTesr;
|
||||
import forestry.core.blocks.IMachinePropertiesTesr;
|
||||
import forestry.core.blocks.MachinePropertiesTesr;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
public enum BlockTypeApicultureTesr implements IBlockTypeTesr {
|
||||
APIARIST_CHEST(TileApiaristChest.class, "api_chest", Proxies.render.getRenderChest("apiaristchest"), TileNaturalistChest.chestBoundingBox);
|
||||
APIARIST_CHEST(TileApiaristChest.class, "api_chest", "apiaristchest", TileNaturalistChest.chestBoundingBox);
|
||||
|
||||
public static final BlockTypeApicultureTesr[] VALUES = values();
|
||||
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(Class<T> teClass, String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, AxisAlignedBB boundingBox) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0", false);
|
||||
<T extends TileApiaristChest> BlockTypeApicultureTesr(Class<T> teClass, String name, String textureName, AxisAlignedBB boundingBox) {
|
||||
MachinePropertiesTesr<T> machineProperties = new MachinePropertiesTesr<>(teClass, name, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0", false);
|
||||
Proxies.render.setRenderChest(machineProperties, textureName);
|
||||
this.machineProperties = machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -94,7 +94,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
ItemStack beeStack = BeeManager.beeRoot.getMemberStack(bee, beeType);
|
||||
player.dropItem(beeStack, false, true);
|
||||
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.bee.give.given", player.getName(), bee.getGenome().getPrimary().getName(), beeType.getName());
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.bee.give.given", player.getName(), bee.getGenome().getPrimary().getAlleleName(), beeType.getName());
|
||||
}
|
||||
|
||||
private static IBeeGenome getBeeGenome(String speciesName) throws SpeciesNotFoundException, TemplateNotFoundException {
|
||||
@@ -115,7 +115,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
|
||||
if (species == null) {
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleBeeSpecies && allele.getName().equals(speciesName)) {
|
||||
if (allele instanceof IAlleleBeeSpecies && allele.getAlleleName().equals(speciesName)) {
|
||||
species = (IAlleleBeeSpecies) allele;
|
||||
break;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleBeeSpecies) {
|
||||
species.add(allele.getName());
|
||||
species.add(allele.getAlleleName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.genetics.Genome;
|
||||
import forestry.core.utils.JeiUtil;
|
||||
import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
|
||||
@JEIPlugin
|
||||
public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
public class ApicultureJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
ItemRegistryApiculture items = PluginApiculture.getItems();
|
||||
@@ -21,7 +21,7 @@ public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
|
||||
ISubtypeRegistry.ISubtypeInterpreter beeSubtypeInterpreter = itemStack -> {
|
||||
IAlleleSpecies species = Genome.getSpeciesDirectly(BeeManager.beeRoot, itemStack);
|
||||
return species == null ? null : species.getUID();
|
||||
return species == null ? ISubtypeRegistry.ISubtypeInterpreter.NONE : species.getUID();
|
||||
};
|
||||
|
||||
subtypeRegistry.registerSubtypeInterpreter(items.beeDroneGE, beeSubtypeInterpreter);
|
||||
|
||||
Regular → Executable
+5
-5
@@ -63,17 +63,17 @@ public class AIAvoidPlayers extends EntityAIBase {
|
||||
if (randomTarget == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.getDistanceSq(randomTarget.xCoord, randomTarget.yCoord, randomTarget.zCoord) < player.getDistanceSqToEntity(mob)) {
|
||||
|
||||
if (player.getDistanceSq(randomTarget.x, randomTarget.y, randomTarget.z) < player.getDistanceSqToEntity(mob)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
path = pathNavigator.getPathToXYZ(randomTarget.xCoord, randomTarget.yCoord, randomTarget.zCoord);
|
||||
|
||||
path = pathNavigator.getPathToXYZ(randomTarget.x, randomTarget.y, randomTarget.z);
|
||||
return path != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueExecuting() {
|
||||
public boolean shouldContinueExecuting() {
|
||||
return !this.pathNavigator.noPath();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,14 @@ import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
|
||||
|
||||
@@ -85,8 +90,11 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
|
||||
beeModifiers.add(beeModifier);
|
||||
|
||||
for (IHiveFrame frame : inventory.getFrames()) {
|
||||
beeModifiers.add(frame.getBeeModifier());
|
||||
for (Tuple<IHiveFrame, ItemStack> frame : inventory.getFrames()) {
|
||||
IHiveFrame hiveFrame = frame.getFirst();
|
||||
ItemStack stack = frame.getSecond();
|
||||
IBeeModifier beeModifier = hiveFrame.getBeeModifier(stack);
|
||||
beeModifiers.add(beeModifier);
|
||||
}
|
||||
|
||||
return beeModifiers;
|
||||
@@ -98,13 +106,14 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiContainer getGui(EntityPlayer player, int data) {
|
||||
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, this, true);
|
||||
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.APIARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
public Container getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerMinecartBeehouse(player.inventory, this, true);
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,10 @@ import forestry.core.owner.GameProfileDataSerializer;
|
||||
import forestry.core.owner.IOwnedTile;
|
||||
import forestry.core.owner.IOwnerHandler;
|
||||
import forestry.core.owner.OwnerHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IClimatised;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.TickHelper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
@@ -46,14 +46,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IOwnedTile, IGuiBeeHousingDelegate, IClimatised, IStreamableGui {
|
||||
private static final DataParameter<Optional<GameProfile>> OWNER = EntityDataManager.createKey(EntityMinecart.class, GameProfileDataSerializer.INSTANCE);
|
||||
private static final DataParameter<Optional<GameProfile>> OWNER = EntityDataManager.createKey(EntityMinecartBeeHousingBase.class, GameProfileDataSerializer.INSTANCE);
|
||||
|
||||
private static final Random random = new Random();
|
||||
private static final int beeFXInterval = 4;
|
||||
private static final int pollenFXInterval = 50;
|
||||
|
||||
private final int beeFXTime = random.nextInt(beeFXInterval);
|
||||
private final int pollenFXTime = random.nextInt(pollenFXInterval);
|
||||
private final TickHelper tickHelper = new TickHelper();
|
||||
|
||||
private final IBeekeepingLogic beeLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
|
||||
private final IErrorLogic errorLogic = ForestryAPI.errorStateRegistry.createErrorLogic();
|
||||
@@ -185,6 +183,7 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
tickHelper.onTick();
|
||||
if (!world.isRemote) {
|
||||
if (beeLogic.canWork()) {
|
||||
beeLogic.doWork();
|
||||
@@ -192,16 +191,16 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
|
||||
} else {
|
||||
if (needsActiveUpdate) {
|
||||
IForestryPacketServer packet = new PacketBeeLogicEntityRequest(this);
|
||||
Proxies.net.sendToServer(packet);
|
||||
NetworkUtil.sendToServer(packet);
|
||||
needsActiveUpdate = false;
|
||||
}
|
||||
|
||||
if (beeLogic.canDoBeeFX()) {
|
||||
if (world.getTotalWorldTime() % beeFXInterval == beeFXTime) {
|
||||
if (tickHelper.updateOnInterval(beeFXInterval)) {
|
||||
beeLogic.doBeeFX();
|
||||
}
|
||||
|
||||
if (world.getTotalWorldTime() % pollenFXInterval == pollenFXTime) {
|
||||
if (tickHelper.updateOnInterval(pollenFXInterval)) {
|
||||
TileBeeHousingBase.doPollenFX(world, posX - 0.5, posY - 0.1, posZ - 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,13 @@ import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
|
||||
@@ -80,13 +84,14 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiContainer getGui(EntityPlayer player, int data) {
|
||||
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, this, false);
|
||||
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.BEE_HOUSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
public Container getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerMinecartBeehouse(player.inventory, this, false);
|
||||
}
|
||||
}
|
||||
Regular → Executable
+17
-16
@@ -10,20 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
|
||||
public class ParticleBeeExplore extends Particle {
|
||||
private final Vec3d origin;
|
||||
|
||||
public ParticleBeeExplore(World world, Vec3d origin, BlockPos destination, int color) {
|
||||
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(ProxyApicultureClient.beeSprite);
|
||||
super(world, origin.x, origin.y, origin.z, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(PluginApiculture.getBeeSprite());
|
||||
this.origin = origin;
|
||||
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.015;
|
||||
@@ -54,9 +55,9 @@ public class ParticleBeeExplore extends Particle {
|
||||
this.move(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.particleAge == this.particleMaxAge / 2) {
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.25) {
|
||||
@@ -72,15 +73,15 @@ public class ParticleBeeExplore extends Particle {
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.95;
|
||||
} else {
|
||||
// get to origin
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
@@ -89,7 +90,7 @@ public class ParticleBeeExplore extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
@@ -110,10 +111,10 @@ public class ParticleBeeExplore extends Particle {
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
|
||||
Regular → Executable
+17
-16
@@ -10,21 +10,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
|
||||
public class ParticleBeeRoundTrip extends Particle {
|
||||
private final Vec3d origin;
|
||||
private final BlockPos destination;
|
||||
|
||||
public ParticleBeeRoundTrip(World world, Vec3d origin, BlockPos destination, int color) {
|
||||
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(ProxyApicultureClient.beeSprite);
|
||||
super(world, origin.x, origin.y, origin.z, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(PluginApiculture.getBeeSprite());
|
||||
this.origin = origin;
|
||||
|
||||
this.destination = destination;
|
||||
@@ -56,9 +57,9 @@ public class ParticleBeeRoundTrip extends Particle {
|
||||
this.move(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.particleAge == this.particleMaxAge / 2) {
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionX = (origin.x - this.posX) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionY = (origin.y - this.posY) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03 + 0.1 * rand.nextFloat();
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.25) {
|
||||
@@ -75,15 +76,15 @@ public class ParticleBeeRoundTrip extends Particle {
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.95;
|
||||
} else {
|
||||
// get to origin
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
@@ -92,7 +93,7 @@ public class ParticleBeeRoundTrip extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
@@ -113,10 +114,10 @@ public class ParticleBeeRoundTrip extends Particle {
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
|
||||
Regular → Executable
+17
-16
@@ -10,20 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
|
||||
public class ParticleBeeTargetEntity extends Particle {
|
||||
private final Vec3d origin;
|
||||
private final Entity entity;
|
||||
|
||||
public ParticleBeeTargetEntity(World world, Vec3d origin, Entity entity, int color) {
|
||||
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(ProxyApicultureClient.beeSprite);
|
||||
super(world, origin.x, origin.y, origin.z, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(PluginApiculture.getBeeSprite());
|
||||
|
||||
this.origin = origin;
|
||||
this.entity = entity;
|
||||
@@ -56,9 +57,9 @@ public class ParticleBeeTargetEntity extends Particle {
|
||||
this.move(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.particleAge == this.particleMaxAge / 2) {
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.5) {
|
||||
@@ -72,15 +73,15 @@ public class ParticleBeeTargetEntity extends Particle {
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.95;
|
||||
} else {
|
||||
// get to origin
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
@@ -89,7 +90,7 @@ public class ParticleBeeTargetEntity extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
@@ -110,10 +111,10 @@ public class ParticleBeeTargetEntity extends Particle {
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
|
||||
Regular → Executable
+3
-1
@@ -10,7 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public final class Flower {
|
||||
@@ -57,7 +59,7 @@ public final class Flower {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("blockState", blockState).add("weight", weight).toString();
|
||||
return MoreObjects.toStringHelper(this).add("blockState", blockState).add("weight", weight).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.apiculture.flowers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@@ -27,11 +28,13 @@ import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.core.IBlockPosPredicate;
|
||||
import forestry.api.genetics.IFlowerAcceptableRule;
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.utils.BlockStateSet;
|
||||
import forestry.core.utils.VectUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -43,7 +46,7 @@ import net.minecraft.world.World;
|
||||
public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelper {
|
||||
private final HashMultimap<String, IFlowerAcceptableRule> registeredRules;
|
||||
private final HashMultimap<String, Block> acceptableBlocks;
|
||||
private final HashMultimap<String, IBlockState> acceptableBlockStates;
|
||||
private final Map<String, BlockStateSet> acceptableBlockStates;
|
||||
private final HashMultimap<String, Flower> plantableFlowers;
|
||||
|
||||
private final ArrayListMultimap<String, IFlowerGrowthRule> growthRules;
|
||||
@@ -52,7 +55,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
public FlowerRegistry() {
|
||||
this.registeredRules = HashMultimap.create();
|
||||
this.acceptableBlocks = HashMultimap.create();
|
||||
this.acceptableBlockStates = HashMultimap.create();
|
||||
this.acceptableBlockStates = new HashMap<>();
|
||||
this.plantableFlowers = HashMultimap.create();
|
||||
this.growthRules = ArrayListMultimap.create();
|
||||
this.chances = new HashMap<>();
|
||||
@@ -78,7 +81,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
throw new NullPointerException("Tried to register flower with null type. " + blockState);
|
||||
}
|
||||
|
||||
this.acceptableBlockStates.get(flowerType).add(blockState);
|
||||
this.getAcceptedBlockStates(flowerType).add(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +116,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
Set<Flower> flowers = this.plantableFlowers.get(flowerType);
|
||||
flowers.add(newFlower);
|
||||
|
||||
Set<IBlockState> blocks = this.acceptableBlockStates.get(flowerType);
|
||||
Set<IBlockState> blocks = this.getAcceptedBlockStates(flowerType);
|
||||
blocks.add(blockState);
|
||||
|
||||
if (this.chances.containsKey(flowerType)) {
|
||||
@@ -129,43 +132,16 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<BlockPos> getAcceptedFlowerCoordinates(IBeeHousing beeHousing, IBee bee, String flowerType, int maxFlowers) {
|
||||
Set<IFlowerAcceptableRule> acceptableRules = this.registeredRules.get(flowerType);
|
||||
Set<IBlockState> acceptedBlockStates = this.acceptableBlockStates.get(flowerType);
|
||||
Set<Block> acceptedBlocks = this.acceptableBlocks.get(flowerType);
|
||||
World world = beeHousing.getWorldObj();
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
|
||||
Vec3i area = getArea(bee.getGenome(), beeModifier);
|
||||
BlockPos minPos = beeHousing.getCoordinates().add(-area.getX() / 2, -area.getY() / 2, -area.getZ() / 2);
|
||||
BlockPos maxPos = minPos.add(area);
|
||||
|
||||
List<BlockPos> flowerCoords = new ArrayList<>();
|
||||
for (BlockPos.MutableBlockPos posBlock : VectUtil.getAllInBoxFromCenterMutable(world, minPos, beeHousing.getCoordinates(), maxPos)) {
|
||||
if (!world.isBlockLoaded(posBlock)) {
|
||||
continue;
|
||||
}
|
||||
IBlockState blockState = world.getBlockState(posBlock);
|
||||
if (blockState.getBlock().isAir(blockState, world, posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (IFlowerAcceptableRule acceptableRule : acceptableRules) {
|
||||
if (acceptableRule.isAcceptableFlower(blockState, world, posBlock, flowerType)) {
|
||||
flowerCoords.add(posBlock.toImmutable());
|
||||
if (flowerCoords.size() >= maxFlowers) {
|
||||
return flowerCoords;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isAcceptedFlower(blockState, acceptedBlocks, acceptedBlockStates)) {
|
||||
flowerCoords.add(posBlock.toImmutable());
|
||||
if (flowerCoords.size() >= maxFlowers) {
|
||||
return flowerCoords;
|
||||
}
|
||||
World world = beeHousing.getWorldObj();
|
||||
IBlockPosPredicate acceptedFlowerPredicate = createAcceptedFlowerPredicate(flowerType);
|
||||
Iterator<BlockPos.MutableBlockPos> areaIterator = getAreaIterator(beeHousing, bee);
|
||||
while (areaIterator.hasNext() && flowerCoords.size() < maxFlowers) {
|
||||
BlockPos.MutableBlockPos pos = areaIterator.next();
|
||||
if (acceptedFlowerPredicate.test(world, pos)) {
|
||||
flowerCoords.add(pos.toImmutable());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +149,17 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<BlockPos.MutableBlockPos> getAreaIterator(IBeeHousing beeHousing, IBee bee) {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
Vec3i area = getArea(bee.getGenome(), beeModifier);
|
||||
BlockPos minPos = beeHousing.getCoordinates().add(-area.getX() / 2, -area.getY() / 2, -area.getZ() / 2);
|
||||
BlockPos maxPos = minPos.add(area);
|
||||
World world = beeHousing.getWorldObj();
|
||||
return VectUtil.getAllInBoxFromCenterMutable(world, minPos, beeHousing.getCoordinates(), maxPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isAcceptedFlower(String flowerType, World world, BlockPos pos) {
|
||||
if (!world.isBlockLoaded(pos)) {
|
||||
return true; // Avoid actually checking until the flower's position is loaded.
|
||||
@@ -185,12 +172,25 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
}
|
||||
}
|
||||
|
||||
Set<IBlockState> acceptedBlockStates = this.acceptableBlockStates.get(flowerType);
|
||||
Set<IBlockState> acceptedBlockStates = this.getAcceptedBlockStates(flowerType);
|
||||
Set<Block> acceptedBlocks = this.acceptableBlocks.get(flowerType);
|
||||
|
||||
return isAcceptedFlower(blockState, acceptedBlocks, acceptedBlockStates);
|
||||
}
|
||||
|
||||
private Set<IBlockState> getAcceptedBlockStates(String flowerType) {
|
||||
return this.acceptableBlockStates.computeIfAbsent(flowerType, k -> new BlockStateSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockPosPredicate createAcceptedFlowerPredicate(String flowerType) {
|
||||
Set<IFlowerAcceptableRule> acceptableRules = this.registeredRules.get(flowerType);
|
||||
Set<IBlockState> acceptedBlockStates = this.getAcceptedBlockStates(flowerType);
|
||||
Set<Block> acceptedBlocks = this.acceptableBlocks.get(flowerType);
|
||||
|
||||
return new AcceptedFlowerPredicate(flowerType, acceptableRules, acceptedBlocks, acceptedBlockStates);
|
||||
}
|
||||
|
||||
private static boolean isAcceptedFlower(IBlockState blockState, Set<Block> acceptedBlocks, Set<IBlockState> acceptedBlockStates) {
|
||||
Block block = blockState.getBlock();
|
||||
return acceptedBlocks.contains(block) || acceptedBlockStates.contains(blockState);
|
||||
@@ -255,4 +255,37 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
Flower flower = getRandomPlantableFlower(flowerType, world.rand);
|
||||
return world.setBlockState(pos, flower.getBlockState());
|
||||
}
|
||||
|
||||
private static class AcceptedFlowerPredicate implements IBlockPosPredicate {
|
||||
private final String flowerType;
|
||||
private final Set<IFlowerAcceptableRule> acceptableRules;
|
||||
private final Set<Block> acceptedBlocks;
|
||||
private final Set<IBlockState> acceptedBlockStates;
|
||||
|
||||
public AcceptedFlowerPredicate(String flowerType, Set<IFlowerAcceptableRule> acceptableRules, Set<Block> acceptedBlocks, Set<IBlockState> acceptedBlockStates) {
|
||||
this.flowerType = flowerType;
|
||||
this.acceptableRules = acceptableRules;
|
||||
this.acceptedBlocks = acceptedBlocks;
|
||||
this.acceptedBlockStates = acceptedBlockStates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(World world, BlockPos blockPos) {
|
||||
if (world.isBlockLoaded(blockPos)) {
|
||||
IBlockState blockState = world.getBlockState(blockPos);
|
||||
if (!blockState.getBlock().isAir(blockState, world, blockPos)) {
|
||||
for (IFlowerAcceptableRule acceptableRule : acceptableRules) {
|
||||
if (acceptableRule.isAcceptableFlower(blockState, world, blockPos, flowerType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAcceptedFlower(blockState, acceptedBlocks, acceptedBlockStates)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
@@ -18,8 +21,6 @@ import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ApiaristTracker extends BreedingTracker implements IApiaristTracker {
|
||||
|
||||
|
||||
Loaded 100 of 869 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user