mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 09:34:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98e506cc4a | ||
|
|
ecfb11c096 | ||
|
|
6b59736ffe | ||
|
|
a3a1f7720e | ||
|
|
89cfbfca9c | ||
|
|
e0676030d6 | ||
|
|
0c76e22b8a | ||
|
|
1a8f1751d9 | ||
|
|
b95bb8315f | ||
|
|
2cc2540bdc | ||
|
|
84af238d82 | ||
|
|
89960db2bd | ||
|
|
c5f53bda3e | ||
|
|
2e1b62e58d | ||
|
|
982aefa165 | ||
|
|
2cccf95775 | ||
|
|
1969ed8b09 | ||
|
|
c3fc490fac | ||
|
|
59687329fb | ||
|
|
94f751d78a | ||
|
|
f6feca096f | ||
|
|
649f38efb8 | ||
|
|
e4e221b9fd | ||
|
|
d7f063eec8 | ||
|
|
aa988a3be7 | ||
|
|
18f2a027bc | ||
|
|
7ca34e52d6 | ||
|
|
7f83b5b909 | ||
|
|
641f763d05 | ||
|
|
0df85063a1 | ||
|
|
550b0dc3f5 | ||
|
|
96a7b688c0 | ||
|
|
8f6c2baba6 | ||
|
|
523a8da908 | ||
|
|
cd10500a17 | ||
|
|
6d9211ada1 | ||
|
|
003ca9273d | ||
|
|
28f65f13a5 | ||
|
|
21ee0947d7 | ||
|
|
1e11992de2 | ||
|
|
d690a38fa2 | ||
|
|
46eb29cf28 | ||
|
|
fb01d3ffaa | ||
|
|
e676a73a7c | ||
|
|
6e348dbc5d | ||
|
|
39114ec429 | ||
|
|
3b82fe3bd0 | ||
|
|
2667334252 | ||
|
|
be39e2c3c3 | ||
|
|
40eece7d77 | ||
|
|
4fcc785e85 | ||
|
|
11e4097bd8 | ||
|
|
f8c37da06d | ||
|
|
09756f21fd | ||
|
|
a06c4bd1dc | ||
|
|
bb477f0dfb | ||
|
|
0b86b3df8f | ||
|
|
edd5357008 | ||
|
|
dfb4e04f4a | ||
|
|
45c0375387 | ||
|
|
5e4cfa5112 | ||
|
|
086b53e4a3 | ||
|
|
fbb5612b8c | ||
|
|
c3c471ab33 | ||
|
|
67ddc252aa | ||
|
|
59945a8961 | ||
|
|
bbabb967b1 | ||
|
|
4cb1ee4cb1 | ||
|
|
95135544e2 | ||
|
|
e34b71c13e | ||
|
|
cc8bcf384a | ||
|
|
1f21952beb | ||
|
|
1ed4ced65f | ||
|
|
beb74e635d | ||
|
|
40c4fc5d1f | ||
|
|
645dba903d | ||
|
|
1ac4acdb47 | ||
|
|
74aa33e80c | ||
|
|
6f6b45abcf | ||
|
|
7297a6a5d3 | ||
|
|
5ef76cffca | ||
|
|
9284f84645 | ||
|
|
85ba33e1ff | ||
|
|
9f5f5e7812 | ||
|
|
8617c4a79f | ||
|
|
e9809238de | ||
|
|
c0a22f4a28 | ||
|
|
41c6fb15b3 | ||
|
|
b5d65e83f0 | ||
|
|
1a7c148a7e | ||
|
|
ead630aa51 | ||
|
|
85b71c785a | ||
|
|
04cb58dfa2 | ||
|
|
3822e90ada | ||
|
|
af5cb93689 | ||
|
|
6a62024dd4 | ||
|
|
bedb7ffe85 | ||
|
|
4a21641bcd | ||
|
|
21d0b832b9 | ||
|
|
ce9081249f | ||
|
|
f6786cd44a | ||
|
|
a045c18a89 | ||
|
|
d6af85ad77 | ||
|
|
af55bd86a2 | ||
|
|
7aa840282f | ||
|
|
a5d57c4788 | ||
|
|
4d0c2d1ea2 | ||
|
|
840331b7d5 | ||
|
|
df91b47b35 | ||
|
|
f400241ff4 | ||
|
|
8639148f20 | ||
|
|
28e7b561ea | ||
|
|
ba7ef4228c | ||
|
|
fcd3ee6feb | ||
|
|
6ddc9f3079 | ||
|
|
cc53894473 | ||
|
|
2cd76bdad7 | ||
|
|
92eab8d47a | ||
|
|
12f5d7be6c | ||
|
|
ab88e7d57c | ||
|
|
725d85181d | ||
|
|
23c9b2071b | ||
|
|
ae025a92fc | ||
|
|
fbf30b1a73 | ||
|
|
4ba3370fc9 | ||
|
|
c1a590961d | ||
|
|
a1f7a678c1 | ||
|
|
1117b820f1 | ||
|
|
4681bf4cfb | ||
|
|
b9dd19a556 | ||
|
|
f97a737185 | ||
|
|
68fb27410e | ||
|
|
b8be42548e | ||
|
|
eb9ef642cd | ||
|
|
ed658301fd | ||
|
|
d55d86a3c5 | ||
|
|
b2d5706bbd | ||
|
|
ba6bd8fd10 | ||
|
|
b998e2ac49 | ||
|
|
817540d996 | ||
|
|
9d8866e4fd | ||
|
|
7575b9c6ce | ||
|
|
6700c511a5 | ||
|
|
acc55d4f41 | ||
|
|
7bd5bb120d | ||
|
|
dbbb727576 | ||
|
|
dcf0fc83ad | ||
|
|
6ef91590cf | ||
|
|
856322b208 | ||
|
|
42425e3500 | ||
|
|
cde076e702 | ||
|
|
b5f60d73e3 | ||
|
|
f82d123b7f | ||
|
|
ca17801c86 | ||
|
|
33d1685713 | ||
|
|
69c024811f | ||
|
|
4dd95625e1 | ||
|
|
6adcde4a75 | ||
|
|
2f06c777b2 | ||
|
|
32f295b16c | ||
|
|
ef4c65c6e6 | ||
|
|
ba313a9dfe | ||
|
|
8f36c2a6fc | ||
|
|
149a5b6128 | ||
|
|
56b871eca1 | ||
|
|
c09cdcdb64 | ||
|
|
2f66d0ea82 | ||
|
|
ac224823be | ||
|
|
1eca6e41af | ||
|
|
94bd65ee8e | ||
|
|
795b154eb5 | ||
|
|
358e7853c2 | ||
|
|
4f7b77abb4 | ||
|
|
aff15b34d6 | ||
|
|
55cf7b5c16 | ||
|
|
d4cfbe9f29 | ||
|
|
4fc731c7c8 | ||
|
|
bd2af7fa13 | ||
|
|
f3d88fea3c | ||
|
|
1d642cf9c5 | ||
|
|
b187815415 | ||
|
|
5c7150ad62 | ||
|
|
d84f708a98 | ||
|
|
2117be96cd | ||
|
|
96f941f6e6 | ||
|
|
d3c7d7141d |
No files matched your search
@@ -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.9](http://jenkins.ic2.player.to/job/Forestry_5/)
|
||||
[Latest Builds for 1.10 / 1.10.2](http://jenkins.ic2.player.to/job/Forestry_5/)
|
||||
|
||||
[IRC #forestry on esper.net](http://webchat.esper.net/?nick=ForestryGithub...&channels=forestry&prompt=1)
|
||||
|
||||
|
||||
+41
-4
@@ -17,6 +17,8 @@ buildscript {
|
||||
|
||||
plugins {
|
||||
id "net.minecraftforge.gradle.forge" version "2.0.2"
|
||||
id "com.matthewprenger.cursegradle" version "1.0.7"
|
||||
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32"
|
||||
}
|
||||
|
||||
apply plugin: 'maven'
|
||||
@@ -38,7 +40,6 @@ targetCompatibility = 1.8
|
||||
minecraft {
|
||||
version = mcversion + "-" + forgeversion
|
||||
runDir = "run"
|
||||
useDepAts = true
|
||||
mappings = mcp_mappings
|
||||
|
||||
replace '@VERSION@', project.version
|
||||
@@ -54,6 +55,9 @@ sourceSets {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url 'http://maven.epoxide.xyz'
|
||||
}
|
||||
maven {
|
||||
url "http://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
@@ -64,9 +68,10 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "mezz.jei:jei_${mcversion}:${jei_version}"
|
||||
// deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
// runtime "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||
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"
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -148,3 +153,35 @@ def getBuildNumber() {
|
||||
return "$System.env.BUILD_NUMBER" != "null" ? "$System.env.BUILD_NUMBER" : "0"
|
||||
}
|
||||
|
||||
task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||
filePath = "changelog.html"
|
||||
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}}
|
||||
"""
|
||||
}
|
||||
|
||||
curseforge {
|
||||
apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0'
|
||||
project {
|
||||
id = '59751'
|
||||
changelog = file('changelog.html')
|
||||
changelogType = 'html'
|
||||
releaseType = 'alpha'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.curseforge59751.dependsOn.add(makeChangelog)
|
||||
}
|
||||
@@ -4,3 +4,4 @@ GenuineSounds;[email protected];2015-02-26
|
||||
airbreather;[email protected];2015-04-10
|
||||
ganymedes01;[email protected];2015-05-27
|
||||
infinityraider;theoneandonlyraider@gmail;com;2015-10-03
|
||||
girafistudios;[email protected];2016-06-02
|
||||
+7
-5
@@ -1,9 +1,11 @@
|
||||
mcversion=1.9.4
|
||||
forgeversion=12.17.0.1932-1.9.4
|
||||
mcversion=1.10.2
|
||||
forgeversion=12.18.1.2044
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
jei_version=3.4.0.+
|
||||
tesla_version=1.10.2-1.2.1.41
|
||||
jei_version=3.7.3.221
|
||||
ic2_version=2.6.15-ex110
|
||||
|
||||
version_major=5
|
||||
version_minor=0
|
||||
version_patch=0
|
||||
version_minor=2
|
||||
version_patch=7
|
||||
+1
-1
Submodule lang updated: 53d7c93f90...0d52088d32.
@@ -12,6 +12,7 @@ package forestry;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -46,18 +47,13 @@ import forestry.plugins.PluginManager;
|
||||
*/
|
||||
@Mod(
|
||||
modid = Constants.MOD_ID,
|
||||
name = Constants.MOD_ID,
|
||||
name = "Forestry",
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
dependencies = "required-after:Forge@[12.17.0.1932,);"
|
||||
+ "after:Buildcraft|Core@[7.2,);"
|
||||
+ "after:BuildCraft|Energy@[7.2,);"
|
||||
+ "after:ExtrabiomesXL;"
|
||||
+ "after:BiomesOPlenty;"
|
||||
+ "after:IC2@[2.3.235,);"
|
||||
+ "after:Natura@[2.2.0,);"
|
||||
+ "after:HardcoreEnderExpansion;"
|
||||
+ "after:basemetals;")
|
||||
acceptedMinecraftVersions = "[1.10]",
|
||||
dependencies = "required-after:Forge@[12.18.0.1989,);"
|
||||
+ "after:JEI@[3.7.0,);"
|
||||
+ "after:" + PluginIC2.modId + ";")
|
||||
public class Forestry {
|
||||
|
||||
@Mod.Instance(Constants.MOD_ID)
|
||||
@@ -83,7 +79,7 @@ public class Forestry {
|
||||
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
|
||||
configFolder = new File(event.getModConfigurationDirectory(), Constants.RESOURCE_ID);
|
||||
configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID);
|
||||
Config.load();
|
||||
|
||||
PluginManager.runSetup(event);
|
||||
|
||||
@@ -50,12 +50,4 @@ public interface IAlleleBeeSpecies extends IAlleleSpecies {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 3.6.
|
||||
* @return Path of the texture to use for entity rendering.
|
||||
*/
|
||||
@Deprecated
|
||||
String getEntityTexture();
|
||||
|
||||
}
|
||||
@@ -5,6 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -16,7 +19,7 @@ import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.genetics.IHousing;
|
||||
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvider {
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingModifier(IBeeHousing housing)
|
||||
@@ -32,14 +35,11 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
*/
|
||||
Iterable<IBeeListener> getBeeListeners();
|
||||
|
||||
@Nonnull
|
||||
IBeeHousingInventory getBeeInventory();
|
||||
|
||||
IBeekeepingLogic getBeekeepingLogic();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
|
||||
int getBlockLightValue();
|
||||
|
||||
boolean canBlockSeeTheSky();
|
||||
@@ -47,8 +47,6 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
|
||||
Biome getBiome();
|
||||
|
||||
GameProfile getOwner();
|
||||
|
||||
/**
|
||||
|
||||
+4
-3
@@ -5,8 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public interface IBeeMutationCustom extends IBeeMutation, IMutationCustom {
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface IBeeMutationBuilder extends IMutationBuilder {
|
||||
@Override
|
||||
IBeeMutation build();
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public interface IBeeMutationFactory {
|
||||
/**
|
||||
* Creates a new bee mutation.
|
||||
* Automatically registered with BeeManager.beeRoot.registerMutation()
|
||||
* See IBeeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
* See IBeeMutationBuilder and IMutationBuilder for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentBee0 A parent bee for this mutation
|
||||
* @param parentBee1 A parent bee for this mutation
|
||||
@@ -19,5 +19,5 @@ public interface IBeeMutationFactory {
|
||||
* @param chance The chance that breeding the two parent bees will result in this mutation
|
||||
* @return a new bee mutation.
|
||||
*/
|
||||
IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance);
|
||||
IBeeMutationBuilder createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -7,17 +7,15 @@ package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IBeeRoot extends ISpeciesRoot {
|
||||
|
||||
/**
|
||||
@@ -100,7 +98,7 @@ public interface IBeeRoot extends ISpeciesRoot {
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
Collection<IBeeMutation> getMutations(boolean shuffle);
|
||||
List<IBeeMutation> getMutations(boolean shuffle);
|
||||
|
||||
/* GAME MODE */
|
||||
void resetBeekeepingMode();
|
||||
|
||||
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -35,12 +36,17 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
|
||||
*/
|
||||
void doWork();
|
||||
|
||||
/**
|
||||
* Force the logic to refresh any cached values and error states.
|
||||
* Call this when a player opens the gui so that all errors are up to date.
|
||||
*/
|
||||
void clearCachedValues();
|
||||
|
||||
|
||||
/* CLIENT */
|
||||
|
||||
/**
|
||||
* Call this when the housing comes into view of the client.
|
||||
* (i.e. when {@link TileEntity#getUpdateTag()} is called)
|
||||
* Sync to client by using {@link #writeToNBT(NBTTagCompound)} in your {@link TileEntity#getUpdateTag()}
|
||||
*/
|
||||
void syncToClient();
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ public interface IHiveTile {
|
||||
*/
|
||||
void calmBees();
|
||||
|
||||
boolean isAngry();
|
||||
|
||||
/**
|
||||
* Called when the hive is attacked.
|
||||
*/
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public interface IJubilanceFactory {
|
||||
/** The default Jubilance Provider is satisfied when the humidity and temperature are ideal for the bee. */
|
||||
IJubilanceProvider getDefault();
|
||||
|
||||
/** The Requires Resource Jubilance Provider is satisfied when a specific block is under the hive. */
|
||||
IJubilanceProvider getRequiresResource(Block block, int meta);
|
||||
IJubilanceProvider getRequiresResource(IBlockState... acceptedBlockStates);
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -46,5 +48,5 @@ public interface IHiveDescription {
|
||||
* Called after successful hive generation.
|
||||
* world, x, y, z give the location of the new hive.
|
||||
**/
|
||||
void postGen(World world, BlockPos pos);
|
||||
void postGen(World world, Random rand, BlockPos pos);
|
||||
}
|
||||
@@ -17,14 +17,14 @@ public interface IHiveRegistry {
|
||||
|
||||
/* Forestry Hive Names */
|
||||
enum HiveType implements IStringSerializable {
|
||||
FOREST("Forestry:forest", "Forestry.speciesForest"),
|
||||
MEADOWS("Forestry:meadows", "Forestry.speciesMeadows"),
|
||||
DESERT("Forestry:desert", "Forestry.speciesModest"),
|
||||
JUNGLE("Forestry:jungle", "Forestry.speciesTropical"),
|
||||
END("Forestry:end", "Forestry.speciesEnded"),
|
||||
SNOW("Forestry:snow", "Forestry.speciesWintry"),
|
||||
SWAMP("Forestry:swamp", "Forestry.speciesMarshy"),
|
||||
SWARM("Forestry:swarm", "Forestry.speciesForest");
|
||||
FOREST("forestry:forest", "forestry.speciesForest"),
|
||||
MEADOWS("forestry:meadows", "forestry.speciesMeadows"),
|
||||
DESERT("forestry:desert", "forestry.speciesModest"),
|
||||
JUNGLE("forestry:jungle", "forestry.speciesTropical"),
|
||||
END("forestry:end", "forestry.speciesEnded"),
|
||||
SNOW("forestry:snow", "forestry.speciesWintry"),
|
||||
SWAMP("forestry:swamp", "forestry.speciesMarshy"),
|
||||
SWARM("forestry:swarm", "forestry.speciesForest");
|
||||
|
||||
public static final HiveType[] VALUES = values();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "4.8.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
|
||||
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -10,28 +10,53 @@ import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
public enum EnumForestryWoodType implements IWoodType {
|
||||
LARCH, TEAK, ACACIA, LIME,
|
||||
CHESTNUT, WENGE, BAOBAB, SEQUOIA(4.0f),
|
||||
LARCH(4, 20),
|
||||
TEAK(4, 20),
|
||||
ACACIA(4, 20),
|
||||
LIME(4, 19),
|
||||
CHESTNUT(4, 21),
|
||||
WENGE(4, 20),
|
||||
BAOBAB(4, 20),
|
||||
SEQUOIA(3, 18, 4.0f),
|
||||
|
||||
KAPOK, EBONY, MAHOGANY, BALSA(1.0f),
|
||||
WILLOW, WALNUT, GREENHEART(7.5f), CHERRY,
|
||||
KAPOK(4, 20),
|
||||
EBONY(4, 20),
|
||||
MAHOGANY(4, 20),
|
||||
BALSA(4, 20, 1.0f),
|
||||
WILLOW(4, 20),
|
||||
WALNUT(4, 21),
|
||||
GREENHEART(4, 20, 7.5f),
|
||||
CHERRY(4, 20),
|
||||
|
||||
MAHOE, POPLAR, PALM, PAPAYA,
|
||||
PINE(3.0f), PLUM, MAPLE, CITRUS,
|
||||
MAHOE(4, 20),
|
||||
POPLAR(4, 20),
|
||||
PALM(4, 20),
|
||||
PAPAYA(4, 20),
|
||||
PINE(4, 20, 3.0f),
|
||||
PLUM(4, 20),
|
||||
MAPLE(4, 20),
|
||||
CITRUS(4, 20),
|
||||
|
||||
GIGANTEUM, IPE, PADAUK, COCOBOLO,
|
||||
ZEBRAWOOD;
|
||||
GIGANTEUM(3, 18, 4.0f),
|
||||
IPE(4, 20),
|
||||
PADAUK(4, 20),
|
||||
COCOBOLO(4, 20),
|
||||
ZEBRAWOOD(4, 20);
|
||||
|
||||
public static final float DEFAULT_HARDNESS = 2.0f;
|
||||
public static final EnumForestryWoodType[] VALUES = values();
|
||||
|
||||
private final int carbonization;
|
||||
private final int combustability;
|
||||
private final float hardness;
|
||||
|
||||
EnumForestryWoodType() {
|
||||
this(DEFAULT_HARDNESS);
|
||||
EnumForestryWoodType(int carbonization, int combustability) {
|
||||
this(carbonization, combustability, DEFAULT_HARDNESS);
|
||||
}
|
||||
|
||||
EnumForestryWoodType(float hardness) {
|
||||
EnumForestryWoodType(int carbonization, int combustability, float hardness) {
|
||||
this.carbonization = carbonization;
|
||||
this.combustability = combustability;
|
||||
this.hardness = hardness;
|
||||
}
|
||||
|
||||
@@ -66,4 +91,12 @@ public enum EnumForestryWoodType implements IWoodType {
|
||||
}
|
||||
return VALUES[meta];
|
||||
}
|
||||
|
||||
public int getCarbonization() {
|
||||
return carbonization;
|
||||
}
|
||||
|
||||
public int getCombustability() {
|
||||
return combustability;
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,6 @@ package forestry.api.arboriculture;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
@@ -18,6 +16,7 @@ import forestry.api.genetics.IAllelePlantType;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public enum EnumTreeChromosome implements IChromosomeType {
|
||||
|
||||
@@ -28,7 +27,9 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
SPECIES(IAlleleTreeSpecies.class),
|
||||
/**
|
||||
* {@link IGrowthProvider}, determines conditions required by the tree to grow.
|
||||
* @deprecated unused
|
||||
*/
|
||||
@Deprecated
|
||||
GROWTH(IAlleleGrowth.class),
|
||||
/**
|
||||
* A float modifying the height of the tree. Taken into account at worldgen.
|
||||
@@ -48,15 +49,19 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
YIELD(IAlleleFloat.class),
|
||||
/**
|
||||
* May add additional tolerances for {@link EnumPlantType}.
|
||||
* @deprecated this is tied to species directly
|
||||
*/
|
||||
@Deprecated
|
||||
PLANT(IAllelePlantType.class),
|
||||
/**
|
||||
* Determines the speed at which fruit will ripen on this tree.
|
||||
*/
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
/**
|
||||
* Territory for leaf effects. Unused.
|
||||
* Territory for leaf effects.
|
||||
* @deprecated unused
|
||||
*/
|
||||
@Deprecated
|
||||
TERRITORY(IAlleleArea.class),
|
||||
/**
|
||||
* Leaf effect. Unused.
|
||||
@@ -70,11 +75,15 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
GIRTH(IAlleleInteger.class),
|
||||
/**
|
||||
* The combustibility of the wood, when it burn to charcoal and the combustibility of the charcoal.
|
||||
* @deprecated this is tied to species directly
|
||||
*/
|
||||
@Deprecated
|
||||
COMBUSTIBILITY(IAlleleInteger.class),
|
||||
/**
|
||||
* The amount of charcoal that a wood pile ash drop;
|
||||
* @deprecated this is tied to species directly
|
||||
*/
|
||||
@Deprecated
|
||||
CARBONIZATION(IAlleleInteger.class),
|
||||
/**
|
||||
* Determines if the tree can burn.
|
||||
|
||||
@@ -7,12 +7,12 @@ import java.util.Random;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
|
||||
public enum EnumVanillaWoodType implements IWoodType {
|
||||
OAK(BlockPlanks.EnumType.OAK),
|
||||
BIRCH(BlockPlanks.EnumType.BIRCH),
|
||||
SPRUCE(BlockPlanks.EnumType.SPRUCE),
|
||||
JUNGLE(BlockPlanks.EnumType.JUNGLE),
|
||||
ACACIA(BlockPlanks.EnumType.ACACIA),
|
||||
DARK_OAK(BlockPlanks.EnumType.DARK_OAK);
|
||||
OAK(BlockPlanks.EnumType.OAK, 5, 20),
|
||||
SPRUCE(BlockPlanks.EnumType.SPRUCE, 4, 19),
|
||||
BIRCH(BlockPlanks.EnumType.BIRCH, 4, 19),
|
||||
JUNGLE(BlockPlanks.EnumType.JUNGLE, 5, 20),
|
||||
ACACIA(BlockPlanks.EnumType.ACACIA, 4, 20),
|
||||
DARK_OAK(BlockPlanks.EnumType.DARK_OAK, 5, 20);
|
||||
|
||||
public static final EnumVanillaWoodType[] VALUES = values();
|
||||
|
||||
@@ -21,9 +21,13 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
}
|
||||
|
||||
private final BlockPlanks.EnumType vanillaType;
|
||||
private final int carbonization;
|
||||
private final int combustability;
|
||||
|
||||
EnumVanillaWoodType(BlockPlanks.EnumType vanillaType) {
|
||||
EnumVanillaWoodType(BlockPlanks.EnumType vanillaType, int carbonization, int combustability) {
|
||||
this.vanillaType = vanillaType;
|
||||
this.carbonization = carbonization;
|
||||
this.combustability = combustability;
|
||||
}
|
||||
|
||||
public BlockPlanks.EnumType getVanillaType() {
|
||||
@@ -57,4 +61,14 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
public float getHardness() {
|
||||
return 2.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCarbonization() {
|
||||
return carbonization;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombustability() {
|
||||
return combustability;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
/**
|
||||
@@ -18,6 +21,7 @@ import forestry.api.core.IModelManager;
|
||||
* There is no default implementation because every sapling has a unique icon.
|
||||
*/
|
||||
public interface IGermlingModelProvider {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumGermlingType type);
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -10,6 +10,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* @deprecated this is being removed to simplify trees
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IGrowthProvider {
|
||||
|
||||
/**
|
||||
@@ -25,8 +29,6 @@ public interface IGrowthProvider {
|
||||
@Nullable
|
||||
BlockPos canGrow(ITreeGenome genome, World world, BlockPos pos, int expectedGirth, int expectedHeight);
|
||||
|
||||
EnumGrowthConditions getGrowthConditions(ITreeGenome genome, World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return Short, human-readable identifier used in the treealyzer.
|
||||
*/
|
||||
|
||||
@@ -7,24 +7,19 @@ package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
|
||||
public interface ITree extends IIndividual, ITreeGenData {
|
||||
|
||||
void mate(ITree other);
|
||||
@@ -39,8 +34,6 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
|
||||
ITreeGenome getMate();
|
||||
|
||||
EnumSet<EnumPlantType> getPlantTypes();
|
||||
|
||||
/**
|
||||
* @since Forestry 4.0
|
||||
*/
|
||||
@@ -84,12 +77,7 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
* @return Integer denoting the size of the tree trunk.
|
||||
*/
|
||||
@Override
|
||||
int getGirth(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return Growth conditions at the given position.
|
||||
*/
|
||||
EnumGrowthConditions getGrowthCondition(World world, BlockPos pos);
|
||||
int getGirth();
|
||||
|
||||
WorldGenerator getTreeGenerator(World world, BlockPos pos, boolean wasBonemealed);
|
||||
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
@@ -23,8 +20,6 @@ public interface ITreeGenome extends IGenome {
|
||||
@Nonnull
|
||||
IFruitProvider getFruitProvider();
|
||||
|
||||
IGrowthProvider getGrowthProvider();
|
||||
|
||||
float getHeight();
|
||||
|
||||
float getFertility();
|
||||
@@ -37,18 +32,12 @@ public interface ITreeGenome extends IGenome {
|
||||
|
||||
float getSappiness();
|
||||
|
||||
EnumSet<EnumPlantType> getPlantTypes();
|
||||
|
||||
/**
|
||||
* @return Amount of random block ticks required for a sapling to mature into a fully grown tree.
|
||||
*/
|
||||
int getMaturationTime();
|
||||
|
||||
int getGirth();
|
||||
|
||||
int getCombustibility();
|
||||
|
||||
int getCarbonization();
|
||||
|
||||
IAlleleLeafEffect getEffect();
|
||||
}
|
||||
+4
-3
@@ -5,8 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public interface ITreeMutationCustom extends ITreeMutation, IMutationCustom {
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface ITreeMutationBuilder extends IMutationBuilder {
|
||||
@Override
|
||||
ITreeMutation build();
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public interface ITreeMutationFactory {
|
||||
/**
|
||||
* Creates a new tree mutation.
|
||||
* Automatically registered with TreeManager.treeRoot.registerMutation()
|
||||
* See ITreeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
* See ITreeMutationBuilder and IMutationBuilder for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentTree0 A parent tree for this mutation
|
||||
* @param parentTree1 A parent tree for this mutation
|
||||
@@ -19,5 +19,5 @@ public interface ITreeMutationFactory {
|
||||
* @param chance The chance that breeding the two parent trees will result in this mutation
|
||||
* @return a new tree mutation.
|
||||
*/
|
||||
ITreeMutationCustom createMutation(IAlleleTreeSpecies parentTree0, IAlleleTreeSpecies parentTree1, IAllele[] result, int chance);
|
||||
ITreeMutationBuilder createMutation(IAlleleTreeSpecies parentTree0, IAlleleTreeSpecies parentTree1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -8,18 +8,17 @@ package forestry.api.arboriculture;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface ITreeRoot extends ISpeciesRoot {
|
||||
|
||||
@Override
|
||||
@@ -82,7 +81,7 @@ public interface ITreeRoot extends ISpeciesRoot {
|
||||
boolean setFruitBlock(World world, IAlleleFruit allele, float sappiness, BlockPos pos);
|
||||
|
||||
/* GAME MODE */
|
||||
ArrayList<ITreekeepingMode> getTreekeepingModes();
|
||||
List<ITreekeepingMode> getTreekeepingModes();
|
||||
|
||||
ITreekeepingMode getTreekeepingMode(World world);
|
||||
|
||||
@@ -98,6 +97,5 @@ public interface ITreeRoot extends ISpeciesRoot {
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
Collection<ITreeMutation> getMutations(boolean shuffle);
|
||||
|
||||
List<ITreeMutation> getMutations(boolean shuffle);
|
||||
}
|
||||
@@ -7,12 +7,12 @@ package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.ITextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.ITextureManager;
|
||||
|
||||
public interface IWoodProvider {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -30,4 +30,14 @@ public interface IWoodProvider {
|
||||
* @return A stack of wood from the tree to craft wood pile's or other things.
|
||||
*/
|
||||
ItemStack getWoodStack();
|
||||
|
||||
/**
|
||||
* @return how long this wood's charcoal burns / 1000
|
||||
*/
|
||||
int getCombustibility();
|
||||
|
||||
/**
|
||||
* The amount of charcoal dropped from a charcoal pile of this wood.
|
||||
*/
|
||||
int getCarbonization();
|
||||
}
|
||||
@@ -10,4 +10,8 @@ public interface IWoodType extends IStringSerializable {
|
||||
int getMetadata();
|
||||
|
||||
float getHardness();
|
||||
|
||||
int getCarbonization();
|
||||
|
||||
int getCombustability();
|
||||
}
|
||||
@@ -10,10 +10,6 @@ import java.util.List;
|
||||
public interface ICircuit {
|
||||
String getUID();
|
||||
|
||||
boolean requiresDiscovery();
|
||||
|
||||
int getLimit();
|
||||
|
||||
String getUnlocalizedName();
|
||||
|
||||
boolean isCircuitable(Object tile);
|
||||
|
||||
@@ -13,5 +13,7 @@ public interface IClimateManager {
|
||||
float getTemperature(World world, BlockPos pos);
|
||||
|
||||
float getHumidity(World world, BlockPos pos);
|
||||
|
||||
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IClimateProvider {
|
||||
Biome getBiome();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -38,7 +39,7 @@ public interface IModelBaker {
|
||||
|
||||
void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite texture, int colorIndex);
|
||||
|
||||
void addBakedModel(@Nonnull IBakedModel model);
|
||||
void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model);
|
||||
|
||||
void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite);
|
||||
|
||||
|
||||
@@ -30,6 +30,4 @@ public interface IModelManager {
|
||||
|
||||
void registerItemModel(Item item, ItemMeshDefinition definition);
|
||||
|
||||
void registerVariant(Item item, ResourceLocation... resources);
|
||||
|
||||
}
|
||||
@@ -38,6 +38,8 @@ public interface IFarmLogic {
|
||||
|
||||
String getName();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ItemStack getStack();
|
||||
/**
|
||||
* @return the itemStack that represents this farm logic. Used as an icon for the farm logic.
|
||||
*/
|
||||
ItemStack getIconItemStack();
|
||||
}
|
||||
@@ -8,22 +8,10 @@ package forestry.api.fuels;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class EngineBronzeFuel {
|
||||
/**
|
||||
* Item that is valid fuel for a biogas engine.
|
||||
*/
|
||||
public final Fluid liquid;
|
||||
/**
|
||||
* Power produced by this fuel per work cycle of the engine.
|
||||
*/
|
||||
public final int powerPerCycle;
|
||||
/**
|
||||
* How many work cycles a single "stack" of this type lasts.
|
||||
*/
|
||||
public final int burnDuration;
|
||||
/**
|
||||
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
|
||||
*/
|
||||
public final int dissipationMultiplier;
|
||||
private final Fluid liquid;
|
||||
private final int powerPerCycle;
|
||||
private final int burnDuration;
|
||||
private final int dissipationMultiplier;
|
||||
|
||||
public EngineBronzeFuel(Fluid liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
|
||||
this.liquid = liquid;
|
||||
@@ -31,4 +19,32 @@ public class EngineBronzeFuel {
|
||||
this.burnDuration = burnDuration;
|
||||
this.dissipationMultiplier = dissipationMultiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Item that is valid fuel for a biogas engine.
|
||||
*/
|
||||
public Fluid getLiquid() {
|
||||
return liquid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Power produced by this fuel per work cycle of the engine.
|
||||
*/
|
||||
public int getPowerPerCycle() {
|
||||
return powerPerCycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* How many work cycles a single "stack" of this type lasts.
|
||||
*/
|
||||
public int getBurnDuration() {
|
||||
return burnDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
|
||||
*/
|
||||
public int getDissipationMultiplier() {
|
||||
return dissipationMultiplier;
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,9 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class EngineCopperFuel {
|
||||
|
||||
/**
|
||||
* Item that is valid fuel for a peat-fired engine.
|
||||
*/
|
||||
public final ItemStack fuel;
|
||||
/**
|
||||
* Power produced by this fuel per work cycle.
|
||||
*/
|
||||
public final int powerPerCycle;
|
||||
/**
|
||||
* Amount of work cycles this item lasts before being consumed.
|
||||
*/
|
||||
public final int burnDuration;
|
||||
private final ItemStack fuel;
|
||||
private final int powerPerCycle;
|
||||
private final int burnDuration;
|
||||
|
||||
public EngineCopperFuel(ItemStack fuel, int powerPerCycle, int burnDuration) {
|
||||
this.fuel = fuel;
|
||||
@@ -28,4 +19,24 @@ public class EngineCopperFuel {
|
||||
this.burnDuration = burnDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Item that is valid fuel for a peat-fired engine.
|
||||
*/
|
||||
public ItemStack getFuel() {
|
||||
return fuel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Power produced by this fuel per work cycle.
|
||||
*/
|
||||
public int getPowerPerCycle() {
|
||||
return powerPerCycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount of work cycles this item lasts before being consumed.
|
||||
*/
|
||||
public int getBurnDuration() {
|
||||
return burnDuration;
|
||||
}
|
||||
}
|
||||
@@ -8,22 +8,34 @@ package forestry.api.fuels;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FermenterFuel {
|
||||
/**
|
||||
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
|
||||
*/
|
||||
public final ItemStack item;
|
||||
/**
|
||||
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
|
||||
*/
|
||||
public final int fermentPerCycle;
|
||||
/**
|
||||
* Amount of work cycles a single item of this fuel lasts before expiring.
|
||||
*/
|
||||
public final int burnDuration;
|
||||
private final ItemStack item;
|
||||
private final int fermentPerCycle;
|
||||
private final int burnDuration;
|
||||
|
||||
public FermenterFuel(ItemStack item, int fermentPerCycle, int burnDuration) {
|
||||
this.item = item;
|
||||
this.fermentPerCycle = fermentPerCycle;
|
||||
this.burnDuration = burnDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
|
||||
*/
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
|
||||
*/
|
||||
public int getFermentPerCycle() {
|
||||
return fermentPerCycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount of work cycles a single item of this fuel lasts before expiring.
|
||||
*/
|
||||
public int getBurnDuration() {
|
||||
return burnDuration;
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,9 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class GeneratorFuel {
|
||||
|
||||
/**
|
||||
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
|
||||
*/
|
||||
public final FluidStack fuelConsumed;
|
||||
/**
|
||||
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
|
||||
*/
|
||||
public final int eu;
|
||||
/**
|
||||
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
|
||||
*/
|
||||
public final int rate;
|
||||
private final FluidStack fuelConsumed;
|
||||
private final int eu;
|
||||
private final int rate;
|
||||
|
||||
public GeneratorFuel(FluidStack fuelConsumed, int eu, int rate) {
|
||||
this.fuelConsumed = fuelConsumed;
|
||||
@@ -28,4 +19,24 @@ public class GeneratorFuel {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
|
||||
*/
|
||||
public FluidStack getFuelConsumed() {
|
||||
return fuelConsumed;
|
||||
}
|
||||
|
||||
/**
|
||||
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
|
||||
*/
|
||||
public int getEu() {
|
||||
return eu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
|
||||
*/
|
||||
public int getRate() {
|
||||
return rate;
|
||||
}
|
||||
}
|
||||
@@ -8,22 +8,10 @@ package forestry.api.fuels;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MoistenerFuel {
|
||||
/**
|
||||
* The item to use
|
||||
*/
|
||||
public final ItemStack item;
|
||||
/**
|
||||
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
|
||||
*/
|
||||
public final ItemStack product;
|
||||
/**
|
||||
* How much this item contributes to the final product of the moistener (i.e. mycelium)
|
||||
*/
|
||||
public final int moistenerValue;
|
||||
/**
|
||||
* What stage this product represents. Resources with lower stage value will be consumed first.
|
||||
*/
|
||||
public final int stage;
|
||||
private final ItemStack item;
|
||||
private final ItemStack product;
|
||||
private final int moistenerValue;
|
||||
private final int stage;
|
||||
|
||||
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
|
||||
this.item = item;
|
||||
@@ -31,4 +19,32 @@ public class MoistenerFuel {
|
||||
this.stage = stage;
|
||||
this.moistenerValue = moistenerValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item to use
|
||||
*/
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
|
||||
*/
|
||||
public ItemStack getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* How much this item contributes to the final product of the moistener (i.e. mycelium)
|
||||
*/
|
||||
public int getMoistenerValue() {
|
||||
return moistenerValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* What stage this product represents. Resources with lower stage value will be consumed first.
|
||||
*/
|
||||
public int getStage() {
|
||||
return stage;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "2.0.1", owner = "ForestryAPI|core", provides = "ForestryAPI|fuels")
|
||||
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|fuels")
|
||||
package forestry.api.fuels;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -21,10 +21,10 @@ import net.minecraft.util.math.Vec3i;
|
||||
*
|
||||
* For example:
|
||||
* en_US
|
||||
* Forestry.allele.smallest=Smallest
|
||||
* forestry.allele.smallest=Smallest
|
||||
* ru_RU
|
||||
* Forestry.allele.smallest=????? ?????????
|
||||
* Forestry.allele.height.smallest=????? ??????
|
||||
* forestry.allele.smallest=????? ?????????
|
||||
* forestry.allele.height.smallest=????? ??????
|
||||
*/
|
||||
public interface IAlleleFactory {
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -20,5 +21,7 @@ public interface IAlyzerPlugin {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack);
|
||||
|
||||
Map<String, ItemStack> getIconStacks();
|
||||
|
||||
List<String> getHints();
|
||||
}
|
||||
@@ -10,11 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
/**
|
||||
* Used to check for pollination traits without altering the world by changing vanilla leaves to forestry ones.
|
||||
@@ -23,10 +20,10 @@ import forestry.api.arboriculture.ITree;
|
||||
public interface ICheckPollinatable {
|
||||
|
||||
/**
|
||||
* @return plant types this pollinatable is classified as.
|
||||
* @return plant type this pollinatable is classified as.
|
||||
* (Can be used by bees to determine whether to interact or not.)
|
||||
*/
|
||||
EnumSet<EnumPlantType> getPlantType();
|
||||
EnumPlantType getPlantType();
|
||||
|
||||
/**
|
||||
* @return IIndividual containing the genetic information of this IPollinatable
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -13,5 +14,5 @@ public interface IFlowerAcceptableRule {
|
||||
* Checks if the flower at this position is accepted by this rule.
|
||||
* flowerType is passed in case this rule is registered for multiple flower types.
|
||||
*/
|
||||
boolean isAcceptableFlower(String flowerType, World world, BlockPos pos);
|
||||
boolean isAcceptableFlower(IBlockState blockState, World world, BlockPos pos, String flowerType);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -29,14 +30,14 @@ public interface IFlowerRegistry {
|
||||
void registerGrowthRule(IFlowerGrowthRule rule, String... flowerTypes);
|
||||
|
||||
/**
|
||||
* Registers an accepted flower with any meta value.
|
||||
* Registers an accepted flower with any state.
|
||||
*/
|
||||
void registerAcceptableFlower(Block flowerBlock, String... flowerTypes);
|
||||
void registerAcceptableFlower(Block block, String... flowerTypes);
|
||||
|
||||
/**
|
||||
* Registers an accepted flower with a specific meta value.
|
||||
* Registers an accepted flower with a particular state.
|
||||
*/
|
||||
void registerAcceptableFlower(Block flowerBlock, int flowerMeta, String... flowerTypes);
|
||||
void registerAcceptableFlower(IBlockState blockState, String... flowerTypes);
|
||||
|
||||
/**
|
||||
* Registers custom logic for accepted flowers.
|
||||
@@ -53,7 +54,7 @@ public interface IFlowerRegistry {
|
||||
* @param weight Weight for the Flower (Vanilla = 1.0, Modded flowers < 1.0)
|
||||
* @param flowerTypes See {@link forestry.api.apiculture.FlowerManager}.FlowerTypeXXX
|
||||
*/
|
||||
void registerPlantableFlower(Block flowerBlock, int flowerMeta, double weight, String... flowerTypes);
|
||||
void registerPlantableFlower(IBlockState blockState, double weight, String... flowerTypes);
|
||||
|
||||
/**
|
||||
* Calls the appropriate IFlowerGrowthRule to grow a flower at a specified position.
|
||||
|
||||
+17
-17
@@ -5,48 +5,48 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
/** Set custom mutation requirements */
|
||||
public interface IMutationCustom extends IMutation {
|
||||
public interface IMutationBuilder {
|
||||
|
||||
IMutation build();
|
||||
|
||||
/** Prevent this mutation from being shown in the analyzers */
|
||||
IMutationCustom setIsSecret();
|
||||
IMutationBuilder setIsSecret();
|
||||
|
||||
/** Require a specific temperature for this mutation to occur */
|
||||
IMutationCustom restrictTemperature(EnumTemperature temperature);
|
||||
IMutationBuilder restrictTemperature(EnumTemperature temperature);
|
||||
|
||||
IMutationCustom restrictTemperature(EnumTemperature minTemperature, EnumTemperature maxTemperature);
|
||||
IMutationBuilder restrictTemperature(EnumTemperature minTemperature, EnumTemperature maxTemperature);
|
||||
|
||||
/** Require a specific humidity for this mutation to occur */
|
||||
IMutationCustom restrictHumidity(EnumHumidity humidity);
|
||||
IMutationBuilder restrictHumidity(EnumHumidity humidity);
|
||||
|
||||
IMutationCustom restrictHumidity(EnumHumidity minHumidity, EnumHumidity maxHumidity);
|
||||
IMutationBuilder restrictHumidity(EnumHumidity minHumidity, EnumHumidity maxHumidity);
|
||||
|
||||
/**
|
||||
* Restrict this mutation to certain types of biomes.
|
||||
* @param types The types of biomes this mutation can occur.
|
||||
*/
|
||||
IMutationCustom restrictBiomeType(BiomeDictionary.Type... types);
|
||||
IMutationBuilder restrictBiomeType(BiomeDictionary.Type... types);
|
||||
|
||||
/** Restrict the days of the year that this mutation can occur */
|
||||
IMutationCustom restrictDateRange(int startMonth, int startDay, int endMonth, int endDay);
|
||||
IMutationBuilder restrictDateRange(int startMonth, int startDay, int endMonth, int endDay);
|
||||
|
||||
/** Restrict the time of day that this mutation can occur */
|
||||
IMutationCustom requireDay();
|
||||
IMutationBuilder requireDay();
|
||||
|
||||
IMutationCustom requireNight();
|
||||
IMutationBuilder requireNight();
|
||||
|
||||
/** Require a specific resource to be under the location of the mutation */
|
||||
IMutationCustom requireResource(Block block, int meta);
|
||||
IMutationBuilder requireResource(IBlockState... acceptedBlockStates);
|
||||
|
||||
IMutationCustom requireResource(String oreDictName);
|
||||
IMutationBuilder requireResource(String oreDictName);
|
||||
|
||||
/** Require some other custom mutation condition */
|
||||
IMutationCustom addMutationCondition(IMutationCondition mutationCondition);
|
||||
IMutationBuilder addMutationCondition(IMutationCondition mutationCondition);
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -15,7 +16,7 @@ public interface IMutationCondition {
|
||||
* Most will return 1 if the condition is met and 0 otherwise,
|
||||
* but the float offers flexibility for more advanced conditions.
|
||||
*/
|
||||
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate);
|
||||
|
||||
/**
|
||||
* A localized description of the mutation condition. (i.e. "A temperature of HOT is required.")
|
||||
|
||||
@@ -12,12 +12,11 @@ import java.util.List;
|
||||
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;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
/**
|
||||
* Describes a class of species (i.e. bees, trees, butterflies), provides helper functions and access to common functionality.
|
||||
*/
|
||||
@@ -105,9 +104,9 @@ public interface ISpeciesRoot {
|
||||
void registerTemplate(String identifier, IAllele[] template);
|
||||
|
||||
/**
|
||||
* Retrieves a registered template using the passed identifier.
|
||||
* Retrieves a registered template using the passed species unique identifier.
|
||||
*
|
||||
* @param identifier
|
||||
* @param identifier species UID
|
||||
* @return Array of {@link IAllele} representing a genome.
|
||||
*/
|
||||
IAllele[] getTemplate(String identifier);
|
||||
@@ -139,13 +138,13 @@ public interface ISpeciesRoot {
|
||||
/**
|
||||
* @return All registered mutations.
|
||||
*/
|
||||
Collection<? extends IMutation> getMutations(boolean shuffle);
|
||||
List<? extends IMutation> getMutations(boolean shuffle);
|
||||
|
||||
/**
|
||||
* @param other Allele to match mutations against.
|
||||
* @return All registered mutations the given allele is part of.
|
||||
*/
|
||||
Collection<? extends IMutation> getCombinations(IAllele other);
|
||||
List<? extends IMutation> getCombinations(IAllele other);
|
||||
|
||||
/**
|
||||
* @since Forestry 3.7
|
||||
@@ -170,14 +169,14 @@ public interface ISpeciesRoot {
|
||||
void setResearchSuitability(ItemStack itemstack, float suitability);
|
||||
|
||||
/**
|
||||
* @return Array of {@link IChromosomeType} which are in this species genome
|
||||
* @return Array of all {@link IChromosomeType} which are in this species genome
|
||||
*/
|
||||
IChromosomeType[] getKaryotype();
|
||||
|
||||
/**
|
||||
* @return {@link IChromosomeType} which is the "key" for this species class, usually the species chromosome.
|
||||
* @return {@link IChromosomeType} which is the "key" for this species class, the species chromosome.
|
||||
*/
|
||||
IChromosomeType getKaryotypeKey();
|
||||
IChromosomeType getSpeciesChromosomeType();
|
||||
|
||||
/**
|
||||
* Plugin to add information for the handheld genetic analyzer.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -22,7 +22,7 @@ public interface IGreenhouseState {
|
||||
|
||||
float getExactHumidity();
|
||||
|
||||
List<IInternalBlock> getInternalBlocks();
|
||||
Set<IInternalBlock> getInternalBlocks();
|
||||
|
||||
Collection<IMultiblockComponent> getGreenhouseComponents();
|
||||
|
||||
|
||||
+4
-3
@@ -5,8 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public interface IButterflyMutationCustom extends IButterflyMutation, IMutationCustom {
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface IButterflyMutationBuilder extends IMutationBuilder {
|
||||
@Override
|
||||
IButterflyMutation build();
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public interface IButterflyMutationFactory {
|
||||
/**
|
||||
* Creates a new butterfly mutation.
|
||||
* Automatically registered with ButterflyManager.butterflyRoot.registerMutation()
|
||||
* See IButterflyMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
* See IButterflyMutationBuilder and IMutationBuilder for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentButterfly0 A parent butterfly for this mutation
|
||||
* @param parentButterfly1 A parent butterfly for this mutation
|
||||
@@ -19,5 +19,5 @@ public interface IButterflyMutationFactory {
|
||||
* @param chance The chance that breeding the two parent butterfly's will result in this mutation
|
||||
* @return a new butterfly mutation.
|
||||
*/
|
||||
IButterflyMutationCustom createMutation(IAlleleButterflySpecies parentButterfly0, IAlleleButterflySpecies parentButterfly1, IAllele[] result, int chance);
|
||||
IButterflyMutationBuilder createMutation(IAlleleButterflySpecies parentButterfly0, IAlleleButterflySpecies parentButterfly1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IButterflyNursery extends IHousing {
|
||||
public interface IButterflyNursery extends IHousing, IClimateProvider {
|
||||
|
||||
IButterfly getCaterpillar();
|
||||
|
||||
|
||||
@@ -7,18 +7,16 @@ package forestry.api.lepidopterology;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IButterflyRoot extends ISpeciesRoot {
|
||||
|
||||
@Override
|
||||
@@ -67,7 +65,7 @@ public interface IButterflyRoot extends ISpeciesRoot {
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
Collection<IButterflyMutation> getMutations(boolean shuffle);
|
||||
List<IButterflyMutation> getMutations(boolean shuffle);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
@@ -17,9 +17,5 @@ public interface IMailAddress extends INbtWritable {
|
||||
|
||||
boolean isValid();
|
||||
|
||||
boolean isPlayer();
|
||||
|
||||
boolean isTrader();
|
||||
|
||||
GameProfile getPlayerProfile();
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,9 +19,10 @@ public interface IPostRegistry {
|
||||
IPostOffice getPostOffice(World world);
|
||||
|
||||
/* MAIL ADDRESSES */
|
||||
IMailAddress getMailAddress(GameProfile gameProfile);
|
||||
|
||||
IMailAddress getMailAddress(String traderName);
|
||||
@Nonnull
|
||||
IMailAddress getMailAddress(@Nonnull GameProfile gameProfile);
|
||||
|
||||
IMailAddress getMailAddress(@Nonnull String traderName);
|
||||
|
||||
/* LETTERS */
|
||||
boolean isLetter(ItemStack itemstack);
|
||||
|
||||
@@ -8,9 +8,8 @@ package forestry.api.multiblock;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.arboriculture.EnumPileType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -23,11 +22,10 @@ public interface ICharcoalPileComponent<T extends IMultiblockLogicCharcoalPile>
|
||||
|
||||
@Override
|
||||
T getMultiblockLogic();
|
||||
|
||||
@Nonnull
|
||||
ITree getTree();
|
||||
|
||||
void setTree(@Nonnull ITree tree);
|
||||
|
||||
IAlleleTreeSpecies getTreeSpecies();
|
||||
|
||||
void setTreeSpecies(@Nonnull IAlleleTreeSpecies treeSpecies);
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
@@ -38,6 +36,6 @@ public interface ICharcoalPileComponent<T extends IMultiblockLogicCharcoalPile>
|
||||
EnumPileType getPileType();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ITree getNextWoodPile();
|
||||
IAlleleTreeSpecies getNextWoodPile();
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -24,6 +26,7 @@ public interface ISqueezerRecipe extends IForestryRecipe {
|
||||
/**
|
||||
* @return Item stack representing the possible remnants from this recipe. (i.e. tin left over from tin cans)
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack getRemnants();
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,43 +5,42 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IBackpackDefinition extends Predicate<ItemStack> {
|
||||
|
||||
/**
|
||||
* To make your own backpack, create a backpack definition and register it with
|
||||
* {@link IBackpackInterface#registerBackpackDefinition(String, IBackpackDefinition)}.
|
||||
*/
|
||||
public interface IBackpackDefinition {
|
||||
/**
|
||||
* @return Human-readable name of the backpack.
|
||||
*/
|
||||
@Nonnull
|
||||
String getName(ItemStack backpack);
|
||||
|
||||
/**
|
||||
* @return Primary colour for the backpack icon.
|
||||
* @return Primary color for the backpack icon.
|
||||
*/
|
||||
int getPrimaryColour();
|
||||
|
||||
/**
|
||||
* @return Secondary colour for backpack icon.
|
||||
* @return Secondary color for backpack icon, normally white.
|
||||
*/
|
||||
int getSecondaryColour();
|
||||
|
||||
/**
|
||||
* Adds an item as valid for this backpack.
|
||||
* Filters items that can be put into a backpack.
|
||||
*
|
||||
* @param validItem
|
||||
* For Backpack Implementers: you can create a new filter with
|
||||
* {@link IBackpackInterface#createBackpackFilter()} or
|
||||
* {@link IBackpackInterface#createNaturalistBackpackFilter(String)}
|
||||
* or implement your own.
|
||||
*
|
||||
* @return the backpack's item filter.
|
||||
*/
|
||||
void addValidItem(ItemStack validItem);
|
||||
|
||||
void addValidItems(List<ItemStack> validItems);
|
||||
|
||||
void addValidOreDictName(String oreDictName);
|
||||
|
||||
/**
|
||||
* Returns true if the ItemStack is a valid item for this backpack type.
|
||||
*/
|
||||
@Override
|
||||
boolean test(ItemStack itemstack);
|
||||
|
||||
@Nonnull
|
||||
Predicate<ItemStack> getFilter();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package forestry.api.storage;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
* A configurable backpack filter. Useful for implementers of {@link IBackpackDefinition}.
|
||||
* Get a new instance from {@link IBackpackInterface#createBackpackFilter()}.
|
||||
*/
|
||||
public interface IBackpackFilterConfigurable extends Predicate<ItemStack> {
|
||||
/**
|
||||
* Adds an item as valid for this backpack to pick up.
|
||||
*/
|
||||
void acceptItem(ItemStack validItem);
|
||||
|
||||
/**
|
||||
* Adds an item as invalid for this backpack, used to make exceptions to oreDictionary matches.
|
||||
*
|
||||
* @see #acceptOreDictName(String)
|
||||
*/
|
||||
void rejectItem(ItemStack invalidItem);
|
||||
|
||||
/**
|
||||
* Adds an ore dictionary name as valid for this backpack.
|
||||
* The backpack will pick up any item that has this oreDictName.
|
||||
*
|
||||
* @see OreDictionary
|
||||
*/
|
||||
void acceptOreDictName(String oreDictName);
|
||||
|
||||
/**
|
||||
* Removes an ore dictionary name as valid for this backpack.
|
||||
* The backpack will not pick up any item that has this oreDictName.
|
||||
*
|
||||
* @see OreDictionary
|
||||
*/
|
||||
void rejectOreDictName(String oreDictName);
|
||||
|
||||
/**
|
||||
* Clear all the rules from this filter.
|
||||
*/
|
||||
void clear();
|
||||
}
|
||||
@@ -7,32 +7,83 @@ package forestry.api.storage;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
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;
|
||||
|
||||
/**
|
||||
* The Backpack Interface allows you to add items to Forestry backpacks or create your own backpacks.
|
||||
* <p>
|
||||
* To create your own backpack, create an {@link IBackpackDefinition}.
|
||||
* Backpack definitions have a filter, which you can create here with
|
||||
* {@link #createBackpackFilter()}
|
||||
* or {@link #createNaturalistBackpackFilter(String)}
|
||||
* or create your own.
|
||||
* <p>
|
||||
* After you've registered your backpack definition, create the item with
|
||||
* {@link #createBackpack(String, EnumBackpackType)}
|
||||
* or {@link #createNaturalistBackpack(String, ISpeciesRoot)}
|
||||
* and then register the returned item with {@link GameRegistry#register(IForgeRegistryEntry)} like any other item.
|
||||
*/
|
||||
public interface IBackpackInterface {
|
||||
/**
|
||||
* Get a backpack with a given uid so you can add items to it or get information about it.
|
||||
* returns null if there is no backpack for the given uid.
|
||||
* Add an accepted item to a Forestry backpack.
|
||||
*
|
||||
* @param backpackUid The unique ID of the Forestry backpack. See {@link BackpackManager} for valid UIDs.
|
||||
* @param itemStack The itemStack that the backpack should accept.
|
||||
* {@link OreDictionary#WILDCARD_VALUE} can be used for meta value.
|
||||
*/
|
||||
void addItemToForestryBackpack(@Nonnull String backpackUid, @Nonnull ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Register a backpack definition with a given uid.
|
||||
*/
|
||||
void registerBackpackDefinition(@Nonnull String backpackUid, @Nonnull IBackpackDefinition definition);
|
||||
|
||||
/**
|
||||
* Get a backpack definition with a given uid.
|
||||
*/
|
||||
@Nullable
|
||||
IBackpackDefinition getBackpack(@Nonnull String uid);
|
||||
IBackpackDefinition getBackpackDefinition(@Nonnull String backpackUid);
|
||||
|
||||
/**
|
||||
* Register a backpack with a given uid
|
||||
*/
|
||||
void registerBackpack(@Nonnull String uid, @Nonnull IBackpackDefinition definition);
|
||||
|
||||
/**
|
||||
* Adds a backpack with the given definition and type, returning the item.
|
||||
* Creates a backpack with the given UID and type, returning the item.
|
||||
* The backpack's definition must first be registered with {@link #registerBackpackDefinition(String, IBackpackDefinition)}.
|
||||
*
|
||||
* @param definition
|
||||
* Definition of backpack behaviour.
|
||||
* @param type
|
||||
* Type of backpack.
|
||||
* @param backpackUid The unique ID of the backpack.
|
||||
* @param type Type of backpack.
|
||||
* @return Created backpack item.
|
||||
*/
|
||||
@Nonnull
|
||||
Item createBackpack(@Nonnull IBackpackDefinition definition, @Nonnull EnumBackpackType type);
|
||||
Item createBackpack(@Nonnull String backpackUid, @Nonnull EnumBackpackType type);
|
||||
|
||||
/**
|
||||
* Create a backpack that can hold items from a specific {@link ISpeciesRoot}.
|
||||
* The backpack's definition must first be registered with {@link #registerBackpackDefinition(String, IBackpackDefinition)}.
|
||||
*
|
||||
* @param backpackUid The unique ID of the backpack.
|
||||
* @param speciesRoot The species root.
|
||||
* @return Created backpack item.
|
||||
*/
|
||||
Item createNaturalistBackpack(@Nonnull String backpackUid, @Nonnull ISpeciesRoot speciesRoot);
|
||||
|
||||
/**
|
||||
* Makes a new configurable backpack filter. Useful for implementing {@link IBackpackDefinition}.
|
||||
*/
|
||||
IBackpackFilterConfigurable createBackpackFilter();
|
||||
|
||||
/**
|
||||
* Makes a new naturalist backpack filter. Only accepts items from a specific {@link ISpeciesRoot}.
|
||||
* Useful for implementing {@link IBackpackDefinition} for naturalist's backpacks.
|
||||
*
|
||||
* @param speciesRootUid The species root's unique ID. See {@link ISpeciesRoot#getUID()}.
|
||||
* @return a new backpack filter for the specified species root
|
||||
* @see #createNaturalistBackpack(String, ISpeciesRoot)
|
||||
*/
|
||||
Predicate<ItemStack> createNaturalistBackpackFilter(String speciesRootUid);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|storage")
|
||||
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|storage")
|
||||
package forestry.api.storage;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -18,7 +18,7 @@ import forestry.api.arboriculture.ITreeGenome;
|
||||
|
||||
public interface ITreeGenData {
|
||||
|
||||
int getGirth(World world, BlockPos pos);
|
||||
int getGirth();
|
||||
|
||||
float getHeightModifier();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -197,6 +198,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
if (!ItemStack.areItemStacksEqual(this.queenStack, queenStack)) {
|
||||
this.queen = BeeManager.beeRoot.getMember(queenStack);
|
||||
this.queenStack = queenStack;
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
}
|
||||
|
||||
if (errorLogic.setCondition(queen == null, EnumErrorCode.NO_QUEEN)) {
|
||||
@@ -231,11 +234,20 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
if (beeType == EnumBeeType.PRINCESS) {
|
||||
tickBreed();
|
||||
} else if (beeType == EnumBeeType.QUEEN) {
|
||||
queenWorkTick(queen);
|
||||
queenWorkTick(queen, queenStack);
|
||||
}
|
||||
}
|
||||
|
||||
private void queenWorkTick(IBee queen) {
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
if (!housing.getWorldObj().isRemote) {
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
canWork();
|
||||
}
|
||||
}
|
||||
|
||||
private void queenWorkTick(@Nullable IBee queen, @Nonnull ItemStack queenStack) {
|
||||
if (queen == null) {
|
||||
beeProgress = 0;
|
||||
beeProgressMax = 0;
|
||||
@@ -261,7 +273,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
// Write the changed queen back into the item stack.
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
queen.writeToNBT(nbttagcompound);
|
||||
housing.getBeeInventory().getQueen().setTagCompound(nbttagcompound);
|
||||
queenStack.setTagCompound(nbttagcompound);
|
||||
housing.getBeeInventory().setQueen(queenStack);
|
||||
}
|
||||
|
||||
beeProgress = queen.getHealth();
|
||||
@@ -505,6 +518,11 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
return queenCanWorkCached;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
queenCanWorkCached.clear();
|
||||
queenCanWorkCooldown = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static class PollenHandler {
|
||||
|
||||
@@ -37,6 +37,11 @@ public class FakeBeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToClient() {
|
||||
|
||||
|
||||
@@ -97,6 +97,11 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
flowerCoords.clear();
|
||||
cooldown = 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public List<BlockPos> getFlowerCoords() {
|
||||
return Collections.unmodifiableList(flowerCoords);
|
||||
@@ -129,6 +134,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
|
||||
BlockPos flowerPos = new BlockPos(flowersList[i], flowersList[i + 1], flowersList[i + 2]);
|
||||
flowerCoords.add(flowerPos);
|
||||
}
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.util.EnumFacing;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.core.access.IAccessHandler;
|
||||
import forestry.core.inventory.InventoryAdapterRestricted;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
@@ -27,8 +26,8 @@ public class InventoryBeeHousing extends InventoryAdapterRestricted implements I
|
||||
public static final int SLOT_PRODUCT_1 = 2;
|
||||
public static final int SLOT_PRODUCT_COUNT = 7;
|
||||
|
||||
public InventoryBeeHousing(int size, IAccessHandler accessHandler) {
|
||||
super(size, "Items", accessHandler);
|
||||
public InventoryBeeHousing(int size) {
|
||||
super(size, "Items");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,45 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.item.ItemStack;
|
||||
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.config.Property;
|
||||
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;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import forestry.Forestry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -70,8 +39,6 @@ import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
import forestry.apiculture.entities.ParticleBee;
|
||||
import forestry.apiculture.flowers.Flower;
|
||||
import forestry.apiculture.flowers.FlowerRegistry;
|
||||
import forestry.apiculture.genetics.BeeBranchDefinition;
|
||||
import forestry.apiculture.genetics.BeeDefinition;
|
||||
@@ -95,6 +62,7 @@ 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;
|
||||
@@ -114,17 +82,40 @@ import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.core.utils.IMCUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.OreDictUtil;
|
||||
import forestry.core.utils.Stack;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.core.utils.VillagerTradeLists;
|
||||
import forestry.food.PluginFood;
|
||||
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.client.renderer.texture.TextureAtlasSprite;
|
||||
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.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.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 {
|
||||
@@ -135,16 +126,12 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
public static String beekeepingMode = "NORMAL";
|
||||
private static float secondPrincessChance = 0;
|
||||
public static final int ticksPerBeeWorkCycle = 550;
|
||||
public static boolean fancyRenderedBees = false;
|
||||
|
||||
public static ItemRegistryApiculture items;
|
||||
public static BlockRegistryApiculture blocks;
|
||||
|
||||
public static HiveRegistry hiveRegistry;
|
||||
|
||||
private final Map<String, String[]> defaultAcceptedFlowers = new HashMap<>();
|
||||
private final Map<String, String[]> defaultPlantableFlowers = new HashMap<>();
|
||||
|
||||
public static VillagerRegistry.VillagerProfession villagerApiarist;
|
||||
|
||||
@Override
|
||||
@@ -208,19 +195,17 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
@Override
|
||||
public void doInit() {
|
||||
File configFile = new File(Forestry.instance.getConfigFolder(), CONFIG_CATEGORY + ".cfg");
|
||||
if (!configFile.exists()) {
|
||||
setDefaultsForConfig();
|
||||
}
|
||||
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "2.0.0");
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "3.0.0");
|
||||
if (!Objects.equals(config.getLoadedConfigVersion(), config.getDefinedConfigVersion())) {
|
||||
boolean deleted = configFile.delete();
|
||||
if (deleted) {
|
||||
config = new LocalizedConfiguration(configFile, "2.0.0");
|
||||
setDefaultsForConfig();
|
||||
config = new LocalizedConfiguration(configFile, "3.0.0");
|
||||
}
|
||||
}
|
||||
|
||||
initFlowerRegistry();
|
||||
|
||||
List<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
|
||||
String[] validBeekeepingModeNames = new String[beekeepingModes.size()];
|
||||
for (int i = 0; i < beekeepingModes.size(); i++) {
|
||||
@@ -232,34 +217,6 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
secondPrincessChance = config.getFloatLocalized("beekeeping", "second.princess", secondPrincessChance, 0.0f, 100.0f);
|
||||
|
||||
String acceptedFlowerMessage = Translator.translateToLocal("for.config.beekeeping.flowers.accepted.comment");
|
||||
String plantableFlowerMessage = Translator.translateToLocal("for.config.beekeeping.flowers.plantable.comment");
|
||||
|
||||
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
|
||||
|
||||
for (String flowerType : flowerRegistry.getFlowerTypes()) {
|
||||
String[] defaultAccepted = defaultAcceptedFlowers.get(flowerType);
|
||||
if (defaultAccepted == null) {
|
||||
defaultAccepted = Constants.EMPTY_STRINGS;
|
||||
}
|
||||
Property property = config.get("beekeeping.flowers." + flowerType, "accepted", defaultAccepted);
|
||||
property.setComment(acceptedFlowerMessage);
|
||||
parseAcceptedFlowers(property.getStringList(), flowerType);
|
||||
|
||||
String[] defaultPlantable = defaultPlantableFlowers.get(flowerType);
|
||||
if (defaultPlantable == null) {
|
||||
defaultPlantable = Constants.EMPTY_STRINGS;
|
||||
}
|
||||
property = config.get("beekeeping.flowers." + flowerType, "plantable", defaultPlantable);
|
||||
property.setComment(plantableFlowerMessage);
|
||||
parsePlantableFlowers(property, flowerType);
|
||||
|
||||
Set<Flower> acceptableFlowers = flowerRegistry.getAcceptableFlowers(flowerType);
|
||||
if (acceptableFlowers == null || acceptableFlowers.isEmpty()) {
|
||||
Log.error("Flower type '" + flowerType + "' has no valid flowers set in apiculture.cfg. Add valid flowers or delete the config to set it to default.");
|
||||
}
|
||||
}
|
||||
|
||||
String[] blacklist = config.getStringListLocalized("species", "blacklist", Constants.EMPTY_STRINGS);
|
||||
parseBeeBlacklist(blacklist);
|
||||
|
||||
@@ -306,13 +263,16 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
VillagerRegistry villagerRegistry = VillagerRegistry.instance();
|
||||
villagerRegistry.registerVillageCreationHandler(villageHandler);
|
||||
|
||||
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER);
|
||||
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER, Constants.TEXTURE_SKIN_ZOMBIE_BEEKPEEPER);
|
||||
villagerRegistry.register(villagerApiarist);
|
||||
|
||||
ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
|
||||
ItemStack wildcardDrone = new ItemStack(items.beeDroneGE, 1);
|
||||
ItemStack apiary = new ItemStack(blocks.apiary);
|
||||
ItemStack provenFrames = items.frameProven.getItemStack();
|
||||
ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
|
||||
ItemStack endDrone = BeeDefinition.ENDED.getMemberStack(EnumBeeType.DRONE);
|
||||
ItemStack propolis = new ItemStack(PluginApiculture.items.propolis,1);
|
||||
|
||||
VillagerRegistry.VillagerCareer apiaristCareer = new VillagerRegistry.VillagerCareer(villagerApiarist, "apiarist");
|
||||
apiaristCareer.addTrade(1,
|
||||
@@ -322,19 +282,19 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
);
|
||||
apiaristCareer.addTrade(2,
|
||||
new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 4), new ItemStack(items.smoker), null),
|
||||
new VillagerTradeLists.GiveItemForLogsAndEmeralds(apiary, new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(16, 32), new EntityVillager.PriceInfo(1, 2))
|
||||
new VillagerTradeLists.GiveItemForLogsAndEmeralds(apiary, new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(16, 32), new EntityVillager.PriceInfo(1, 2)),
|
||||
new VillagerApiaristTrades.GiveRandomHiveDroneForItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4))
|
||||
);
|
||||
apiaristCareer.addTrade(3,
|
||||
new VillagerTradeLists.GiveEmeraldForItems(wildcardPrincess, null),
|
||||
new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 2), provenFrames, new EntityVillager.PriceInfo(1, 6))
|
||||
);
|
||||
apiaristCareer.addTrade(4,
|
||||
new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null)
|
||||
new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null),
|
||||
new VillagerTradeLists.GiveItemForTwoItems(wildcardPrincess, null,new ItemStack(Items.ENDER_EYE),new EntityVillager.PriceInfo(12, 16),endDrone, null)
|
||||
);
|
||||
}
|
||||
|
||||
proxy.initializeRendering();
|
||||
|
||||
blocks.apiary.init();
|
||||
blocks.beeHouse.init();
|
||||
blocks.beeChest.init();
|
||||
@@ -346,8 +306,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
registerDungeonLoot();
|
||||
}
|
||||
|
||||
private void setDefaultsForConfig() {
|
||||
|
||||
private void initFlowerRegistry() {
|
||||
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
|
||||
|
||||
flowerRegistry.registerAcceptableFlowerRule(new EndFlowerAcceptableRule(), FlowerManager.FlowerTypeEnd);
|
||||
@@ -361,53 +320,26 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.MELON_STEM, FlowerManager.FlowerTypeGourd);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.NETHER_WART, FlowerManager.FlowerTypeNether);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.CACTUS, FlowerManager.FlowerTypeCacti);
|
||||
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 1, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 4, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 5, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
|
||||
|
||||
// Register plantable plants
|
||||
for (int meta = 0; meta <= 8; meta++) {
|
||||
flowerRegistry.registerPlantableFlower(Blocks.RED_FLOWER, meta, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
}
|
||||
|
||||
flowerRegistry.registerPlantableFlower(Blocks.YELLOW_FLOWER, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.BROWN_MUSHROOM, 0, 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.RED_MUSHROOM, 0, 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.CACTUS, 0, 1.0, FlowerManager.FlowerTypeCacti);
|
||||
|
||||
for (String flowerType : flowerRegistry.getFlowerTypes()) {
|
||||
Set<Flower> flowers = flowerRegistry.getAcceptableFlowers(flowerType);
|
||||
List<String> acceptedFlowerNames = new ArrayList<>();
|
||||
List<String> plantableFlowerNames = new ArrayList<>();
|
||||
if (flowers != null) {
|
||||
for (Flower flower : flowers) {
|
||||
String name = ItemStackUtil.getBlockNameFromRegistryAsSting(flower.getBlock());
|
||||
if (name == null) {
|
||||
Log.warning("Could not find name for flower: " + flower + " with type: " + flowerType);
|
||||
continue;
|
||||
}
|
||||
|
||||
int meta = flower.getMeta();
|
||||
if (flower.getMeta() != OreDictionary.WILDCARD_VALUE) {
|
||||
name = name + ':' + meta;
|
||||
}
|
||||
|
||||
if (flower.isPlantable()) {
|
||||
plantableFlowerNames.add(name);
|
||||
} else {
|
||||
acceptedFlowerNames.add(name);
|
||||
}
|
||||
}
|
||||
for (BlockFlower.EnumFlowerType flowerType : BlockFlower.EnumFlowerType.values()) {
|
||||
IBlockState blockState;
|
||||
switch (flowerType.getBlockType()) {
|
||||
case RED:
|
||||
blockState = Blocks.RED_FLOWER.getDefaultState().withProperty(Blocks.RED_FLOWER.getTypeProperty(), flowerType);
|
||||
break;
|
||||
case YELLOW:
|
||||
blockState = Blocks.YELLOW_FLOWER.getDefaultState().withProperty(Blocks.YELLOW_FLOWER.getTypeProperty(), flowerType);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] acceptedFlowerNamesArray = acceptedFlowerNames.toArray(new String[acceptedFlowerNames.size()]);
|
||||
defaultAcceptedFlowers.put(flowerType, acceptedFlowerNamesArray);
|
||||
|
||||
String[] plantableFlowerNamesArray = plantableFlowerNames.toArray(new String[plantableFlowerNames.size()]);
|
||||
defaultPlantableFlowers.put(flowerType, plantableFlowerNamesArray);
|
||||
flowerRegistry.registerPlantableFlower(blockState, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
}
|
||||
|
||||
flowerRegistry.registerPlantableFlower(Blocks.BROWN_MUSHROOM.getDefaultState(), 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.RED_MUSHROOM.getDefaultState(), 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.CACTUS.getDefaultState(), 1.0, FlowerManager.FlowerTypeCacti);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -624,9 +556,9 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{items.honeydew.getItemStack()}, honeyDropFluid);
|
||||
|
||||
ItemStack phosphor = PluginCore.items.phosphor.getItemStack(2);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND)}, Fluids.LAVA.getFluid(2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND, 1, 1)}, Fluids.LAVA.getFluid(2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.DIRT)}, Fluids.LAVA.getFluid(1600));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND)}, new FluidStack(FluidRegistry.WATER, 2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND, 1, 1)}, new FluidStack(FluidRegistry.LAVA, 2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.DIRT)}, new FluidStack(FluidRegistry.LAVA, 1600));
|
||||
|
||||
// / CARPENTER
|
||||
RecipeManagers.carpenterManager.addRecipe(50, Fluids.FOR_HONEY.getFluid(500), null, PluginCore.items.craftingMaterial.getScentedPaneling(),
|
||||
@@ -635,14 +567,14 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'J', items.royalJelly,
|
||||
'W', PluginCore.items.beeswax,
|
||||
'P', items.pollenCluster.get(EnumPollenCluster.NORMAL, 1));
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(30, Fluids.WATER.getFluid(600), null, blocks.candle.getUnlitCandle(24),
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(30, new FluidStack(FluidRegistry.WATER, 600), null, blocks.candle.getUnlitCandle(24),
|
||||
" X ",
|
||||
"###",
|
||||
"###",
|
||||
'#', PluginCore.items.beeswax,
|
||||
'X', Items.STRING);
|
||||
RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(200), null, blocks.candle.getUnlitCandle(6),
|
||||
RecipeManagers.carpenterManager.addRecipe(10, new FluidStack(FluidRegistry.WATER, 200), null, blocks.candle.getUnlitCandle(6),
|
||||
"#X#",
|
||||
'#', PluginCore.items.beeswax,
|
||||
'X', PluginCore.items.craftingMaterial.getSilkWisp());
|
||||
@@ -866,36 +798,6 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private static void parseAcceptedFlowers(String[] acceptedFlowers, String flowerType) {
|
||||
List<Stack> acceptedFlowerItemStacks = Stack.parseStackStrings(acceptedFlowers, OreDictionary.WILDCARD_VALUE);
|
||||
for (Stack acceptedFlower : acceptedFlowerItemStacks) {
|
||||
Block acceptedFlowerBlock = acceptedFlower.getBlock();
|
||||
int meta = acceptedFlower.getMeta();
|
||||
if (acceptedFlowerBlock != null) {
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(acceptedFlowerBlock, meta, flowerType);
|
||||
} else {
|
||||
Log.warning("No block found for '" + acceptedFlower + "' in apiculture config for '" + flowerType + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void parsePlantableFlowers(Property property, String flowerType) {
|
||||
for (String string : property.getStringList()) {
|
||||
Stack plantableFlower = Stack.parseStackString(string, OreDictionary.WILDCARD_VALUE);
|
||||
if (plantableFlower == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block plantableFlowerBlock = plantableFlower.getBlock();
|
||||
int meta = plantableFlower.getMeta();
|
||||
if (plantableFlowerBlock != null) {
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(plantableFlowerBlock, meta, 1.0, flowerType);
|
||||
} else {
|
||||
Log.warning("No block found for '" + string + "' in config '" + property.getName() + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISaveEventHandler getSaveEventHandler() {
|
||||
return new SaveEventHandlerApiculture();
|
||||
@@ -941,12 +843,12 @@ 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)));
|
||||
}
|
||||
ParticleBee.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
|
||||
ProxyApicultureClient.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
|
||||
}
|
||||
|
||||
private static class EndFlowerAcceptableRule implements IFlowerAcceptableRule {
|
||||
@Override
|
||||
public boolean isAcceptableFlower(String flowerType, World world, BlockPos pos) {
|
||||
public boolean isAcceptableFlower(IBlockState blockState, World world, BlockPos pos, String flowerType) {
|
||||
Biome biomeGenForCoords = world.getBiome(pos);
|
||||
return BiomeDictionary.isBiomeOfType(biomeGenForCoords, BiomeDictionary.Type.END);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package forestry.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -8,6 +9,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.village.MerchantRecipe;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.apiculture.genetics.BeeDefinition;
|
||||
|
||||
public class VillagerApiaristTrades {
|
||||
|
||||
public static class GiveRandomCombsForItems implements EntityVillager.ITradeList {
|
||||
@@ -24,7 +28,7 @@ public class VillagerApiaristTrades {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
|
||||
public void modifyMerchantRecipeList(@Nonnull MerchantRecipeList recipeList, @Nonnull Random random) {
|
||||
int sellAmount = 1;
|
||||
if (this.priceInfo != null) {
|
||||
sellAmount = this.priceInfo.getPrice(random);
|
||||
@@ -41,5 +45,46 @@ public class VillagerApiaristTrades {
|
||||
recipeList.add(new MerchantRecipe(itemToBuy, randomComb));
|
||||
}
|
||||
}
|
||||
public static class GiveRandomHiveDroneForItems implements EntityVillager.ITradeList {
|
||||
@Nonnull
|
||||
public ItemStack buyingItemStack;
|
||||
@Nullable
|
||||
public EntityVillager.PriceInfo buyingPriceInfo;
|
||||
@Nonnull
|
||||
public ItemStack buyingItemStackTwo;
|
||||
@Nullable
|
||||
public EntityVillager.PriceInfo buyingPriceItemTwoInfo;
|
||||
|
||||
public GiveRandomHiveDroneForItems(
|
||||
@Nonnull ItemStack buyingItemStack,
|
||||
@Nullable EntityVillager.PriceInfo buyingPriceInfo,
|
||||
@Nonnull ItemStack buyingItemStackTwo,
|
||||
@Nullable EntityVillager.PriceInfo buyingPriceItemTwoInfo) {
|
||||
this.buyingItemStack = buyingItemStack;
|
||||
this.buyingPriceInfo = buyingPriceInfo;
|
||||
this.buyingItemStackTwo = buyingItemStackTwo;
|
||||
this.buyingPriceItemTwoInfo = buyingPriceItemTwoInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyMerchantRecipeList(@Nonnull MerchantRecipeList recipeList, @Nonnull Random random) {
|
||||
|
||||
int buyAmount = 1;
|
||||
if (this.buyingPriceInfo != null) {
|
||||
buyAmount = this.buyingPriceInfo.getPrice(random);
|
||||
}
|
||||
|
||||
int buyTwoAmount = 1;
|
||||
if (this.buyingPriceItemTwoInfo != null) {
|
||||
buyTwoAmount = this.buyingPriceItemTwoInfo.getPrice(random);
|
||||
}
|
||||
BeeDefinition [] forestryMundane = new BeeDefinition[] { BeeDefinition.FOREST, BeeDefinition.MEADOWS, BeeDefinition.MODEST, BeeDefinition.WINTRY, BeeDefinition.TROPICAL, BeeDefinition.MARSHY };
|
||||
ItemStack randomHiveDrone = forestryMundane[random.nextInt(forestryMundane.length)].getMemberStack(EnumBeeType.DRONE);
|
||||
ItemStack buyItemStack = this.buyingItemStack.copy();
|
||||
buyItemStack.stackSize = buyAmount;
|
||||
ItemStack buyItemStackTwo = this.buyingItemStackTwo.copy();
|
||||
buyItemStackTwo.stackSize = buyTwoAmount;
|
||||
recipeList.add(new MerchantRecipe(buyItemStack, buyItemStackTwo, randomHiveDrone));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,11 @@ package forestry.apiculture.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockApiculture extends BlockBase<BlockTypeApiculture> {
|
||||
public BlockApiculture(BlockTypeApiculture type) {
|
||||
super(type);
|
||||
super(type, Material.WOOD);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
@@ -36,7 +37,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
beeHouse = new BlockApiculture(BlockTypeApiculture.BEE_HOUSE);
|
||||
registerBlock(beeHouse, new ItemBlockForestry(beeHouse), "bee_house");
|
||||
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST);
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST, Material.WOOD);
|
||||
registerBlock(beeChest, new ItemBlockForestry(beeChest), "bee_chest");
|
||||
beeChest.setCreativeTab(Tabs.tabApiculture);
|
||||
beeChest.setHarvestLevel("axe", 0);
|
||||
|
||||
@@ -33,12 +33,8 @@ public enum BlockTypeApicultureTesr implements IBlockTypeTesr {
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, AxisAlignedBB boundingBox) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package forestry.apiculture.compat;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
|
||||
import forestry.core.genetics.Genome;
|
||||
import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@JEIPlugin
|
||||
public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
@@ -34,5 +37,21 @@ public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
registry.addDescription(new ItemStack(PluginApiculture.items.habitatLocator), "for.jei.description.habitat.locator");
|
||||
|
||||
registry.addDescription(new ItemStack(PluginApiculture.items.scoop), "for.jei.description.scoop");
|
||||
|
||||
ISubtypeRegistry subtypeRegistry = registry.getJeiHelpers().getSubtypeRegistry();
|
||||
subtypeRegistry.registerNbtInterpreter(PluginApiculture.items.beeDroneGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
subtypeRegistry.registerNbtInterpreter(PluginApiculture.items.beePrincessGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
subtypeRegistry.registerNbtInterpreter(PluginApiculture.items.beeQueenGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
}
|
||||
|
||||
private static class BeeSubtypeInterpreter implements ISubtypeRegistry.ISubtypeInterpreter {
|
||||
public static BeeSubtypeInterpreter INSTANCE = new BeeSubtypeInterpreter();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getSubtypeInfo(@Nonnull ItemStack itemStack) {
|
||||
IAlleleSpecies species = Genome.getSpeciesDirectly(BeeManager.beeRoot, itemStack);
|
||||
return species == null ? null : species.getUID();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class AIAvoidPlayers extends EntityAIBase {
|
||||
}
|
||||
|
||||
path = pathNavigator.getPathToXYZ(randomTarget.xCoord, randomTarget.yCoord, randomTarget.zCoord);
|
||||
return path != null && path.isDestinationSame(randomTarget);
|
||||
return path != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,94 +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.apiculture.entities;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
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.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
public class EntityBee extends EntityCreature implements IAnimals {
|
||||
|
||||
private static final String DEFAULT_TEXTURE = Constants.TEXTURE_PATH_ENTITIES + "/bees/honeyBee.png";
|
||||
|
||||
private IBee contained;
|
||||
private IAlleleBeeSpecies species;
|
||||
private EnumBeeType type = EnumBeeType.DRONE;
|
||||
|
||||
private String beeTexture = DEFAULT_TEXTURE;
|
||||
private long lastUpdate;
|
||||
|
||||
public EntityBee(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
private void resetAppearance() {
|
||||
beeTexture = species.getEntityTexture();
|
||||
}
|
||||
|
||||
public EntityBee setIndividual(IBee bee) {
|
||||
if (bee != null) {
|
||||
contained = bee;
|
||||
} else {
|
||||
contained = BeeManager.beeRoot.templateAsIndividual(BeeManager.beeRoot.getDefaultTemplate());
|
||||
}
|
||||
|
||||
//isImmuneToFire = contained.getGenome().getFireResist();
|
||||
setSpecies(contained.getGenome().getPrimary());
|
||||
//dataWatcher.updateObject(DATAWATCHER_ID_SPECIES, species.getUID());
|
||||
//dataWatcher.updateObject(DATAWATCHER_ID_SCALE, (int)(contained.getSize() * 100));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IBee getBee() {
|
||||
return contained;
|
||||
}
|
||||
|
||||
public EntityBee setType(EnumBeeType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EnumBeeType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public EntityBee setSpecies(IAlleleBeeSpecies species) {
|
||||
this.species = species;
|
||||
resetAppearance();
|
||||
lastUpdate = worldObj.getTotalWorldTime();
|
||||
return this;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ResourceLocation textureResource;
|
||||
private long lastTextureUpdate;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getTexture() {
|
||||
if (textureResource == null || lastTextureUpdate != lastUpdate) {
|
||||
textureResource = new ForestryResource(beeTexture);
|
||||
}
|
||||
|
||||
return textureResource;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -36,9 +37,12 @@ import forestry.core.config.Config;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
|
||||
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
|
||||
@Nonnull
|
||||
private static final IBeeModifier beeModifier = new ApiaryBeeModifier();
|
||||
@Nonnull
|
||||
private final IBeeListener beeListener = new ApiaryBeeListener(this);
|
||||
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
|
||||
@Nonnull
|
||||
private final InventoryApiary inventory = new InventoryApiary();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public EntityMinecartApiary(World world) {
|
||||
@@ -64,6 +68,7 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -10,17 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
@@ -36,10 +31,24 @@ import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IForestryPacketServer;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
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 net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IOwnedTile, IGuiBeeHousingInventory, IClimatised, IStreamableGui {
|
||||
private static final DataParameter<Optional<GameProfile>> OWNER = EntityDataManager.createKey(EntityMinecart.class, GameProfileDataSerializer.INSTANCE);
|
||||
|
||||
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IGuiBeeHousingInventory, IClimatised, IStreamableGui {
|
||||
private static final Random random = new Random();
|
||||
private static final int beeFXInterval = 4;
|
||||
private static final int pollenFXInterval = 50;
|
||||
@@ -49,6 +58,23 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
|
||||
|
||||
private final IBeekeepingLogic beeLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
|
||||
private final IErrorLogic errorLogic = ForestryAPI.errorStateRegistry.createErrorLogic();
|
||||
private final OwnerHandler ownerHandler = new OwnerHandler() {
|
||||
@Override
|
||||
public void setOwner(@Nonnull GameProfile owner) {
|
||||
super.setOwner(owner);
|
||||
dataManager.set(OWNER, Optional.of(owner));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
Optional<GameProfile> gameProfileOptional = dataManager.get(OWNER);
|
||||
if (gameProfileOptional.isPresent()) {
|
||||
return gameProfileOptional.get();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// CLIENT
|
||||
private int breedingProgressPercent = 0;
|
||||
@@ -63,6 +89,18 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
|
||||
super(world, posX, posY, posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataManager.register(OWNER, Optional.absent());
|
||||
}
|
||||
|
||||
/* IOwnedTile */
|
||||
@Override
|
||||
public IOwnerHandler getOwnerHandler() {
|
||||
return ownerHandler;
|
||||
}
|
||||
|
||||
/* IBeeHousing */
|
||||
@Override
|
||||
public IBeekeepingLogic getBeekeepingLogic() {
|
||||
@@ -111,7 +149,7 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
|
||||
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
return getAccessHandler().getOwner();
|
||||
return getOwnerHandler().getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,11 +212,13 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
|
||||
protected void readEntityFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
super.readEntityFromNBT(nbtTagCompound);
|
||||
beeLogic.readFromNBT(nbtTagCompound);
|
||||
ownerHandler.readFromNBT(nbtTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbtTagCompound) {
|
||||
super.writeEntityToNBT(nbtTagCompound);
|
||||
beeLogic.writeToNBT(nbtTagCompound);
|
||||
ownerHandler.writeToNBT(nbtTagCompound);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,7 +34,7 @@ import forestry.core.inventory.IInventoryAdapter;
|
||||
public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
|
||||
private static final IBeeListener beeListener = new DefaultBeeListener();
|
||||
private final InventoryBeeHousing beeInventory = new InventoryBeeHousing(9, getAccessHandler());
|
||||
private final InventoryBeeHousing beeInventory = new InventoryBeeHousing(9);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public EntityMinecartBeehouse(World world) {
|
||||
@@ -72,6 +73,7 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
return Collections.singleton(beeListener);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return beeInventory;
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*******************************************************************************
|
||||
* 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.entities;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
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.proxy.ProxyApicultureClient;
|
||||
|
||||
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);
|
||||
this.origin = origin;
|
||||
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.015;
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015;
|
||||
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.015;
|
||||
|
||||
particleRed = (color >> 16 & 255) / 255.0F;
|
||||
particleGreen = (color >> 8 & 255) / 255.0F;
|
||||
particleBlue = (color & 255) / 255.0F;
|
||||
|
||||
this.setSize(0.1F, 0.1F);
|
||||
this.particleScale *= 0.2F;
|
||||
this.particleMaxAge = (int) (80.0D / (Math.random() * 0.8D + 0.2D));
|
||||
|
||||
this.motionX *= 0.9D;
|
||||
this.motionY *= 0.015D;
|
||||
this.motionZ *= 0.9D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.moveEntity(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;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.25) {
|
||||
// venture out
|
||||
this.motionX *= 0.92 + 0.3D * rand.nextFloat();
|
||||
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.92 + 0.3D * rand.nextFloat();
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.5) {
|
||||
// slow down
|
||||
this.motionX *= 0.75 + 0.3D * rand.nextFloat();
|
||||
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.75 + 0.3D * rand.nextFloat();
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - 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.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
float maxV = 1;
|
||||
|
||||
if (this.particleTexture != null) {
|
||||
minU = particleTexture.getMinU();
|
||||
maxU = particleTexture.getMaxU();
|
||||
minV = particleTexture.getMinV();
|
||||
maxV = particleTexture.getMaxV();
|
||||
}
|
||||
|
||||
float f10 = 0.1F * particleScale;
|
||||
float f11 = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
|
||||
float f12 = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
|
||||
float f13 = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
@Override
|
||||
public int getBrightnessForRender(float p_189214_1_) {
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
// avoid calculating collisions
|
||||
@Override
|
||||
public void moveEntity(double x, double y, double z) {
|
||||
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
|
||||
this.resetPositionToBB();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+29
-27
@@ -12,30 +12,26 @@ package forestry.apiculture.entities;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ParticleBee extends Particle {
|
||||
private final double originX;
|
||||
private final double originY;
|
||||
private final double originZ;
|
||||
private final BlockPos destination;
|
||||
|
||||
public static TextureAtlasSprite beeSprite;
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
|
||||
public ParticleBee(World world, double x, double y, double z, int color, BlockPos destination) {
|
||||
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(beeSprite);
|
||||
this.originX = x;
|
||||
this.originY = y;
|
||||
this.originZ = z;
|
||||
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);
|
||||
this.origin = origin;
|
||||
|
||||
this.destination = destination;
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.015;
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015;
|
||||
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.015;
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.02 + 0.1 * rand.nextFloat();
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015 + 0.1 * rand.nextFloat();
|
||||
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.02 + 0.1 * rand.nextFloat();
|
||||
|
||||
particleRed = (color >> 16 & 255) / 255.0F;
|
||||
particleGreen = (color >> 8 & 255) / 255.0F;
|
||||
@@ -61,34 +57,34 @@ public class ParticleBee extends Particle {
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.particleAge == this.particleMaxAge / 2) {
|
||||
this.motionX = (this.originX - this.posX) * 0.03;
|
||||
this.motionY = (this.originY - this.posY) * 0.03;
|
||||
this.motionZ = (this.originZ - this.posZ) * 0.03;
|
||||
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();
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.25) {
|
||||
// venture out
|
||||
this.motionX *= 0.92 + 0.2D * rand.nextFloat();
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.92 + 0.2D * rand.nextFloat();
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.5) {
|
||||
// get to flower destination
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.03;
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.03;
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.1;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.03;
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (this.originY - this.posY) * 0.03;
|
||||
this.motionY = (origin.yCoord - 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 = (this.originX - this.posX) * 0.03;
|
||||
this.motionY = (this.originY - this.posY) * 0.03;
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (this.originZ - this.posZ) * 0.03;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
@@ -124,7 +120,13 @@ public class ParticleBee extends Particle {
|
||||
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();
|
||||
}
|
||||
|
||||
// avoid calculating collisions for bees, it is too much processing
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
@Override
|
||||
public int getBrightnessForRender(float p_189214_1_) {
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
// avoid calculating collisions
|
||||
@Override
|
||||
public void moveEntity(double x, double y, double z) {
|
||||
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
|
||||
@@ -0,0 +1,137 @@
|
||||
/*******************************************************************************
|
||||
* 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.entities;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
|
||||
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);
|
||||
|
||||
this.origin = origin;
|
||||
this.entity = entity;
|
||||
|
||||
this.motionX = (entity.posX - this.posX) * 0.015;
|
||||
this.motionY = (entity.posY + 1.62F - this.posY) * 0.015;
|
||||
this.motionZ = (entity.posZ - this.posZ) * 0.015;
|
||||
|
||||
particleRed = (color >> 16 & 255) / 255.0F;
|
||||
particleGreen = (color >> 8 & 255) / 255.0F;
|
||||
particleBlue = (color & 255) / 255.0F;
|
||||
|
||||
this.setSize(0.1F, 0.1F);
|
||||
this.particleScale *= 0.2F;
|
||||
this.particleMaxAge = (int) (80.0D / (Math.random() * 0.8D + 0.2D));
|
||||
|
||||
this.motionX *= 0.9D;
|
||||
this.motionY *= 0.9D;
|
||||
this.motionZ *= 0.9D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.moveEntity(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;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.5) {
|
||||
// fly near the entity
|
||||
this.motionX = (entity.posX - this.posX) * 0.09;
|
||||
this.motionX = (this.motionX + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionY = (entity.posY + 1.62F - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.4 * (-0.5 + rand.nextFloat())) / 4;
|
||||
this.motionZ = (entity.posZ - this.posZ) * 0.09;
|
||||
this.motionZ = (this.motionZ + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - 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.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
float maxV = 1;
|
||||
|
||||
if (this.particleTexture != null) {
|
||||
minU = particleTexture.getMinU();
|
||||
maxU = particleTexture.getMaxU();
|
||||
minV = particleTexture.getMinV();
|
||||
maxV = particleTexture.getMaxV();
|
||||
}
|
||||
|
||||
float f10 = 0.1F * particleScale;
|
||||
float f11 = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
|
||||
float f12 = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
|
||||
float f13 = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
@Override
|
||||
public int getBrightnessForRender(float p_189214_1_) {
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
// avoid calculating collisions
|
||||
@Override
|
||||
public void moveEntity(double x, double y, double z) {
|
||||
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
|
||||
this.resetPositionToBB();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -12,19 +12,15 @@ package forestry.apiculture.flowers;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public final class Flower {
|
||||
|
||||
private final Block block;
|
||||
private final int meta;
|
||||
private final IBlockState blockState;
|
||||
private Double weight;
|
||||
|
||||
public Flower(Block block, int meta, double weight) {
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
public Flower(IBlockState blockState, double weight) {
|
||||
this.blockState = blockState;
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
@@ -40,20 +36,16 @@ public final class Flower {
|
||||
|
||||
Flower flower = (Flower) obj;
|
||||
|
||||
return Block.isEqualTo(this.block, flower.getBlock()) && (this.meta == OreDictionary.WILDCARD_VALUE || flower.getMeta() == OreDictionary.WILDCARD_VALUE || this.meta == flower.getMeta());
|
||||
return this.blockState == flower.getBlockState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(block);
|
||||
return Objects.hashCode(blockState);
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
public IBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
public double getWeight() {
|
||||
@@ -66,7 +58,7 @@ public final class Flower {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("block", block).add("meta", meta).add("weight", weight).toString();
|
||||
return Objects.toStringHelper(this).add("blockState", blockState).add("weight", weight).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,19 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.genetics.ICheckPollinatable;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProvider implements IFlowerProvider {
|
||||
|
||||
@@ -42,15 +38,15 @@ public class FlowerProvider implements IFlowerProvider {
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, ICheckPollinatable pollinatable) {
|
||||
|
||||
EnumSet<EnumPlantType> plantTypes = pollinatable.getPlantType();
|
||||
EnumPlantType plantType = pollinatable.getPlantType();
|
||||
|
||||
switch (flowerType) {
|
||||
case FlowerManager.FlowerTypeNether:
|
||||
return plantTypes.contains(EnumPlantType.Nether);
|
||||
return plantType == EnumPlantType.Nether;
|
||||
case FlowerManager.FlowerTypeCacti:
|
||||
return plantTypes.contains(EnumPlantType.Desert);
|
||||
return plantType == EnumPlantType.Desert;
|
||||
default:
|
||||
return plantTypes.size() > 1 || !plantTypes.contains(EnumPlantType.Nether);
|
||||
return plantType != EnumPlantType.Nether;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,12 +13,9 @@ package forestry.apiculture.flowers;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -27,18 +24,12 @@ import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowerPot;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFlowerPot;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -50,7 +41,7 @@ import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.VectUtil;
|
||||
|
||||
public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelper {
|
||||
@@ -67,17 +58,19 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
FlowerManager.FlowerTypeGourd
|
||||
);
|
||||
|
||||
private final HashMultimap<String, IFlowerAcceptableRule> registeredRules; // custom check
|
||||
private final HashMultimap<String, Block> registeredBlocks; // quick first check
|
||||
private final HashMultimap<String, Flower> registeredFlowers; // full check
|
||||
private final HashMultimap<String, IFlowerAcceptableRule> registeredRules;
|
||||
private final HashMultimap<String, Block> acceptableBlocks;
|
||||
private final HashMultimap<String, IBlockState> acceptableBlockStates;
|
||||
private final HashMultimap<String, Flower> plantableFlowers;
|
||||
|
||||
private final ArrayListMultimap<String, IFlowerGrowthRule> growthRules;
|
||||
private final Map<String, TreeMap<Double, Flower>> chances;
|
||||
|
||||
public FlowerRegistry() {
|
||||
this.registeredRules = HashMultimap.create();
|
||||
this.registeredBlocks = HashMultimap.create();
|
||||
this.registeredFlowers = HashMultimap.create();
|
||||
this.acceptableBlocks = HashMultimap.create();
|
||||
this.acceptableBlockStates = HashMultimap.create();
|
||||
this.plantableFlowers = HashMultimap.create();
|
||||
this.growthRules = ArrayListMultimap.create();
|
||||
this.chances = new HashMap<>();
|
||||
|
||||
@@ -86,28 +79,40 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
|
||||
@Override
|
||||
public void registerAcceptableFlower(Block block, String... flowerTypes) {
|
||||
registerFlower(block, OreDictionary.WILDCARD_VALUE, 0.0, flowerTypes);
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (flowerType == null) {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + block);
|
||||
}
|
||||
|
||||
this.acceptableBlocks.get(flowerType).add(block);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAcceptableFlower(Block block, int meta, String... flowerTypes) {
|
||||
registerFlower(block, meta, 0.0, flowerTypes);
|
||||
public void registerAcceptableFlower(IBlockState blockState, String... flowerTypes) {
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (flowerType == null) {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + blockState);
|
||||
}
|
||||
|
||||
this.acceptableBlockStates.get(flowerType).add(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAcceptableFlowerRule(IFlowerAcceptableRule acceptableFlower, String... flowerTypes) {
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (flowerType == null) {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + acceptableFlower);
|
||||
}
|
||||
|
||||
registeredRules.put(flowerType, acceptableFlower);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPlantableFlower(Block block, int meta, double weight, String... flowerTypes) {
|
||||
registerFlower(block, meta, weight, flowerTypes);
|
||||
}
|
||||
|
||||
private void registerFlower(Block block, int meta, double weight, String... flowerTypes) {
|
||||
if (block == null) {
|
||||
public void registerPlantableFlower(IBlockState blockState, double weight, String... flowerTypes) {
|
||||
if (blockState == null) {
|
||||
return;
|
||||
}
|
||||
if (weight <= 0.0) {
|
||||
@@ -117,18 +122,22 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
weight = 1.0;
|
||||
}
|
||||
|
||||
Flower newFlower = new Flower(block, meta, weight);
|
||||
if (blockState.getBlock() == Blocks.AIR) {
|
||||
Log.error("Tried to register AIR as a flower. Bad idea.");
|
||||
}
|
||||
|
||||
Flower newFlower = new Flower(blockState, weight);
|
||||
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (flowerType == null) {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + block);
|
||||
throw new NullPointerException("Tried to register flower with null type. " + blockState);
|
||||
}
|
||||
|
||||
Set<Flower> flowers = this.registeredFlowers.get(flowerType);
|
||||
Set<Flower> flowers = this.plantableFlowers.get(flowerType);
|
||||
flowers.add(newFlower);
|
||||
|
||||
Set<Block> blocks = this.registeredBlocks.get(flowerType);
|
||||
blocks.add(block);
|
||||
Set<IBlockState> blocks = this.acceptableBlockStates.get(flowerType);
|
||||
blocks.add(blockState);
|
||||
|
||||
if (this.chances.containsKey(flowerType)) {
|
||||
this.chances.remove(flowerType);
|
||||
@@ -145,13 +154,9 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
@Override
|
||||
@Nonnull
|
||||
public List<BlockPos> getAcceptedFlowerCoordinates(IBeeHousing beeHousing, IBee bee, String flowerType, int maxFlowers) {
|
||||
if (!this.registeredFlowers.containsKey(flowerType)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<IFlowerAcceptableRule> acceptableRules = this.registeredRules.get(flowerType);
|
||||
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
|
||||
Set<Flower> acceptedFlowers = this.registeredFlowers.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);
|
||||
@@ -161,9 +166,14 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
BlockPos maxPos = minPos.add(area);
|
||||
|
||||
List<BlockPos> flowerCoords = new ArrayList<>();
|
||||
for (BlockPos.MutableBlockPos posBlock : BlockPos.getAllInBoxMutable(minPos, maxPos)) {
|
||||
for (BlockPos.MutableBlockPos posBlock : VectUtil.getAllInBoxFromCenterMutable(world, minPos, beeHousing.getCoordinates(), maxPos)) {
|
||||
IBlockState blockState = world.getBlockState(posBlock);
|
||||
if (blockState.getBlock().isAir(blockState, world, posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (IFlowerAcceptableRule acceptableRule : acceptableRules) {
|
||||
if (acceptableRule.isAcceptableFlower(flowerType, world, posBlock)) {
|
||||
if (acceptableRule.isAcceptableFlower(blockState, world, posBlock, flowerType)) {
|
||||
flowerCoords.add(posBlock.toImmutable());
|
||||
if (flowerCoords.size() >= maxFlowers) {
|
||||
return flowerCoords;
|
||||
@@ -171,7 +181,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
}
|
||||
}
|
||||
|
||||
if (isAcceptedFlower(acceptedBlocks, acceptedFlowers, world, posBlock)) {
|
||||
if (isAcceptedFlower(blockState, acceptedBlocks, acceptedBlockStates)) {
|
||||
flowerCoords.add(posBlock.toImmutable());
|
||||
if (flowerCoords.size() >= maxFlowers) {
|
||||
return flowerCoords;
|
||||
@@ -184,44 +194,23 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedFlower(String flowerType, World world, BlockPos pos) {
|
||||
if (!this.registeredFlowers.containsKey(flowerType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
Set<IFlowerAcceptableRule> acceptedCustom = this.registeredRules.get(flowerType);
|
||||
for (IFlowerAcceptableRule acceptableFlower : acceptedCustom) {
|
||||
if (acceptableFlower.isAcceptableFlower(flowerType, world, pos)) {
|
||||
if (acceptableFlower.isAcceptableFlower(blockState, world, pos, flowerType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
|
||||
Set<Flower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
Set<IBlockState> acceptedBlockStates = this.acceptableBlockStates.get(flowerType);
|
||||
Set<Block> acceptedBlocks = this.acceptableBlocks.get(flowerType);
|
||||
|
||||
return isAcceptedFlower(acceptedBlocks, acceptedFlowers, world, pos);
|
||||
return isAcceptedFlower(blockState, acceptedBlocks, acceptedBlockStates);
|
||||
}
|
||||
|
||||
private static boolean isAcceptedFlower(Set<Block> acceptedBlocks, Set<Flower> acceptedFlowers, World world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
private static boolean isAcceptedFlower(IBlockState blockState, Set<Block> acceptedBlocks, Set<IBlockState> acceptedBlockStates) {
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
final int meta;
|
||||
|
||||
if (block instanceof BlockFlowerPot) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
TileEntityFlowerPot tileFlowerPot = (TileEntityFlowerPot) tile;
|
||||
Item item = tileFlowerPot.getFlowerPotItem();
|
||||
block = Block.getBlockFromItem(item);
|
||||
meta = tileFlowerPot.getFlowerPotData();
|
||||
} else {
|
||||
if (!acceptedBlocks.contains(block)) {
|
||||
return false;
|
||||
}
|
||||
meta = block.getMetaFromState(blockState);
|
||||
}
|
||||
|
||||
Flower flower = new Flower(block, meta, 0);
|
||||
return acceptedFlowers.contains(flower);
|
||||
return acceptedBlocks.contains(block) || acceptedBlockStates.contains(blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,10 +228,6 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<Flower> getAcceptableFlowers(String flowerType) {
|
||||
return ImmutableSet.copyOf(this.registeredFlowers.get(flowerType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGrowthRule(IFlowerGrowthRule rule, String... flowerTypes) {
|
||||
if (rule == null) {
|
||||
@@ -260,15 +245,11 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
return chancesMap.get(chancesMap.lowerKey(rand.nextDouble() * maxKey));
|
||||
}
|
||||
|
||||
public Collection<String> getFlowerTypes() {
|
||||
return new ArrayList<>(Sets.union(defaultFlowerTypes, registeredFlowers.keySet()));
|
||||
}
|
||||
|
||||
private TreeMap<Double, Flower> getChancesMap(String flowerType) {
|
||||
if (!this.chances.containsKey(flowerType)) {
|
||||
TreeMap<Double, Flower> flowerChances = new TreeMap<>();
|
||||
double count = 0.0;
|
||||
for (Flower flower : this.registeredFlowers.get(flowerType)) {
|
||||
for (Flower flower : this.plantableFlowers.get(flowerType)) {
|
||||
if (flower.isPlantable()) {
|
||||
flowerChances.put(count, flower);
|
||||
count += flower.getWeight();
|
||||
@@ -282,8 +263,6 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
private void registerVanillaGrowthRules() {
|
||||
registerGrowthRule(new GrowthRuleDirtGrass(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
registerGrowthRule(new GrowthRuleSnow(), FlowerManager.FlowerTypeSnow);
|
||||
registerGrowthRule(new GrowthRuleFlowerPot(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms, FlowerManager.FlowerTypeCacti,
|
||||
FlowerManager.FlowerTypeJungle);
|
||||
registerGrowthRule(new GrowthRuleMycelium(), FlowerManager.FlowerTypeMushrooms);
|
||||
registerGrowthRule(new GrowthRuleNone(), FlowerManager.FlowerTypeEnd);
|
||||
registerGrowthRule(new GrowthRuleFertilize(Blocks.MELON_STEM, Blocks.PUMPKIN_STEM), FlowerManager.FlowerTypeGourd);
|
||||
@@ -293,6 +272,6 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
@Override
|
||||
public boolean plantRandomFlower(String flowerType, World world, BlockPos pos) {
|
||||
Flower flower = getRandomPlantableFlower(flowerType, world.rand);
|
||||
return world.setBlockState(pos, flower.getBlock().getStateFromMeta(flower.getMeta()), Constants.FLAG_BLOCK_SYNC);
|
||||
return world.setBlockState(pos, flower.getBlockState());
|
||||
}
|
||||
}
|
||||
@@ -1,79 +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.apiculture.flowers;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowerPot;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFlowerPot;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
|
||||
public class GrowthRuleFlowerPot implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
|
||||
return growFlower(flowerType, world, pos);
|
||||
}
|
||||
|
||||
private static boolean growFlower(String flowerType, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityFlowerPot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityFlowerPot flowerPotTile = (TileEntityFlowerPot) tile;
|
||||
if (flowerPotTile.getFlowerPotItem() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (!(block instanceof BlockFlowerPot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockFlowerPot flowerPot = (BlockFlowerPot) block;
|
||||
|
||||
int flower;
|
||||
switch (flowerType) {
|
||||
case FlowerManager.FlowerTypeVanilla:
|
||||
case FlowerManager.FlowerTypeSnow:
|
||||
flower = world.rand.nextInt(2) + 1;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeJungle:
|
||||
flower = 6;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeCacti:
|
||||
flower = world.rand.nextInt(2) + 9;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeMushrooms:
|
||||
flower = world.rand.nextInt(2) + 7;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityFlowerPot newTile = (TileEntityFlowerPot) flowerPot.createNewTileEntity(world, flower);
|
||||
|
||||
flowerPotTile.setFlowerPotData(newTile.getFlowerPotItem(), newTile.getFlowerPotData());
|
||||
flowerPotTile.markDirty();
|
||||
|
||||
if (!world.setBlockState(pos, world.getBlockState(pos).getBlock().getStateFromMeta(1), 2)) {
|
||||
world.markBlockRangeForRenderUpdate(pos, pos);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -251,6 +251,11 @@ public class BeeAlyzerPlugin implements IAlyzerPlugin {
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ItemStack> getIconStacks() {
|
||||
return iconStacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("beealyzer");
|
||||
|
||||
@@ -29,7 +29,7 @@ import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesBuilder;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -1035,7 +1035,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
BeeManager.beeRoot.registerTemplate(template);
|
||||
}
|
||||
|
||||
protected final IBeeMutationCustom registerMutation(BeeDefinition parent1, BeeDefinition parent2, int chance) {
|
||||
protected final IBeeMutationBuilder registerMutation(BeeDefinition parent1, BeeDefinition parent2, int chance) {
|
||||
return BeeManager.beeMutationFactory.createMutation(parent1.species, parent2.species, getTemplate(), chance);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,17 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
@@ -38,6 +33,9 @@ import forestry.core.genetics.Genome;
|
||||
import forestry.core.genetics.alleles.AlleleArea;
|
||||
import forestry.core.genetics.alleles.AlleleBoolean;
|
||||
import forestry.core.genetics.alleles.AlleleTolerance;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
public class BeeGenome extends Genome implements IBeeGenome {
|
||||
/**
|
||||
@@ -90,7 +88,7 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
return null;
|
||||
}
|
||||
|
||||
IAlleleSpecies species = getSpeciesDirectly(itemStack);
|
||||
IAlleleSpecies species = getSpeciesDirectly(BeeManager.beeRoot, itemStack);
|
||||
if (species instanceof IAlleleBeeSpecies) {
|
||||
return (IAlleleBeeSpecies) species;
|
||||
}
|
||||
|
||||
@@ -18,17 +18,23 @@ import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.mutations.Mutation;
|
||||
|
||||
public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
public class BeeMutation extends Mutation implements IBeeMutation, IBeeMutationBuilder {
|
||||
|
||||
public BeeMutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance) {
|
||||
super(bee0, bee1, result, chance);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBeeMutation build() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeRoot getRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
@@ -39,7 +45,7 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingPos = housing.getCoordinates();
|
||||
|
||||
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1);
|
||||
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1, housing);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -12,16 +12,16 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.apiculture.IBeeMutationFactory;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class BeeMutationFactory implements IBeeMutationFactory {
|
||||
|
||||
@Override
|
||||
public IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance) {
|
||||
IBeeMutationCustom mutation = new BeeMutation(parentBee0, parentBee1, result, chance);
|
||||
BeeManager.beeRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
public IBeeMutationBuilder createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance) {
|
||||
BeeMutation beeMutation = new BeeMutation(parentBee0, parentBee1, result, chance);
|
||||
BeeManager.beeRoot.registerMutation(beeMutation);
|
||||
return beeMutation;
|
||||
}
|
||||
}
|
||||
@@ -12,20 +12,12 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -53,6 +45,11 @@ import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.apiculture.BeekeepingLogic;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
public class BeeRoot extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@@ -252,10 +249,10 @@ public class BeeRoot extends SpeciesRoot implements IBeeRoot {
|
||||
/**
|
||||
* List of possible mutations on species alleles.
|
||||
*/
|
||||
private static final ArrayList<IBeeMutation> beeMutations = new ArrayList<>();
|
||||
private static final List<IBeeMutation> beeMutations = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Collection<IBeeMutation> getMutations(boolean shuffle) {
|
||||
public List<IBeeMutation> getMutations(boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(beeMutations);
|
||||
}
|
||||
@@ -371,7 +368,7 @@ public class BeeRoot extends SpeciesRoot implements IBeeRoot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType getKaryotypeKey() {
|
||||
public IChromosomeType getSpeciesChromosomeType() {
|
||||
return EnumBeeChromosome.SPECIES;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -47,7 +48,7 @@ public class DefaultBeeModelProvider implements IBeeModelProvider {
|
||||
}
|
||||
|
||||
models[beeType.ordinal()] = manager.getModelLocation(beeTypeNameBase);
|
||||
manager.registerVariant(item, new ResourceLocation("forestry:" + beeTypeNameBase));
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:" + beeTypeNameBase));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import forestry.api.apiculture.IJubilanceFactory;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public class JubilanceFactory implements IJubilanceFactory {
|
||||
@Override
|
||||
@@ -22,7 +21,7 @@ public class JubilanceFactory implements IJubilanceFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IJubilanceProvider getRequiresResource(Block block, int meta) {
|
||||
return new JubilanceRequiresResource(block, meta);
|
||||
public IJubilanceProvider getRequiresResource(IBlockState... acceptedBlockStates) {
|
||||
return new JubilanceRequiresResource(acceptedBlockStates);
|
||||
}
|
||||
}
|
||||
@@ -10,33 +10,40 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
|
||||
private final ItemStack blockRequired;
|
||||
private final Set<IBlockState> acceptedBlockStates = new HashSet<>();
|
||||
|
||||
public JubilanceRequiresResource(Block block, int meta) {
|
||||
this.blockRequired = new ItemStack(block, meta);
|
||||
public JubilanceRequiresResource(IBlockState... acceptedBlockStates) {
|
||||
Collections.addAll(this.acceptedBlockStates, acceptedBlockStates);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingCoords = housing.getCoordinates();
|
||||
BlockPos pos = housing.getCoordinates();
|
||||
|
||||
IBlockState state = world.getBlockState(housingCoords.down());
|
||||
return ItemStackUtil.equals(state, blockRequired);
|
||||
TileEntity tile;
|
||||
do {
|
||||
pos = pos.down();
|
||||
tile = world.getTileEntity(pos);
|
||||
} while (tile instanceof IBeeHousing && pos.getY() > 0);
|
||||
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
return this.acceptedBlockStates.contains(blockState);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -195,9 +195,4 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
public int getSpriteColour(int renderPass) {
|
||||
return beeSpriteColourProvider.getSpriteColour(renderPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTexture() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -105,16 +104,14 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
Vec3d origin = housing.getBeeFXCoordinates();
|
||||
IBeekeepingLogic beekeepingLogic = housing.getBeekeepingLogic();
|
||||
List<BlockPos> flowerPositions = beekeepingLogic.getFlowerPositions();
|
||||
|
||||
int beeColor = genome.getPrimary().getSpriteColour(0);
|
||||
Proxies.render.addBeeHiveFX(housing.getWorldObj(), origin.xCoord, origin.yCoord, origin.zCoord, beeColor, flowerPositions);
|
||||
Proxies.render.addBeeHiveFX(housing, genome, flowerPositions);
|
||||
return storedData;
|
||||
}
|
||||
|
||||
protected Vec3i getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
public static Vec3i getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1f);
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public class AlleleEffectCreeper extends AlleleEffectThrottled {
|
||||
}
|
||||
|
||||
float pitch = (1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F;
|
||||
world.playSound((EntityPlayer)null, housingCoords.getX(), housingCoords.getY(), housingCoords.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, pitch);
|
||||
world.playSound(null, housingCoords.getX(), housingCoords.getY(), housingCoords.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, pitch);
|
||||
storedData.setInteger(indexExplosionTimer, 2); // Set explosion timer
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package forestry.apiculture.genetics.alleles;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.EffectData;
|
||||
import forestry.core.utils.VectUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockMushroom;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraft.entity.passive.EntityMooshroom;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -11,12 +17,6 @@ import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.EffectData;
|
||||
|
||||
public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
|
||||
@@ -24,7 +24,7 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
private static final int ENTITY_THROTTLE = 6;
|
||||
|
||||
public AlleleEffectFungification() {
|
||||
super("mycophilic", true, 10, false, false);
|
||||
super("mycophilic", true, 20, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,50 +57,51 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingCoordinates = housing.getCoordinates();
|
||||
Vec3i area = getModifiedArea(genome, housing);
|
||||
|
||||
int blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX());
|
||||
int blockY = getRandomOffset(world.rand, housingCoordinates.getY(), area.getY());
|
||||
int blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ());
|
||||
|
||||
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
|
||||
BlockPos pos = new BlockPos(blockX, blockY, blockZ);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (isSuitableForMycelium(world, block, pos)) {
|
||||
world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState());
|
||||
break;
|
||||
} else if (isSuitableForGrowth(block)) {
|
||||
doMushroomGrowth(block, world, pos);
|
||||
break;
|
||||
}
|
||||
blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX());
|
||||
blockY = getRandomOffset(world.rand, housingCoordinates.getY(), area.getY());
|
||||
blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ());
|
||||
}
|
||||
Vec3i halfArea = new Vec3i(area.getX() / 2, area.getY() / 2, area.getZ() / 2);
|
||||
|
||||
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
|
||||
BlockPos pos = VectUtil.getRandomPositionInArea(world.rand, area).subtract(halfArea).add(housingCoordinates);
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
|
||||
if (convertToMycelium(world, blockState, pos)) {
|
||||
return;
|
||||
} else if (growGiantMushroom(world, blockState, pos)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void doEntityEffect(IBeeGenome genome, IBeeHousing housing) {
|
||||
List<EntityCow> cows = getEntitiesInRange(genome, housing, EntityCow.class);
|
||||
for (EntityCow cow : cows) {
|
||||
convertCowToMooshroom(cow);
|
||||
if (convertCowToMooshroom(cow)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int getRandomOffset(Random random, int centrePos, int offset) {
|
||||
return centrePos + random.nextInt(offset) - offset / 2;
|
||||
}
|
||||
|
||||
private static boolean isSuitableForMycelium(World world, Block block, BlockPos pos) {
|
||||
return block == Blocks.GRASS || block == Blocks.DIRT && world.canBlockSeeSky(pos);
|
||||
|
||||
private static boolean convertToMycelium(World world, IBlockState blockState, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
if (block == Blocks.GRASS || block == Blocks.DIRT && world.canBlockSeeSky(pos)) {
|
||||
world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isSuitableForGrowth(Block block) {
|
||||
return block == Blocks.RED_MUSHROOM || block == Blocks.BROWN_MUSHROOM;
|
||||
private static boolean growGiantMushroom(World world, IBlockState blockState, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
if (block instanceof BlockMushroom) {
|
||||
BlockMushroom mushroom = (BlockMushroom) block;
|
||||
mushroom.generateBigMushroom(world, pos, blockState, world.rand);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void convertCowToMooshroom(EntityCow cow) {
|
||||
|
||||
private static boolean convertCowToMooshroom(EntityCow cow) {
|
||||
if (cow instanceof EntityMooshroom) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
World worldObj = cow.worldObj;
|
||||
cow.setDead();
|
||||
@@ -110,14 +111,6 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
mooshroom.renderYawOffset = cow.renderYawOffset;
|
||||
worldObj.spawnEntityInWorld(mooshroom);
|
||||
worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, cow.posX, cow.posY + cow.height / 2.0F, cow.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
private static void doMushroomGrowth(Block block, World world, BlockPos pos) {
|
||||
WorldGenBigMushroom giantMushroomGenerator;
|
||||
|
||||
giantMushroomGenerator = new WorldGenBigMushroom(block);
|
||||
|
||||
world.setBlockToAir(pos);
|
||||
giantMushroomGenerator.generate(world, world.rand, pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ public class ContainerAlveary extends ContainerTile<TileAlveary> {
|
||||
public ContainerAlveary(InventoryPlayer player, TileAlveary tile) {
|
||||
super(tile, player, 8, 108);
|
||||
ContainerBeeHelper.addSlots(this, tile, false);
|
||||
|
||||
tile.getBeekeepingLogic().clearCachedValues();
|
||||
}
|
||||
|
||||
private int beeProgress = -1;
|
||||
|
||||
@@ -22,6 +22,8 @@ public class ContainerBeeHousing extends ContainerTile<TileBeeHousingBase> imple
|
||||
public ContainerBeeHousing(InventoryPlayer player, TileBeeHousingBase tile, boolean hasFrames) {
|
||||
super(tile, player, 8, 108);
|
||||
ContainerBeeHelper.addSlots(this, tile, hasFrames);
|
||||
|
||||
tile.getBeekeepingLogic().clearCachedValues();
|
||||
}
|
||||
|
||||
private int beeProgress = -1;
|
||||
|
||||
Loaded 100 of 548 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user