Compare commits

...
130 Commits
Author SHA1 Message Date
mezz 09756f21fd Fix grafter break sounds and animation on Forestry leaves
(no fix for vanilla leaves, the harvest event is fired server-side only)
2016-06-25 01:37:44 -07:00
mezz a06c4bd1dc Make grafter work on vanilla leaves 2016-06-25 01:36:33 -07:00
mezz bb477f0dfb Add tooltip for grafter use count on a new grafter 2016-06-25 00:34:51 -07:00
mezz 0b86b3df8f Buff the grafter slightly from 5 uses to 10 uses 2016-06-25 00:34:31 -07:00
mezz edd5357008 Make princess bee crown silver to stand out better 2016-06-25 00:23:24 -07:00
mezz dfb4e04f4a Update Forge 2016-06-25 00:04:26 -07:00
mezz 45c0375387 Fix bee particles becoming active at night when hive is opened 2016-06-25 00:04:11 -07:00
mezz 5e4cfa5112 Add oredict for charcoal 2016-06-25 00:03:16 -07:00
mezz 086b53e4a3 Add beetroot seeds to the squeezer for seed oil 2016-06-24 19:29:02 -07:00
mezz fbb5612b8c Slightly improve the look of larch bark 2016-06-24 19:21:54 -07:00
mezz c3c471ab33 Fix localization for backpack modes 2016-06-24 18:32:48 -07:00
mezz 67ddc252aa Stop Balsa leaves from generating infinitely downwards 2016-06-24 16:50:01 -07:00
mezz 59945a8961 Change name of "managed" farm to "automatic" 2016-06-24 16:40:57 -07:00
mezz bbabb967b1 Fix localization of latticed heath butterfly and ash pile 2016-06-24 16:34:52 -07:00
mezz 4cb1ee4cb1 Simply tree genomes, move charcoal properties to Species 2016-06-24 16:00:11 -07:00
mezz 95135544e2 Fix #1330 Fix resource checks for resources below an Alveary 2016-06-23 15:31:36 -07:00
mezz e34b71c13e Update dependencies 2016-06-23 14:51:32 -07:00
mezz cc8bcf384a Fix rare crash when getting rewards from escritoire 2016-06-23 14:51:12 -07:00
mezz 1f21952beb Fix #1328 Crash when trying to pick up wheat from Moistener process slot 2016-06-23 14:50:35 -07:00
mezz 1ed4ced65f Remove "useDepAts = true" in gradle, it's no longer needed for JEI's API 2016-06-23 02:54:25 -07:00
mezz beb74e635d Use JEI API jar at compile time 2016-06-23 02:34:50 -07:00
mezz 40c4fc5d1f Update for Minecraft 1.10 2016-06-23 02:19:36 -07:00
mezz 645dba903d Improve the look of cherry tree leaf generation 2016-06-22 21:14:38 -07:00
mezz 1ac4acdb47 Fix ebony trees growing offcenter from their saplings 2016-06-22 21:13:52 -07:00
mezz 74aa33e80c Remove all the saplings when a large tree grows 2016-06-22 21:13:35 -07:00
mezz 6f6b45abcf Add EnderIO compat for ice coolant and ethanol fuel 2016-06-22 19:00:05 -07:00
mezz 7297a6a5d3 Add ExtraUtils2 EnderLily compat for the farm 2016-06-22 18:40:07 -07:00
mezz 5ef76cffca Fix invalid recipes warning when BoP plugin is enabled 2016-06-22 16:19:40 -07:00
mezz 9284f84645 Fix pipette filling bug 2016-06-22 16:18:55 -07:00
mezz 85ba33e1ff Add trapdoorWood oredict name 2016-06-20 23:11:44 -07:00
mezz 9f5f5e7812 Fix network sync of item floating over Escritoire 2016-06-19 23:03:02 -07:00
mezz 8617c4a79f Properly center the item floating over the escritoire 2016-06-19 22:18:31 -07:00
mezz e9809238de Fix #1325 Null Pointer Exception from broken mailbox 2016-06-18 16:14:13 -07:00
mezz c0a22f4a28 Split mutationCustom into mutationBuilder and Mutation
Remove EntityBee
Update MutationConditionRequiresResource to use blockState
2016-06-17 15:20:19 -07:00
mezz 41c6fb15b3 Make escritoire convert vanilla saplings for analysis 2016-06-17 15:17:43 -07:00
mezz b5d65e83f0 Render floating sapling over Escritoire when in use 2016-06-17 15:17:43 -07:00
mezz 1a7c148a7e Update JEI 2016-06-16 18:55:53 -07:00
mezz ead630aa51 Clean up fluids a bit 2016-06-16 14:50:57 -07:00
mezz 85b71c785a Fix colored fluid drip particles 2016-06-16 14:43:18 -07:00
mezz 04cb58dfa2 Use FluidRegistry Water and Lava 2016-06-16 14:38:12 -07:00
mezz 3822e90ada Fix #1299 use dynamic textures for fluid containers 2016-06-16 14:03:30 -07:00
mezz af5cb93689 Use ModelBakery directly, less layers of abstraction 2016-06-16 13:58:03 -07:00
mezz 6a62024dd4 Fix wrench rotation handling 2016-06-15 16:26:57 -07:00
mezz bedb7ffe85 Fix the save bee stats command 2016-06-15 16:04:53 -07:00
mezz 4a21641bcd Fix backpacks trying to interact with inventories in a sided way 2016-06-15 16:04:38 -07:00
mezz 21d0b832b9 Fix crash when mods ask for the inventory without a specific side 2016-06-15 00:03:20 -07:00
mezz ce9081249f Fix compatibility with Chisels & Bits 2016-06-14 16:17:12 -07:00
mezz f6786cd44a Fix #1289 Trade station price can show a negative stack in catalog 2016-06-13 23:08:34 -07:00
mezz a045c18a89 Fix #1300 Crash in CharcoalPileRenderer with WAILA 2016-06-13 21:43:54 -07:00
mezz d6af85ad77 Fix #1314 Crash with WAILA when looking at broken leaves 2016-06-13 21:39:28 -07:00
mezz af55bd86a2 Fix #1322 JEI missing most squeezer recipes 2016-06-13 21:33:32 -07:00
mezz 7aa840282f Fix #1229 Squeezer Recipes in JEI do not show chance % 2016-06-13 21:32:19 -07:00
mezz a5d57c4788 Add villager name localization 2016-06-13 21:30:54 -07:00
mezz 4d0c2d1ea2 Fix all hives spawning with the same flower pattern around them 2016-06-13 20:46:23 -07:00
mezz 840331b7d5 Refresh bee errors when queen is replaced or gui is opened 2016-06-13 19:21:42 -07:00
mezz df91b47b35 Fix missing import for SoundEvent on chest 2016-06-13 15:28:01 -07:00
mezz f400241ff4 Revert greenhouse climate changes. Close #1319 2016-06-13 15:27:19 -07:00
Nedelosk 8639148f20 Fix #1318 1.9.4 Crash with .153 version on world load 2016-06-13 22:56:29 +02:00
Nedelosk 28e7b561ea Fix a bug 2016-06-13 22:14:03 +02:00
Nedelosk ba7ef4228c Update PluginBiomesOPlenty.java 2016-06-13 21:54:53 +02:00
Nedelosk fcd3ee6feb Merge branch 'mc-1.9.4' of https://github.com/ForestryMC/ForestryMC into Greenhouse-Climate-Fix 2016-06-13 21:49:05 +02:00
The-Fireplace 6ddc9f3079 Fixed chests playing the open sound when they close (#1316) 2016-06-12 14:09:31 -07:00
Nedelosk cc53894473 Finish work 2016-06-12 20:42:09 +02:00
Nedelosk 2cd76bdad7 Rework sytem 2016-06-12 01:16:25 +02:00
mezz 92eab8d47a Fix #1308 Restore compatibility with old fluid pipes 2016-06-09 18:35:12 -07:00
mezz 12f5d7be6c Revert "Fix rare possible npe in random hive trade"
This reverts commit 4ba3370fc9.
2016-06-09 16:36:32 -07:00
mezz ab88e7d57c Fix #1311 Crash with WAILA and butterfly or using butterfly kill command 2016-06-09 16:35:33 -07:00
Nedelosk 725d85181d Update System 2016-06-09 21:50:43 +02:00
Nedelosk 23c9b2071b Clen Up and work on climate system 2016-06-09 20:19:13 +02:00
Nedelosk ae025a92fc Clean Up, Work on climate system 2016-06-08 21:58:10 +02:00
Nedelosk fbf30b1a73 Work on new climate system for the greenhouse 2016-06-08 19:25:18 +02:00
Nirek-K 4ba3370fc9 Fix rare possible npe in random hive trade 2016-06-08 11:07:16 -05:00
mezz c1a590961d Cleanup unused fields 2016-06-07 23:40:58 -07:00
mezz a1f7a678c1 Use ForgeRegistries instead of Item and Block registries 2016-06-07 23:40:33 -07:00
mezz 1117b820f1 Update to latest version of JEI 2016-06-07 23:34:01 -07:00
mezz 4681bf4cfb Update Chinese localization 2016-06-07 23:33:05 -07:00
Nirek-K b9dd19a556 Make hive bee trade a random one 2016-06-07 23:49:05 -05:00
Nirek-K f97a737185 Migrate new 1.7 villager trades, fix ic2 uid 2016-06-07 20:18:36 -05:00
mezz 68fb27410e #1295 Add Forestry recipes to the RecipeSorter 2016-06-06 19:00:44 -07:00
mezz b8be42548e Use IconItemStack for farm logic icon 2016-06-05 23:04:48 -07:00
mezz eb9ef642cd Reenable IC2 support 2016-06-05 22:53:12 -07:00
mezz ed658301fd Clean up warnings 2016-06-05 21:40:52 -07:00
mezz d55d86a3c5 Fix #1272 villager house generation is intersecting with the road 2016-06-04 23:31:42 -07:00
mezz b2d5706bbd Stop calculating bee particle collisions 2016-06-04 22:40:27 -07:00
mezz ba6bd8fd10 Fix #1274 Broken fence localization 2016-06-04 21:49:08 -07:00
mezz b998e2ac49 Fix #1286 Crash when trying to break cocoons 2016-06-04 21:46:53 -07:00
mezz 817540d996 Fix #1285 Crash when Biogas Engine starts to burn fuel 2016-06-04 21:33:47 -07:00
mezz 9d8866e4fd Fix missing icons in Genetic Analyzer 2016-06-04 21:28:23 -07:00
mezz 7575b9c6ce Fix #1287 Some genetic traits have broken localization 2016-06-04 18:13:45 -07:00
Nedelosk 6700c511a5 Merge branch 'mc-1.9.4' of https://github.com/ForestryMC/ForestryMC into mc-1.9.4 2016-06-04 23:49:01 +02:00
Nedelosk acc55d4f41 Fix #1277 Transparent sprinkler(item) 2016-06-04 23:47:52 +02:00
mezz 7bd5bb120d Update for new fluid capabilities 2016-06-04 04:25:51 -07:00
Nedelosk dbbb727576 Add Fluid capability to the greenhouse hatch 2016-06-04 11:02:25 +02:00
mezz dcf0fc83ad Fix #1282 NullPointerException from Cocoon with invalid caterpillar 2016-06-04 01:03:13 -07:00
mezz 6ef91590cf Update Forge 2016-06-04 00:59:53 -07:00
mezz 856322b208 Update Forge to fix the crash with cactus placement and BoP grass 2016-06-03 17:29:54 -07:00
mezz 42425e3500 Fix #1281 Crash when trying to place Forestry tiles above Y=255 2016-06-03 16:35:06 -07:00
mezz cde076e702 Fix #1280 Bees can find flowers at very different Y levels in some cases 2016-06-03 16:30:27 -07:00
mezz b5f60d73e3 Fix #1278 Wild bees don't hurt if you wear any 1 piece of Apiarist gear 2016-06-03 16:19:45 -07:00
mezz f82d123b7f Fix #1273 Villagers unable to open forestry doors 2016-06-03 16:07:34 -07:00
mezz ca17801c86 Speed up the check for if a block position is currently in a greenhouse 2016-06-03 15:54:44 -07:00
mezz 33d1685713 Fix #1275 block placement lag when constructing a massive greenhouse 2016-06-03 15:26:57 -07:00
mezz 69c024811f Do not bake leaves based on position 2016-06-03 14:45:00 -07:00
Nedelosk 4dd95625e1 Fix #1244 Opening Greenhouse GUI causes a drop in fps, from 90fps to 6fps(in my case) 2016-06-03 23:11:52 +02:00
mezz 6adcde4a75 Fix NoClassDefFoundError: TextureAtlasSprite 2016-06-03 07:34:38 -07:00
mezz 2f06c777b2 Fix #1246 Greenhouse control redstone logic is inverted 2016-06-03 06:25:29 -07:00
mezz 32f295b16c Fix #1254 Chest bounding boxes are too large 2016-06-03 06:22:14 -07:00
mezz ef4c65c6e6 Fix some bee particles showing up as very dark 2016-06-03 06:09:56 -07:00
mezz ba313a9dfe Fix desync causing hives to have no active bees 2016-06-03 06:09:07 -07:00
mezz 8f36c2a6fc Route more bees to flowers than to exploring 2016-06-03 06:08:24 -07:00
mezz 149a5b6128 Update Forge 2016-06-03 06:08:04 -07:00
mezz 56b871eca1 Improve bee particle performance: do not render when too far away 2016-06-03 04:30:42 -07:00
mezz c09cdcdb64 Add more varied bee particles 2016-06-03 04:30:12 -07:00
mezz 2f66d0ea82 Fix hives only spawning Forest bees 2016-06-03 04:24:53 -07:00
mezz ac224823be Reduce random bee damage if you haven't hit the hive 2016-06-03 04:24:33 -07:00
mezz 1eca6e41af Improve bee particle performance 2016-06-02 17:16:15 -07:00
mezz 94bd65ee8e Improve greenhouse error messages. 2016-06-02 16:24:00 -07:00
mezz 795b154eb5 Fix #1263 Crash when lighting TNT on top of wood pile block 2016-06-02 13:19:41 -07:00
mezz 358e7853c2 Fix #1268 NoSuchMethodError on Server Startup 2016-06-02 11:40:24 -07:00
mezz 4f7b77abb4 Have bees find closest flowers instead of any in range 2016-06-02 03:05:21 -07:00
mezz aff15b34d6 Fix #1255 Relogging makes apiaries stop spawning bee particles 2016-06-02 02:56:43 -07:00
mezz 55cf7b5c16 Fix flower registry, remove config for now 2016-06-02 02:55:17 -07:00
mezz d4cfbe9f29 Comment out broken BoP compatibility 2016-06-02 02:54:01 -07:00
mezz 4fc731c7c8 Fix dungeon loot spawning without genetics 2016-06-02 02:53:34 -07:00
mezz bd2af7fa13 Fix Forestry's name to be uppercase 2016-06-01 22:54:12 -07:00
mezz f3d88fea3c Fix Backpack item registration in the API 2016-06-01 22:29:21 -07:00
Girafi 1d642cf9c5 Added backpack support for a bunch of vanilla items/blocks (#1265)
Added backpack support for more vanilla items/blocks
2016-06-01 19:30:45 -07:00
mezz b187815415 Fix #1264 Fireproof birch and spruce log texture are switched 2016-06-01 19:04:17 -07:00
mezz 5c7150ad62 Tweak changelog formatting 2016-06-01 17:59:19 -07:00
mezz d84f708a98 Fix curse info and changelog formatting 2016-06-01 17:37:48 -07:00
363 changed files with 4657 additions and 4837 deletions

No files matched your search

+5 -9
View File
@@ -40,7 +40,6 @@ targetCompatibility = 1.8
minecraft {
version = mcversion + "-" + forgeversion
runDir = "run"
useDepAts = true
mappings = mcp_mappings
replace '@VERSION@', project.version
@@ -66,9 +65,9 @@ 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 "mezz.jei:jei_${mcversion}:${jei_version}:api"
runtime "mezz.jei:jei_${mcversion}:${jei_version}"
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
}
configurations {
@@ -157,16 +156,14 @@ task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
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>
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}}} <small>- {{authorName}}</small></li>
<li>{{{message}}} - {{authorName}}</li>
{{/commits}}
</ul>
<br/>
<hr/>
{{/tags}}
"""
}
@@ -178,7 +175,6 @@ curseforge {
changelog = file('changelog.html')
changelogType = 'html'
releaseType = 'alpha'
addGameVersion '1.9' // works on 1.9 in addition to 1.9.4
}
}
+1
View File
@@ -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
+6 -5
View File
@@ -1,9 +1,10 @@
mcversion=1.9.4
forgeversion=12.17.0.1932-1.9.4
mcversion=1.10
forgeversion=12.18.0.1989-1.10.0
mcp_mappings=snapshot_20160525
jei_version=3.4.0.+
jei_version=3.7.0.+
ic2_version=2.5.5-ex19
version_major=5
version_minor=0
version_patch=1
version_minor=1
version_patch=5
+2 -2
View File
@@ -1,6 +1,6 @@
#Mon Sep 14 12:28:28 PDT 2015
#Tue Jun 21 15:23:47 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
+1 -1
Submodule lang updated: 53d7c93f90...2d88011e4a.
+4 -10
View File
@@ -46,18 +46,12 @@ 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,);")
public class Forestry {
@Mod.Instance(Constants.MOD_ID)
@@ -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,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);
}
@@ -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();
@@ -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();
}
@@ -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);
}
@@ -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();
}
@@ -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();
}
@@ -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.
@@ -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);
}
@@ -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);
@@ -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();
@@ -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);
}
@@ -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();
/**
@@ -18,7 +18,7 @@ import forestry.api.arboriculture.ITreeGenome;
public interface ITreeGenData {
int getGirth(World world, BlockPos pos);
int getGirth();
float getHeightModifier();
@@ -197,6 +197,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)) {
@@ -235,6 +237,15 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
}
}
@Override
public void clearCachedValues() {
if (!housing.getWorldObj().isRemote) {
hasFlowersCache.clear();
queenCanWorkCache.clear();
canWork();
}
}
private void queenWorkTick(IBee queen) {
if (queen == null) {
beeProgress = 0;
@@ -505,6 +516,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;
}
}
@@ -14,14 +14,13 @@ 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.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;
@@ -37,7 +36,7 @@ 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.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.SidedProxy;
@@ -47,7 +46,6 @@ 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 forestry.Forestry;
import forestry.api.apiculture.BeeManager;
@@ -70,8 +68,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 +91,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,11 +111,8 @@ 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;
@@ -135,16 +129,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 +198,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 +220,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);
@@ -310,9 +270,12 @@ public class PluginApiculture extends BlankForestryPlugin {
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 +285,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 +309,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 +323,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 +559,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 +570,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 +801,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 +846,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));
}
}
}
@@ -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.MOD_ID + ":blocks/" + name + ".0");
} else {
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_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;
}
}
@@ -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;
}
}
@@ -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;
@@ -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;
}
}
@@ -17,15 +17,7 @@ import java.util.Collections;
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 {
@@ -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
}
@@ -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;
@@ -21,6 +21,8 @@ public class ContainerMinecartBeehouse extends ContainerEntity<EntityMinecartBee
public ContainerMinecartBeehouse(InventoryPlayer player, EntityMinecartBeeHousingBase entity, boolean hasFrames) {
super(entity, player, 8, 108);
ContainerBeeHelper.addSlots(this, entity, hasFrames);
entity.getBeekeepingLogic().clearCachedValues();
}
private int beeProgress = -1;
@@ -12,10 +12,10 @@ package forestry.apiculture.inventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
import forestry.core.fluids.FluidHelper;
import forestry.core.inventory.InventoryAdapterTile;
public class InventoryHygroregulator extends InventoryAdapterTile<TileAlvearyHygroregulator> {
@@ -28,8 +28,8 @@ public class InventoryHygroregulator extends InventoryAdapterTile<TileAlvearyHyg
@Override
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
if (slotIndex == SLOT_INPUT) {
Fluid fluid = FluidHelper.getFluidInContainer(itemStack);
return tile.getTankManager().accepts(fluid);
FluidStack fluid = FluidUtil.getFluidContained(itemStack);
return tile.getTankManager().canFillFluidType(fluid);
}
return false;
}
@@ -57,7 +57,7 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
super.addInformation(stack, playerIn, tooltip, advanced);
beeModifier.addInformation(stack, playerIn, tooltip, advanced);
if (!stack.isItemDamaged()) {
tooltip.add(Translator.translateToLocalFormatted("item.for.frame.durability", stack.getMaxDamage()));
tooltip.add(Translator.translateToLocalFormatted("item.for.durability", stack.getMaxDamage()));
}
}
@@ -317,12 +317,13 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
@Override
public void formatDescriptionPacket(NBTTagCompound data) {
writeToNBT(data);
beekeepingLogic.syncToClient();
beekeepingLogic.writeToNBT(data);
}
@Override
public void decodeDescriptionPacket(NBTTagCompound data) {
readFromNBT(data);
beekeepingLogic.readFromNBT(data);
}
/* IActivatable */
@@ -17,10 +17,11 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import forestry.api.core.IClimateControlled;
import forestry.api.multiblock.IAlvearyComponent;
@@ -36,7 +37,7 @@ import forestry.core.fluids.tanks.FilteredTank;
import forestry.core.inventory.IInventoryAdapter;
import forestry.core.tiles.ILiquidTankTile;
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankTile, IFluidHandler, IAlvearyComponent.Climatiser {
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankTile, IAlvearyComponent.Climatiser {
private final HygroregulatorRecipe[] recipes;
private final TankManager tankManager;
@@ -50,12 +51,13 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
super(BlockAlvearyType.HYGRO);
this.inventory = new InventoryHygroregulator(this);
Fluid water = Fluids.WATER.getFluid();
Fluid lava = Fluids.LAVA.getFluid();
Fluid water = FluidRegistry.WATER;
Fluid lava = FluidRegistry.LAVA;
Fluid liquidIce = Fluids.ICE.getFluid();
this.liquidTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY, water, lava, liquidIce);
this.liquidTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY).setFilters(water, lava, liquidIce);
this.tankManager = new TankManager(this, liquidTank);
this.recipes = new HygroregulatorRecipe[]{new HygroregulatorRecipe(new FluidStack(water, 1), 1, 0.01f, -0.005f),
@@ -91,7 +93,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
currentRecipe = getRecipe(liquidTank.getFluid());
if (currentRecipe != null) {
liquidTank.drain(currentRecipe.liquid.amount, true);
liquidTank.drainInternal(currentRecipe.liquid.amount, true);
transferTime = currentRecipe.transferTime;
}
}
@@ -150,33 +152,22 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
}
@Override
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
return tankManager.fill(from, resource, doFill);
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
if (super.hasCapability(capability, facing)) {
return true;
}
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY;
}
@Override
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
return tankManager.drain(from, resource, doDrain);
}
@Override
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
return tankManager.drain(from, maxDrain, doDrain);
}
@Override
public boolean canFill(EnumFacing from, Fluid fluid) {
return tankManager.canFill(from, fluid);
}
@Override
public boolean canDrain(EnumFacing from, Fluid fluid) {
return tankManager.canDrain(from, fluid);
}
@Override
public FluidTankInfo[] getTankInfo(EnumFacing from) {
return tankManager.getTankInfo(from);
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if (super.hasCapability(capability, facing)) {
return super.getCapability(capability, facing);
}
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tankManager);
}
return null;
}
@Override
@@ -137,7 +137,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
int x = getPos().getX() + worldObj.rand.nextInt(40 * 2) - 40;
int z = getPos().getZ() + worldObj.rand.nextInt(40 * 2) - 40;
if (HiveDecorator.tryGenHive(worldObj, x, z, hive)) {
if (HiveDecorator.tryGenHive(worldObj, worldObj.rand, x, z, hive)) {
pendingSpawns.pop();
}
}
@@ -12,7 +12,4 @@ package forestry.apiculture.proxy;
public class ProxyApiculture {
public void initializeRendering() {
}
}
@@ -10,10 +10,10 @@
******************************************************************************/
package forestry.apiculture.proxy;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
public class ProxyApicultureClient extends ProxyApiculture {
@Override
public void initializeRendering() {
// TODO: remove unused bee entity model completely
}
public static TextureAtlasSprite beeSprite;
}
@@ -160,9 +160,4 @@ public class ModelBee extends ModelBase {
model.rotateAngleZ = z;
}
@Override
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}
@@ -1,44 +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.render;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import forestry.apiculture.entities.EntityBee;
import forestry.core.proxy.Proxies;
public class RenderBeeEntity extends RenderLiving {
private final ModelBee beeModel;
public RenderBeeEntity() {
super(Proxies.common.getClientInstance().getRenderManager(), new ModelBee(), 0.15f);
beeModel = (ModelBee) mainModel;
}
private void renderBee(EntityBee entity, double posX, double posY, double posZ, float par8, float par9) {
beeModel.setType(entity.getType());
this.doRender(entity, posX, posY, posZ, par8, par9);
}
@Override
public void doRender(EntityLiving entity, double x, double y, double z, float entityYaw, float partialTicks) {
renderBee((EntityBee) entity, x, y, z, entityYaw, partialTicks);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return ((EntityBee) entity).getTexture();
}
}
@@ -69,8 +69,15 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
@Nonnull
@Override
public NBTTagCompound getUpdateTag() {
beeLogic.syncToClient();
return super.getUpdateTag();
NBTTagCompound updateTag = super.getUpdateTag();
beeLogic.writeToNBT(updateTag);
return updateTag;
}
@Override
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
super.handleUpdateTag(tag);
beeLogic.readFromNBT(tag);
}
/* ICLIMATISED */
@@ -21,6 +21,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
@@ -74,7 +75,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
@Nonnull
private final IErrorLogic errorLogic;
private IBee containedBee = null;
private boolean active = true;
private boolean active = false;
private boolean angry = false;
private int calmTime;
@@ -97,7 +98,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
}
if (worldObj.isRemote) {
if (!updatedLight && worldObj.getWorldTime() % 20 == 0) {
if (!updatedLight && worldObj.getWorldTime() % 100 == 0) {
updatedLight = worldObj.checkLightFor(EnumSkyBlock.BLOCK, getPos());
}
if (active && worldObj.rand.nextInt(4) == 0) {
@@ -108,7 +109,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
} else {
boolean canWork = beeLogic.canWork(); // must be called every tick to stay updated
if (worldObj.rand.nextInt(angry ? 10 : 80) == 0) {
if (worldObj.rand.nextInt(angry ? 10 : 200) == 0) {
if (calmTime == 0) {
if (canWork) {
AxisAlignedBB boundingBox = AlleleEffect.getBounding(getContainedBee().getGenome(), this);
@@ -119,19 +120,13 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
attack(entity, 2);
}
beeLogic.doWork();
setActive(true);
} else {
setActive(false);
}
} else {
calmTime--;
if (calmTime == 0) {
setActive(true);
} else {
setActive(false);
}
}
}
setActive(calmTime == 0);
}
}
@@ -203,6 +198,11 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
setActive(false);
}
@Override
public boolean isAngry() {
return angry;
}
@Override
public void onAttack(World world, BlockPos pos, EntityPlayer player) {
if (calmTime == 0) {
@@ -231,8 +231,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
if (damage > 0) {
// Entities are not attacked if they wear a full set of apiarist's armor.
int count = BeeManager.armorApiaristHelper.wearsItems(entity, damageSourceBeeHive.damageType, true);
damage -= damage / 4.0f * count;
if (damage > 0) {
if (entity.worldObj.rand.nextInt(4) >= count) {
entity.attackEntityFrom(damageSourceBeeHive, damage);
}
}
@@ -258,8 +257,30 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
@Nullable
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
beeLogic.syncToClient();
return super.getUpdatePacket();
return new SPacketUpdateTileEntity(pos, 0, getUpdateTag());
}
@Nonnull
@Override
public NBTTagCompound getUpdateTag() {
NBTTagCompound nbt = super.getUpdateTag();
nbt.setBoolean("active", calmTime == 0);
beeLogic.writeToNBT(nbt);
return nbt;
}
@Override
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
super.handleUpdateTag(tag);
setActive(tag.getBoolean("active"));
beeLogic.readFromNBT(tag);
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
super.onDataPacket(net, pkt);
NBTTagCompound nbt = pkt.getNbtCompound();
handleUpdateTag(nbt);
}
@Override
@@ -13,6 +13,7 @@ package forestry.apiculture.worldgen;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
@@ -52,8 +53,8 @@ public final class Hive {
return hiveDescription.getGenChance();
}
public void postGen(World world, BlockPos pos) {
hiveDescription.postGen(world, pos);
public void postGen(World world, Random rand, BlockPos pos) {
hiveDescription.postGen(world, rand, pos);
}
public boolean isGoodBiome(Biome biome) {
@@ -34,7 +34,7 @@ import forestry.core.utils.Log;
public abstract class HiveDecorator {
private static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]);
private static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0]);
public static void decorateHives(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
if (!TerrainGen.populate(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated, EVENT_TYPE)) {
@@ -48,7 +48,7 @@ public abstract class HiveDecorator {
List<Hive> hives = PluginApiculture.hiveRegistry.getHives();
if (Config.generateBeehivesDebug) {
decorateHivesDebug(world, chunkX, chunkZ, hives);
decorateHivesDebug(world, rand, chunkX, chunkZ, hives);
return;
}
@@ -72,7 +72,7 @@ public abstract class HiveDecorator {
for (Hive hive : hives) {
if (hive.genChance() * Config.getBeehivesAmount() >= rand.nextFloat() * 100.0f) {
if (hive.isGoodBiome(biome) && hive.isGoodHumidity(humidity)) {
if (tryGenHive(world, x, z, hive)) {
if (tryGenHive(world, rand, x, z, hive)) {
return;
}
}
@@ -81,7 +81,7 @@ public abstract class HiveDecorator {
}
}
private static void decorateHivesDebug(World world, int chunkX, int chunkZ, List<Hive> hives) {
private static void decorateHivesDebug(World world, Random rand, int chunkX, int chunkZ, List<Hive> hives) {
int worldX = (chunkX << 4) + 8;
int worldZ = (chunkZ << 4) + 8;
Biome biome = world.getBiome(new BlockPos(chunkX, 0, chunkZ));
@@ -95,13 +95,13 @@ public abstract class HiveDecorator {
continue;
}
tryGenHive(world, worldX + x, worldZ + z, hive);
tryGenHive(world, rand, worldX + x, worldZ + z, hive);
}
}
}
}
public static boolean tryGenHive(World world, int x, int z, Hive hive) {
public static boolean tryGenHive(World world, Random rand, int x, int z, Hive hive) {
final BlockPos hivePos = hive.getPosForHive(world, x, z);
@@ -123,10 +123,10 @@ public abstract class HiveDecorator {
return false;
}
return setHive(world, hivePos, hive);
return setHive(world, rand, hivePos, hive);
}
private static boolean setHive(World world, BlockPos pos, Hive hive) {
private static boolean setHive(World world, Random rand, BlockPos pos, Hive hive) {
IBlockState hiveState = hive.getHiveBlockState();
Block hiveBlock = hiveState.getBlock();
boolean placed = world.setBlockState(pos, hiveState, Constants.FLAG_BLOCK_SYNC);
@@ -143,7 +143,7 @@ public abstract class HiveDecorator {
hiveBlock.onBlockAdded(world, pos, state);
if (!Config.generateBeehivesDebug) {
hive.postGen(world, pos);
hive.postGen(world, rand, pos);
}
if (Config.logHivePlacement) {
@@ -13,6 +13,7 @@ package forestry.apiculture.worldgen;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -41,23 +42,23 @@ public enum HiveDescription implements IHiveDescription {
FOREST(IHiveRegistry.HiveType.FOREST, 3.0f, BeeDefinition.FOREST, HiveManager.genHelper.tree()) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, flowerStates);
public void postGen(World world, Random rand, BlockPos pos) {
super.postGen(world, rand, pos);
postGenFlowers(world, rand, pos, flowerStates);
}
},
MEADOWS(IHiveRegistry.HiveType.MEADOWS, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, flowerStates);
public void postGen(World world, Random rand, BlockPos pos) {
super.postGen(world, rand, pos);
postGenFlowers(world, rand, pos, flowerStates);
}
},
DESERT(IHiveRegistry.HiveType.DESERT, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SAND, Blocks.SANDSTONE)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, cactusStates);
public void postGen(World world, Random rand, BlockPos pos) {
super.postGen(world, rand, pos);
postGenFlowers(world, rand, pos, cactusStates);
}
},
JUNGLE(IHiveRegistry.HiveType.JUNGLE, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
@@ -69,21 +70,21 @@ public enum HiveDescription implements IHiveDescription {
},
SNOW(IHiveRegistry.HiveType.SNOW, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW)) {
@Override
public void postGen(World world, BlockPos pos) {
public void postGen(World world, Random rand, BlockPos pos) {
BlockPos posAbove = pos.up();
if (world.isAirBlock(posAbove)) {
world.setBlockState(posAbove, Blocks.SNOW_LAYER.getDefaultState(), Constants.FLAG_BLOCK_SYNC);
}
postGenFlowers(world, pos, flowerStates);
postGenFlowers(world, rand, pos, flowerStates);
}
},
SWAMP(IHiveRegistry.HiveType.SWAMP, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
public void postGen(World world, Random rand, BlockPos pos) {
super.postGen(world, rand, pos);
postGenFlowers(world, pos, mushroomStates);
postGenFlowers(world, rand, pos, mushroomStates);
}
};
@@ -146,15 +147,15 @@ public enum HiveDescription implements IHiveDescription {
}
@Override
public void postGen(World world, BlockPos pos) {
public void postGen(World world, Random rand, BlockPos pos) {
}
protected static void postGenFlowers(World world, BlockPos hivePos, List<IBlockState> flowerStates) {
protected static void postGenFlowers(World world, Random rand, BlockPos hivePos, List<IBlockState> flowerStates) {
int plantedCount = 0;
for (int i = 0; i < 10; i++) {
int xOffset = world.rand.nextInt(8) - 4;
int zOffset = world.rand.nextInt(8) - 4;
int xOffset = rand.nextInt(8) - 4;
int zOffset = rand.nextInt(8) - 4;
BlockPos blockPos = hivePos.add(xOffset, 0, zOffset);
if ((xOffset == 0 && zOffset == 0) || !world.isBlockLoaded(blockPos)) {
continue;
@@ -165,7 +166,7 @@ public enum HiveDescription implements IHiveDescription {
continue;
}
IBlockState state = flowerStates.get(world.rand.nextInt(flowerStates.size()));
IBlockState state = flowerStates.get(rand.nextInt(flowerStates.size()));
Block block = state.getBlock();
if (!block.canPlaceBlockAt(world, blockPos)) {
continue;
@@ -12,6 +12,7 @@ package forestry.apiculture.worldgen;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@@ -68,7 +69,7 @@ public class HiveDescriptionSwarmer implements IHiveDescription {
}
@Override
public void postGen(World world, BlockPos pos) {
public void postGen(World world, Random rand, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileHive) {
((TileHive) tile).setContained(bees);
@@ -69,7 +69,6 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
private static final Random random = new Random();
private int averageGroundLevel = -1;
private boolean isInDesert = false;
private IBlockState planks;
private IBlockState slabs;
private IBlockState logs;
@@ -86,8 +85,6 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
public VillageApiaristHouse(StructureVillagePieces.Start startPiece, int componentType, Random random, StructureBoundingBox boundingBox, EnumFacing facing) {
super(startPiece, componentType, random, boundingBox, facing);
isInDesert = startPiece.inDesert;
createBuildingBlocks(random);
}
@@ -112,7 +109,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
}
public static VillageApiaristHouse buildComponent(StructureVillagePieces.Start startPiece, List<StructureComponent> par1List, Random random, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType) {
StructureBoundingBox bbox = StructureBoundingBox.getComponentToAddBoundingBox(structureMinX, structureMinY, structureMinZ, 0, 0, 0, 10, 9, 11, facing);
StructureBoundingBox bbox = StructureBoundingBox.getComponentToAddBoundingBox(structureMinX, structureMinY, structureMinZ, -4, 0, 0, 12, 9, 12, facing);
if (!canVillageGoDeeper(bbox) || StructureComponent.findIntersecting(par1List, bbox) != null) {
return null;
}
@@ -129,7 +126,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
return true;
}
boundingBox.offset(0, averageGroundLevel - boundingBox.maxY + 8 - 1, 0);
boundingBox.offset(0, averageGroundLevel - boundingBox.maxY + 9 - 1, 0);
}
fillWithBlocks(world, structBoundingBox, 1, 1, 1, 7, 4, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
@@ -280,7 +277,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
private void buildGarden(World world, StructureBoundingBox box) {
Block ground = Blocks.DIRT;
if (isInDesert) {
if (field_189928_h == 1) { // desert
ground = Blocks.SAND;
}
@@ -293,7 +290,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
private void plantFlowerGarden(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
if (isInDesert) {
if (field_189928_h == 1) { // desert
setBlockState(world, Blocks.CACTUS.getDefaultState(), 4, 1, 7, box);
return;
}
@@ -314,7 +311,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
Flower flower = flowerRegistry.getRandomPlantableFlower(FlowerManager.FlowerTypeVanilla, world.rand);
setBlockState(world, flower.getBlock().getStateFromMeta(flower.getMeta()), j, i, k, box);
setBlockState(world, flower.getBlockState(), j, i, k, box);
}
}
}
@@ -17,34 +17,12 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockNewLeaf;
import net.minecraft.block.BlockOldLeaf;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.IFuelHandler;
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 forestry.api.arboriculture.EnumForestryWoodType;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.EnumPileType;
import forestry.api.arboriculture.EnumVanillaWoodType;
import forestry.api.arboriculture.IAlleleFruit;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
@@ -56,6 +34,7 @@ import forestry.api.genetics.ISaplingTranslator;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.arboriculture.blocks.BlockForestryLeaves;
import forestry.arboriculture.blocks.BlockPile;
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
import forestry.arboriculture.blocks.log.BlockArbLog;
@@ -71,7 +50,7 @@ import forestry.arboriculture.genetics.alleles.AlleleFruit;
import forestry.arboriculture.genetics.alleles.AlleleGrowth;
import forestry.arboriculture.genetics.alleles.AlleleLeafEffect;
import forestry.arboriculture.items.ItemCharcoal;
import forestry.arboriculture.items.ItemGermlingGE;
import forestry.arboriculture.items.ItemGrafter;
import forestry.arboriculture.items.ItemRegistryArboriculture;
import forestry.arboriculture.models.TextureLeaves;
import forestry.arboriculture.network.PacketRegistryArboriculture;
@@ -96,6 +75,31 @@ import forestry.factory.recipes.FabricatorRecipe;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockNewLeaf;
import net.minecraft.block.BlockOldLeaf;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.IFuelHandler;
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;
@ForestryPlugin(pluginID = ForestryPluginUids.ARBORICULTURE, name = "Arboriculture", author = "Binnie & SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.arboriculture.description")
public class PluginArboriculture extends BlankForestryPlugin {
@@ -396,10 +400,11 @@ public class PluginArboriculture extends BlankForestryPlugin {
'Y', "chestWood");
//Wood Piles
for(ITree tree : TreeManager.treeRoot.getIndividualTemplates()){
ItemStack log = tree.getGenome().getPrimary().getWoodProvider().getWoodStack().copy();
for (ITree tree : TreeManager.treeRoot.getIndividualTemplates()) {
IAlleleTreeSpecies treeSpecies = tree.getGenome().getPrimary();
ItemStack log = treeSpecies.getWoodProvider().getWoodStack().copy();
log.stackSize = 1;
ItemStack woodPile = BlockPile.createWoodPile(tree);
ItemStack woodPile = BlockPile.createWoodPile(treeSpecies);
RecipeUtil.addShapelessRecipe(woodPile, log, log, log, log);
}
@@ -547,4 +552,31 @@ public class PluginArboriculture extends BlankForestryPlugin {
alleleFruit.getProvider().registerSprites();
}
}
@SubscribeEvent
public void onHarvestDropsEvent(BlockEvent.HarvestDropsEvent event) {
IBlockState state = event.getState();
Block block = state.getBlock();
if (block instanceof BlockLeaves && !(block instanceof BlockForestryLeaves)) {
EntityPlayer player = event.getHarvester();
if (player != null) {
ItemStack harvestingTool = player.getHeldItemMainhand();
if (harvestingTool != null && harvestingTool.getItem() instanceof ItemGrafter) {
if (event.getDrops().isEmpty()) {
World world = event.getWorld();
Item itemDropped = block.getItemDropped(state, world.rand, 3);
if (itemDropped != null) {
event.getDrops().add(new ItemStack(itemDropped, 1, block.damageDropped(state)));
}
}
harvestingTool.damageItem(1, player);
if (harvestingTool.stackSize <= 0) {
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, harvestingTool, EnumHand.MAIN_HAND);
player.setHeldItem(EnumHand.MAIN_HAND, null);
}
}
}
}
}
}
@@ -7,12 +7,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import forestry.api.arboriculture.EnumForestryWoodType;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.TreeManager;
@@ -22,6 +16,11 @@ import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IIndividual;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
public class VillagerArboristTrades {
@@ -120,7 +119,7 @@ public class VillagerArboristTrades {
j = this.emeraldPriceInfo.getPrice(random);
}
IChromosomeType treeSpeciesType = TreeManager.treeRoot.getKaryotypeKey();
IChromosomeType treeSpeciesType = TreeManager.treeRoot.getSpeciesChromosomeType();
Collection<IAllele> registeredSpecies = AlleleManager.alleleRegistry.getRegisteredAlleles(treeSpeciesType);
List<IAlleleSpecies> potentialSpecies = new ArrayList<>();
for (IAllele allele : registeredSpecies) {
@@ -11,6 +11,7 @@
package forestry.arboriculture;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
@@ -126,13 +127,22 @@ public class WoodAccess implements IWoodAccess {
private static void registerVanilla() {
IBlockState defaultLogState = Blocks.LOG.getDefaultState();
register(EnumVanillaWoodType.OAK, WoodBlockKind.LOG, false, defaultLogState.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK), new ItemStack(Blocks.LOG, 1, 0));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.LOG, false, defaultLogState.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.BIRCH), new ItemStack(Blocks.LOG, 1, 1));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.LOG, false, defaultLogState.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE), new ItemStack(Blocks.LOG, 1, 2));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.LOG, false, defaultLogState.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE), new ItemStack(Blocks.LOG, 1, 3));
List<EnumVanillaWoodType> oldLogTypes = Arrays.asList(EnumVanillaWoodType.OAK, EnumVanillaWoodType.SPRUCE, EnumVanillaWoodType.BIRCH, EnumVanillaWoodType.JUNGLE);
for (EnumVanillaWoodType woodType : oldLogTypes) {
BlockPlanks.EnumType vanillaType = woodType.getVanillaType();
ItemStack itemStack = new ItemStack(Blocks.LOG, 1, vanillaType.getMetadata());
IBlockState blockState = defaultLogState.withProperty(BlockOldLog.VARIANT, vanillaType);
register(woodType, WoodBlockKind.LOG, false, blockState, itemStack);
}
IBlockState defaultLog2State = Blocks.LOG2.getDefaultState();
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.LOG, false, defaultLog2State.withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA), new ItemStack(Blocks.LOG2, 1, 0));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.LOG, false, defaultLog2State.withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK), new ItemStack(Blocks.LOG2, 1, 1));
List<EnumVanillaWoodType> newLogTypes = Arrays.asList(EnumVanillaWoodType.ACACIA, EnumVanillaWoodType.DARK_OAK);
for (EnumVanillaWoodType woodType : newLogTypes) {
BlockPlanks.EnumType vanillaType = woodType.getVanillaType();
ItemStack itemStack = new ItemStack(Blocks.LOG2, 1, vanillaType.getMetadata() - 4);
IBlockState blockState = defaultLog2State.withProperty(BlockNewLog.VARIANT, vanillaType);
register(woodType, WoodBlockKind.LOG, false, blockState, itemStack);
}
IBlockState defaultPlanksState = Blocks.PLANKS.getDefaultState();
IBlockState defaultSlabState = Blocks.WOODEN_SLAB.getDefaultState();
@@ -149,29 +159,29 @@ public class WoodAccess implements IWoodAccess {
}
register(EnumVanillaWoodType.OAK, WoodBlockKind.FENCE, false, Blocks.OAK_FENCE.getDefaultState(), new ItemStack(Blocks.OAK_FENCE));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE, false, Blocks.BIRCH_FENCE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.FENCE, false, Blocks.SPRUCE_FENCE.getDefaultState(), new ItemStack(Blocks.SPRUCE_FENCE));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE, false, Blocks.BIRCH_FENCE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.FENCE, false, Blocks.JUNGLE_FENCE.getDefaultState(), new ItemStack(Blocks.JUNGLE_FENCE));
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.FENCE, false, Blocks.ACACIA_FENCE.getDefaultState(), new ItemStack(Blocks.ACACIA_FENCE));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.FENCE, false, Blocks.DARK_OAK_FENCE.getDefaultState(), new ItemStack(Blocks.DARK_OAK_FENCE));
register(EnumVanillaWoodType.OAK, WoodBlockKind.FENCE_GATE, false, Blocks.OAK_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.OAK_FENCE_GATE));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE_GATE, false, Blocks.BIRCH_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE_GATE));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.FENCE_GATE, false, Blocks.SPRUCE_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.SPRUCE_FENCE_GATE));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE_GATE, false, Blocks.BIRCH_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE_GATE));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.FENCE_GATE, false, Blocks.JUNGLE_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.JUNGLE_FENCE_GATE));
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.FENCE_GATE, false, Blocks.ACACIA_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.ACACIA_FENCE_GATE));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.FENCE_GATE, false, Blocks.DARK_OAK_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.DARK_OAK_FENCE_GATE));
register(EnumVanillaWoodType.OAK, WoodBlockKind.STAIRS, false, Blocks.OAK_STAIRS.getDefaultState(), new ItemStack(Blocks.OAK_STAIRS));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.STAIRS, false, Blocks.BIRCH_STAIRS.getDefaultState(), new ItemStack(Blocks.BIRCH_STAIRS));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.STAIRS, false, Blocks.SPRUCE_STAIRS.getDefaultState(), new ItemStack(Blocks.SPRUCE_STAIRS));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.STAIRS, false, Blocks.BIRCH_STAIRS.getDefaultState(), new ItemStack(Blocks.BIRCH_STAIRS));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.STAIRS, false, Blocks.JUNGLE_STAIRS.getDefaultState(), new ItemStack(Blocks.JUNGLE_STAIRS));
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.STAIRS, false, Blocks.ACACIA_STAIRS.getDefaultState(), new ItemStack(Blocks.ACACIA_STAIRS));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.STAIRS, false, Blocks.DARK_OAK_STAIRS.getDefaultState(), new ItemStack(Blocks.DARK_OAK_STAIRS));
register(EnumVanillaWoodType.OAK, WoodBlockKind.DOOR, false, Blocks.OAK_DOOR.getDefaultState(), new ItemStack(Items.OAK_DOOR));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.DOOR, false, Blocks.BIRCH_DOOR.getDefaultState(), new ItemStack(Items.BIRCH_DOOR));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.DOOR, false, Blocks.SPRUCE_DOOR.getDefaultState(), new ItemStack(Items.SPRUCE_DOOR));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.DOOR, false, Blocks.BIRCH_DOOR.getDefaultState(), new ItemStack(Items.BIRCH_DOOR));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.DOOR, false, Blocks.JUNGLE_DOOR.getDefaultState(), new ItemStack(Items.JUNGLE_DOOR));
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.DOOR, false, Blocks.ACACIA_DOOR.getDefaultState(), new ItemStack(Items.ACACIA_DOOR));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.DOOR, false, Blocks.DARK_OAK_DOOR.getDefaultState(), new ItemStack(Items.DARK_OAK_DOOR));
@@ -16,7 +16,9 @@ import java.util.Collections;
import java.util.Random;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
@@ -40,7 +42,7 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg
private final EnumForestryWoodType woodType;
public BlockArbDoor(EnumForestryWoodType woodType) {
super(MaterialArbWood.ARB_WOOD);
super(Material.WOOD);
this.woodType = woodType;
setHarvestLevel("axe", 0);
@@ -50,7 +52,7 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg
@Override
@SideOnly(Side.CLIENT)
public void registerModel(Item item, IModelManager manager) {
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
}
@@ -20,6 +20,7 @@ import net.minecraft.block.BlockPlanks.EnumType;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -59,11 +60,6 @@ public class BlockForestryFenceGate<T extends Enum<T> & IWoodType> extends Block
setCreativeTab(Tabs.tabArboriculture);
}
@Override
public Material getMaterial(IBlockState state) {
return MaterialArbWood.ARB_WOOD;
}
@Override
public boolean isFireproof() {
return fireproof;
@@ -124,7 +120,7 @@ public class BlockForestryFenceGate<T extends Enum<T> & IWoodType> extends Block
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
manager.registerItemModel(item, new WoodMeshDefinition(this));
}
}
@@ -16,6 +16,29 @@ import java.util.Collections;
import java.util.List;
import java.util.Random;
import com.mojang.authlib.GameProfile;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.IToolGrafter;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.TreeManager;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IToolScoop;
import forestry.api.core.Tabs;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IButterfly;
import forestry.arboriculture.LeafDecayHelper;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.core.blocks.IColoredBlock;
import forestry.core.blocks.propertys.UnlistedBlockAccess;
import forestry.core.blocks.propertys.UnlistedBlockPos;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.IGrowable;
@@ -40,9 +63,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
@@ -50,29 +70,6 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.IToolGrafter;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.TreeManager;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IToolScoop;
import forestry.api.core.Tabs;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IButterfly;
import forestry.arboriculture.LeafDecayHelper;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.core.blocks.IColoredBlock;
import forestry.core.blocks.propertys.UnlistedBlockAccess;
import forestry.core.blocks.propertys.UnlistedBlockPos;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.ItemStackUtil;
public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvider, IGrowable, IItemModelRegister, IColoredBlock {
public BlockForestryLeaves() {
@@ -137,17 +134,16 @@ public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvi
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getActiveItemStack());
float saplingModifier = 1.0f;
if (!world.isRemote) {
ItemStack held = player.inventory.getCurrentItem();
if (held != null && held.getItem() instanceof IToolGrafter) {
saplingModifier = ((IToolGrafter) held.getItem()).getSaplingModifier(held, world, player, pos);
held.damageItem(1, player);
if (held.stackSize <= 0) {
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, held, EnumHand.MAIN_HAND);
player.setHeldItem(EnumHand.MAIN_HAND, null);
}
ItemStack held = player.inventory.getCurrentItem();
if (held != null && held.getItem() instanceof IToolGrafter) {
saplingModifier = ((IToolGrafter) held.getItem()).getSaplingModifier(held, world, player, pos);
held.damageItem(1, player);
if (held.stackSize <= 0) {
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, held, EnumHand.MAIN_HAND);
player.setHeldItem(EnumHand.MAIN_HAND, null);
}
}
GameProfile playerProfile = player.getGameProfile();
List<ItemStack> leafDrops = getLeafDrop(world, playerProfile, pos, saplingModifier, fortune);
drops.set(leafDrops);
@@ -214,17 +210,16 @@ public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvi
@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
String speciesUid = TreeDefinition.Oak.getUID();
TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class);
if (leaves == null) {
return null;
if (leaves != null) {
ITree tree = leaves.getTree();
if (tree != null) {
speciesUid = tree.getGenome().getPrimary().getUID();
}
}
ITree tree = leaves.getTree();
if (tree == null) {
return null;
}
String speciesUid = tree.getGenome().getPrimary().getUID();
return Collections.singletonList(PluginArboriculture.blocks.getDecorativeLeaves(speciesUid));
}
@@ -7,6 +7,7 @@ import java.util.Collections;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -38,16 +39,11 @@ public class BlockForestryStairs<T extends Enum<T> & IWoodType> extends BlockSta
setHarvestLevel("axe", 0);
}
@Override
public Material getMaterial(IBlockState state) {
return MaterialArbWood.ARB_WOOD;
}
/* MODELS */
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
}
@@ -1,53 +1,17 @@
package forestry.arboriculture.blocks;
import com.google.common.collect.Lists;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.arboriculture.EnumGermlingType;
import com.google.common.collect.Lists;
import forestry.api.arboriculture.EnumPileType;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.IWoodProvider;
import forestry.api.arboriculture.TreeManager;
import forestry.api.core.IModelManager;
import forestry.api.core.ISpriteRegister;
@@ -73,6 +37,42 @@ import forestry.core.multiblock.MultiblockLogic;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleHelper;
import forestry.core.tiles.TileUtil;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Enchantments;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class BlockPile extends BlockStructure implements ITileEntityProvider, IStateMapperRegister, ISpriteRegister {
@@ -189,7 +189,7 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
@Override
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end){
List<RayTraceResult> list = Lists.<RayTraceResult>newArrayList();
List<RayTraceResult> list = Lists.newArrayList();
for (AxisAlignedBB axisalignedbb : getCollisionBoxList(this.getActualState(blockState, worldIn, pos)))
{
@@ -226,7 +226,7 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
}
private static List<AxisAlignedBB> getCollisionBoxList(IBlockState state){
List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
List<AxisAlignedBB> list = Lists.newArrayList();
EnumPilePosition position = state.getValue(PILE_POSITION);
if(position != EnumPilePosition.INTERIOR){
@@ -309,20 +309,22 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
float f2 = pos.getZ() + 0.5F;
float f3 = 0.52F;
float f4 = rand.nextFloat() * 0.6F - 0.3F;
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, f + f3 - 0.5, f1 + 0.5, f2 + f4, 0.0D, 0.0D, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, f + f3 - 0.5, f1 + 0.5, f2 + f4, 0.0D, 0.0D, 0.0D);
}
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List subItems) {
if(getPileType() == EnumPileType.WOOD){
List<ItemStack> woodPiles = new ArrayList();
for(ITree tree : TreeManager.treeRoot.getIndividualTemplates()) {
woodPiles.add(createWoodPile(tree));
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subItems) {
if (getPileType() == EnumPileType.WOOD) {
List<ItemStack> woodPiles = new ArrayList<>();
for (ITree tree : TreeManager.treeRoot.getIndividualTemplates()) {
IAlleleTreeSpecies treeSpecies = tree.getGenome().getPrimary();
ItemStack woodPile = createWoodPile(treeSpecies);
woodPiles.add(woodPile);
}
subItems.addAll(woodPiles);
}else if(getPileType() == EnumPileType.DIRT){
} else if (getPileType() == EnumPileType.DIRT) {
super.getSubBlocks(item, tab, subItems);
}
}
@@ -383,35 +385,50 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof ICharcoalPileComponent) {
ICharcoalPileComponent pile = (ICharcoalPileComponent) tile;
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
if (getPileType() == EnumPileType.ASH) {
if(pile.getTree() != null){
ItemStack charcoal = new ItemStack(PluginArboriculture.items.charcoal, pile.getTree().getGenome().getCarbonization(), pile.getTree().getGenome().getCombustibility());
list.add(charcoal);
list.add(new ItemStack(PluginCore.items.ash, 3));
}else{
list.add(new ItemStack(Blocks.DIRT, 2));
list.add(new ItemStack(PluginCore.items.ash, 2));
}
} else if (getPileType() == EnumPileType.DIRT) {
list.add(new ItemStack(this));
} else {
list.add(createWoodPile(pile.getTree()));
}
drop.set(list);
}
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getActiveItemStack());
drop.set(getPileDrop(world, pos, state, fortune));
}
}
@Nonnull
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
List<ItemStack> drops = drop.get();
drop.remove();
// not harvested, get drops normally
if (drops == null) {
drops = getPileDrop(world, pos, state, fortune);
}
return drops;
}
@Nonnull
private List<ItemStack> getPileDrop(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
List<ItemStack> list = new ArrayList<>();
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof ICharcoalPileComponent) {
ICharcoalPileComponent pile = (ICharcoalPileComponent) tile;
if (getPileType() == EnumPileType.ASH) {
if (pile.getTreeSpecies() != null) {
IWoodProvider woodProvider = pile.getTreeSpecies().getWoodProvider();
ItemStack charcoal = new ItemStack(PluginArboriculture.items.charcoal, woodProvider.getCarbonization(), woodProvider.getCombustibility());
list.add(charcoal);
list.add(new ItemStack(PluginCore.items.ash, 3));
} else {
list.add(new ItemStack(Blocks.DIRT, 2));
list.add(new ItemStack(PluginCore.items.ash, 2));
}
} else if (getPileType() == EnumPileType.DIRT) {
list.add(new ItemStack(this));
} else {
list.add(createWoodPile(pile.getTreeSpecies()));
}
}
return list;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
@@ -469,7 +486,7 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
if(getPileType() == EnumPileType.WOOD){
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof ICharcoalPileComponent) {
return createWoodPile(((ICharcoalPileComponent) tile).getTree());
return createWoodPile(((ICharcoalPileComponent) tile).getTreeSpecies());
}
}else if(getPileType() == EnumPileType.DIRT){
return super.getPickBlock(state, target, world, pos, player);
@@ -512,10 +529,19 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
IBlockState blockState = world.getBlockState(pos);
return ParticleHelper.addDestroyEffects(world, this, blockState, pos, effectRenderer, particleCallback);
}
public static ITree getTree(ItemStack stack){
public static IAlleleTreeSpecies getTreeSpecies(ItemStack stack) {
if (stack != null) {
return new Tree(stack.getTagCompound().getCompoundTag("ContainedTree"));
NBTTagCompound tagCompound = stack.getTagCompound();
// legacy
if (tagCompound.hasKey("ContainedTree")) {
ITree tree = new Tree(tagCompound.getCompoundTag("ContainedTree"));
return tree.getGenome().getPrimary();
}
String treeSpeciesUid = tagCompound.getString("TreeSpecies");
return (IAlleleTreeSpecies) AlleleManager.alleleRegistry.getAllele(treeSpeciesUid);
}
return null;
}
@@ -525,10 +551,9 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
if(getPileType() == EnumPileType.WOOD){
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof ICharcoalPileComponent) {
ITree tree = ((ICharcoalPileComponent)tile).getTree();
if(tree != null){
ItemStack wood = tree.getGenome().getPrimary().getWoodProvider().getWoodStack();
IAlleleTreeSpecies tree = ((ICharcoalPileComponent) tile).getTreeSpecies();
if (tree != null) {
ItemStack wood = tree.getWoodProvider().getWoodStack();
if(wood != null){
Block block = Block.getBlockFromItem(wood.getItem());
return block.getFlammability(world, pos, face);
@@ -544,10 +569,9 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
if(getPileType() == EnumPileType.WOOD){
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof ICharcoalPileComponent) {
ITree tree = ((ICharcoalPileComponent)tile).getTree();
IAlleleTreeSpecies tree = ((ICharcoalPileComponent) tile).getTreeSpecies();
if(tree != null){
ItemStack wood = tree.getGenome().getPrimary().getWoodProvider().getWoodStack();
ItemStack wood = tree.getWoodProvider().getWoodStack();
if(wood != null){
Block block = Block.getBlockFromItem(wood.getItem());
return block.getFireSpreadSpeed(world, pos, face);
@@ -564,11 +588,11 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
if(getPileType() == EnumPileType.WOOD){
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof ICharcoalPileComponent) {
ITree tree = ((ICharcoalPileComponent)tile).getTree();
IAlleleTreeSpecies tree = ((ICharcoalPileComponent) tile).getTreeSpecies();
if(tree != null){
ItemStack wood = tree.getGenome().getPrimary().getWoodProvider().getWoodStack();
if(wood != null){
ItemStack wood = tree.getWoodProvider().getWoodStack();
if (wood != null) {
Block block = Block.getBlockFromItem(wood.getItem());
return block.getStateFromMeta(wood.getMetadata()).getBlockHardness(world, pos);
}
@@ -577,14 +601,12 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
}
return super.getBlockHardness(blockState, world, pos);
}
public static ItemStack createWoodPile(ITree tree) {
if (tree != null) {
public static ItemStack createWoodPile(IAlleleTreeSpecies treeSpecies) {
if (treeSpecies != null) {
ItemStack stack = new ItemStack(PluginArboriculture.blocks.piles.get(EnumPileType.WOOD));
NBTTagCompound nbtTag = new NBTTagCompound();
tree.writeToNBT(nbtTag);
NBTTagCompound nbtItem = new NBTTagCompound();
nbtItem.setTag("ContainedTree", nbtTag);
nbtItem.setString("TreeSpecies", treeSpecies.getUID());
stack.setTagCompound(nbtItem);
return stack;
}
@@ -1,15 +0,0 @@
package forestry.arboriculture.blocks;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
public class MaterialArbWood extends Material {
public static final Material ARB_WOOD = new MaterialArbWood();
private MaterialArbWood() {
super(MapColor.WOOD);
setBurning();
}
}
@@ -12,6 +12,7 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
@@ -35,7 +36,6 @@ import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.blocks.MaterialArbWood;
import forestry.arboriculture.blocks.WoodTypeStateMapper;
import forestry.arboriculture.blocks.property.PropertyWoodType;
import forestry.core.proxy.Proxies;
@@ -48,7 +48,7 @@ public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends
private final int blockNumber;
protected BlockForestryFence(boolean fireproof, int blockNumber) {
super(MaterialArbWood.ARB_WOOD, BlockPlanks.EnumType.OAK.getMapColor());
super(Material.WOOD, BlockPlanks.EnumType.OAK.getMapColor());
this.fireproof = fireproof;
this.blockNumber = blockNumber;
@@ -104,7 +104,7 @@ public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
}
@@ -8,6 +8,7 @@ import net.minecraft.block.BlockLog;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
@@ -29,7 +30,6 @@ import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.blocks.MaterialArbWood;
import forestry.arboriculture.blocks.WoodTypeStateMapper;
import forestry.arboriculture.blocks.property.PropertyWoodType;
import forestry.core.proxy.Proxies;
@@ -67,11 +67,6 @@ public abstract class BlockForestryLog<T extends Enum<T> & IWoodType> extends Bl
return blockNumber;
}
@Override
public final Material getMaterial(IBlockState state) {
return MaterialArbWood.ARB_WOOD;
}
private static EnumAxis getAxis(int meta) {
switch (meta & 12) {
case 0:
@@ -187,7 +182,7 @@ public abstract class BlockForestryLog<T extends Enum<T> & IWoodType> extends Bl
@SideOnly(Side.CLIENT)
@Override
public final void registerModel(Item item, IModelManager manager) {
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
}
Loaded 100 of 363 files, more files were not shown because too many files have changed in this diff. Show more