Compare commits

...
101 Commits
Author SHA1 Message Date
Nedelosk 3de6e0c5b7 Bump version 2016-09-17 23:27:51 +02:00
Nedelosk 0f4ba8d8fa Clean Up 2016-09-17 23:26:58 +02:00
Nedelosk 9570d26c83 Fix #1429 [API-TreeManager] TreeManager doesn't work properly 2016-09-17 23:19:39 +02:00
Nedelosk 01dc4f2bfe Fix the alyzer plugin api 2016-09-17 23:18:53 +02:00
Nedelosk 80de4d6490 Fix #1427 Engines do not show RF/t output properly 2016-09-17 22:50:46 +02:00
Nedelosk 253e9f18ed Fix #1078 Adding a work Cycle for every pending product 2016-09-17 22:23:11 +02:00
Nedelosk bbda5c8ba9 Fix #1419 Disabled greenhouse in plugins (as they're buggy) and having crash with 'cocoon's 2016-09-17 22:00:53 +02:00
mezz c289590740 Bump version 2016-09-15 14:53:26 -07:00
mezz 714858be99 Fix cable connections with Engines 2016-09-15 14:53:19 -07:00
mezz 5bb60cad8a Bump version 2016-09-14 14:24:24 -07:00
mezz b8cf4ef1cf Update zh_CN.lang 2016-09-14 14:24:23 -07:00
mezz d35075d681 Prevent farms on a chunk edge from loading unloaded chunks 2016-09-14 14:23:06 -07:00
mezz 79c56311c2 Refactor Energy systems and make RF optional 2016-09-13 00:37:39 -07:00
mezz 77cea8a645 Add support for new Forge energy capability 2016-09-12 16:07:47 -07:00
Nedelosk ed00ca3158 Merge pull request #1407 from ForestryMC/Greenhouse
Adding Greenhouse Window, Climate Control,  Camouflage Spray Can and Improve Recipes
2016-09-12 18:00:45 +02:00
Nedelosk 418f00abf2 Merge branch 'mc-1.10' of https://github.com/ForestryMC/ForestryMC into mc-1.10 2016-09-12 14:47:01 +02:00
mezz 0fa8fdad39 Remove access-related hints and the power-required hint 2016-09-11 22:23:38 -07:00
Aroma1997 0a110eb761 Fix #1414 greenhouse climate blocks crash (#1418) 2016-09-11 13:27:27 -07:00
Nedelosk 9feb5cb114 Merge branch 'mc-1.10' of https://github.com/ForestryMC/ForestryMC into mc-1.10 2016-09-11 10:51:16 +02:00
Nirek-K 7aa44fb1fa Fix #1413 phospor should give lava 2016-09-03 22:36:33 -05:00
Nedelosk 84fa956ce4 Improve greenhouse glass 2016-08-24 14:38:54 +02:00
Nedelosk 0c14a85c31 Adding new recipes and improve other recipes 2016-08-24 14:03:09 +02:00
Nedelosk a20fbbe60f Adding Greenhouse windows and climate control and improve recipes 2016-08-24 00:33:53 +02:00
mezz 27d932ee34 Do not allow rain tanks to be filled from the bottom 2016-08-18 18:47:32 -07:00
mezz 52b1784f25 Close #1400 Reduce frequency of End Hives 2016-08-17 21:11:24 -07:00
mezz 154f4f2712 Close #1398 Make wild bees friendlier to endermen 2016-08-17 21:03:35 -07:00
mezz 806ca2cf7b Bump version 2016-08-16 16:50:19 -07:00
mezz 9f171977bb Add some more tooltips and JEI description pages 2016-08-16 16:50:00 -07:00
mezz 2031f7fe02 Unify the way item and itemBlock tooltips are added 2016-08-16 16:49:28 -07:00
mezz 4259a55e7a Close #955 Automatically output water from the bottom of the Rain Tank 2016-08-15 00:12:47 -07:00
mezz 065344ba5e Clean up Rain Tank implementation 2016-08-14 22:52:53 -07:00
mezz d0c9a77528 Update dependencies 2016-08-14 21:40:39 -07:00
Nedelosk 604429f267 Fix #1388 Rendering Crash in Inventory and a climate crash 2016-08-14 13:27:12 +02:00
Nedelosk f5a9dcccb8 Fix #1387 Crash when creating a new world 2016-08-14 00:42:20 +02:00
Nedelosk b056cce707 Fix the woodTextures 2016-08-13 17:47:23 +02:00
Nedelosk 1497aada57 Improve the woodtextures class. 2016-08-13 17:24:26 +02:00
Nedelosk fb8ddf54b7 Adding a way to add costum wood models 2016-08-13 17:16:38 +02:00
Nedelosk 9a05322d45 Fix a mistake 2016-08-12 21:57:47 +02:00
Nedelosk 8c2008b06c Bump version 2016-08-12 21:54:08 +02:00
Nedelosk e3cc08a624 Fix #1382 Crash on load wood models and clean up 2016-08-12 21:46:41 +02:00
Nedelosk 36cd4663d9 Fix a cocoon bug and add a default cocoon loot 2016-08-12 13:59:05 +02:00
Nedelosk a014ef6d14 Fix #1381 Greenhouse climate switches between normal and very high levels and fix a cocoon bug 2016-08-12 13:48:19 +02:00
Nedelosk 34fa218c38 Try to fix the greengouse climate ledget and fix the greenhouse sprinklers 2016-08-12 13:18:08 +02:00
Nedelosk f422b577fe Fix model baker models 2016-08-12 12:42:52 +02:00
Nedelosk e379465227 Fix #1380 Forestry camoflaged blocks do not render the same as regular blocks 2016-08-12 12:36:10 +02:00
Nedelosk eb63e75200 Add new Wood Model Loader (#1367) 2016-08-11 21:22:02 -07:00
Nedelosk b5faab51c3 Update greenhouse climate system and improve camouflage system (#1334) 2016-08-11 20:53:04 -07:00
mezz ddffe5d4ce Bump version 2016-08-11 02:45:57 -07:00
mezz f59e57aa6a Fix loot table for storage plugin 2016-08-11 02:44:47 -07:00
mezz ae8cbf2ff2 Update Forge 2016-08-11 02:44:34 -07:00
mezz 305f3f78ec Update JEI 2016-08-11 02:44:25 -07:00
mezz 98e506cc4a Close #1269 Buff Peat balance vs Charcoal 2016-08-03 03:15:48 -07:00
mezz ecfb11c096 Encapsulate fields of fuels in the API 2016-08-03 02:52:18 -07:00
mezz 6b59736ffe Fix #1369 Add button click noise to various buttons 2016-08-03 02:36:28 -07:00
mezz a3a1f7720e Fix #1371 IC2 Rubber farm does not harvest rubber properly 2016-08-03 02:21:27 -07:00
bdew 89cfbfca9c Allow overriding climate when checking for mutations (#1373)
* Allow overriding climate when checking for mutations
2016-08-02 14:22:05 -07:00
mezz e0676030d6 Update Forge 2016-08-01 18:17:28 -07:00
mezz 0c76e22b8a Fix #1368 Update Tesla API 2016-08-01 18:16:51 -07:00
mezz 1a8f1751d9 Fix #1366 Alveary in the Nether does not have Hellish temperature 2016-07-31 17:24:18 -07:00
Nedelosk b95bb8315f Fix #1363 [MC 1.10.2] Crash on camouflaging greenhouse bricks 2016-07-24 12:49:17 +02:00
mezz 2cc2540bdc Fix #1362 Crash on Startup when disabling Lepidopterology module 2016-07-23 03:43:42 -07:00
Nedelosk 84af238d82 Fix #1298 Bio Generator has incorrect hitbox 2016-07-23 01:50:11 +02:00
Nedelosk 89960db2bd Fix #1251 Sprinkler's and cocoons's bounding box is not visable 2016-07-23 01:32:16 +02:00
Nedelosk c5f53bda3e Fix #1288 Broken Cocoon texture when colliding with player 2016-07-23 01:08:42 +02:00
Nedelosk 2e1b62e58d Fix #1223 Suvirvalist's Pickaxe 2016-07-23 00:50:49 +02:00
Nedelosk 982aefa165 Add a way to add custom crate content models 2016-07-22 23:14:14 +02:00
Nedelosk 2cccf95775 Fix #1360 1.10 Some items crash rendering when NBT data is missing 2016-07-22 22:34:09 +02:00
mezz 1969ed8b09 Close #1358 Change "Portable Alyzer" to "Portable Analyzer" 2016-07-21 23:44:03 -07:00
mezz c3fc490fac Fix #1355 Crash from Boggy bees 2016-07-21 22:53:58 -07:00
mezz 59687329fb Replace IBackpackFilter with Predicate<ItemStack> 2016-07-20 15:24:05 -07:00
mezz 94f751d78a Improve backpack API and add backpack config blacklists 2016-07-20 02:25:32 -07:00
mezz f6feca096f Remove unused icons from TextureManager 2016-07-19 17:41:50 -07:00
mezz 649f38efb8 Fix Escritoire renderer leaking the world object by keeping a reference 2016-07-19 16:03:30 -07:00
mezz e4e221b9fd Fix butterfly items rendering too low 2016-07-19 16:03:08 -07:00
Nedelosk d7f063eec8 Update EntityButterfly.java 2016-07-17 12:40:47 +02:00
mezz aa988a3be7 Make honeyed slice more appetizing looking 2016-07-15 17:10:40 -07:00
mezz 18f2a027bc Remove unused bucket icons 2016-07-13 22:24:33 -07:00
mezz 7ca34e52d6 Update icons that use cans or capsules 2016-07-13 22:23:26 -07:00
mezz 7f83b5b909 Change portable alyzer icon to 16x 2016-07-13 22:09:44 -07:00
mezz 641f763d05 Add tooltips and JEI descriptions for CircuitBoard, SolderingIron, Tubes 2016-07-13 21:35:27 -07:00
mezz 0df85063a1 Remove "requires discovery" and limits from electron tubes 2016-07-13 21:34:37 -07:00
mezz 550b0dc3f5 Add zombie villager textures 2016-07-13 21:34:37 -07:00
Nedelosk 96a7b688c0 Fix the jar 2016-07-13 19:34:56 +02:00
Nedelosk 8f6c2baba6 Update README.md 2016-07-13 19:20:30 +02:00
mezz 523a8da908 Fix #1348 support for IC2 in 1.10.2 2016-07-10 18:43:58 -07:00
mezz cd10500a17 Fix crash when there is snow in the way of the farm 2016-07-10 18:34:31 -07:00
mezz 6d9211ada1 Remove block access restrictions 2016-07-06 02:00:02 -07:00
mezz 003ca9273d Fix beekeeper vaillager's collar color 2016-07-05 22:13:58 -07:00
mezz 28f65f13a5 Fix worktable bug that could delete container items 2016-07-05 21:57:23 -07:00
mezz 21ee0947d7 Fix isOp permissions check 2016-07-05 21:01:54 -07:00
mezz 1e11992de2 Fix #1333 Stop wild hive bees from attacking passive animals 2016-07-03 23:05:46 -07:00
mezz d690a38fa2 Fix #1340 Rare NPE from BeekeepingLogic.queenWorkTick 2016-07-03 22:16:12 -07:00
mezz 46eb29cf28 Fix #1342 Crash when giving multifarm control a redstone signal 2016-07-03 20:59:26 -07:00
mezz fb01d3ffaa Update IC2 2016-07-03 12:38:47 -07:00
mezz e676a73a7c Fix doors not showing correctly in TheOneProbe 2016-07-01 22:41:29 -07:00
mezz 6e348dbc5d Add support for Tesla power 2016-06-30 16:54:57 -07:00
mezz 39114ec429 Tidy up capabilities 2016-06-30 16:26:36 -07:00
mezz 3b82fe3bd0 Update to Minecraft 1.10.2 2016-06-30 16:22:15 -07:00
mezz 2667334252 Increase chances of getting a research note on the escritoire 2016-06-28 13:56:28 -07:00
mezz be39e2c3c3 Only list mutations for the primary species in the handheld Alyzer 2016-06-28 13:51:15 -07:00
mezz 40eece7d77 Fix bee carts dropping invalid item when broken 2016-06-28 13:01:39 -07:00
1442 changed files with 10034 additions and 15404 deletions

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ Forestry is a modification for the game Minecraft and known primarily for its fa
[Wiki](http://forestry.sengir.net/)
[Latest Builds for 1.9](http://jenkins.ic2.player.to/job/Forestry_5/)
[Latest Builds for 1.10 / 1.10.2](http://jenkins.ic2.player.to/job/Forestry_5/)
[IRC #forestry on esper.net](http://webchat.esper.net/?nick=ForestryGithub...&channels=forestry&prompt=1)
+5 -7
View File
@@ -55,6 +55,9 @@ sourceSets {
}
repositories {
maven {
url 'http://maven.epoxide.xyz'
}
maven {
url "http://dvs1.progwml6.com/files/maven"
}
@@ -65,6 +68,7 @@ repositories {
}
dependencies {
deobfCompile "net.darkhax.tesla:Tesla:${tesla_version}"
deobfCompile "mezz.jei:jei_${mcversion}:${jei_version}:api"
runtime "mezz.jei:jei_${mcversion}:${jei_version}"
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
@@ -104,13 +108,7 @@ allprojects {
}
jar {
// Copy redstone api into the jar, should shade this as a maven dep...
from (sourceSets.api.allSource) {
include 'cofh/**/*.txt'
}
from (sourceSets.api.output.classesDir) {
include 'cofh/**/*.*'
}
}
task sourcesJar(type: Jar) {
+7 -6
View File
@@ -1,10 +1,11 @@
mcversion=1.10
forgeversion=12.18.0.1989-1.10.0
mcversion=1.10.2
forgeversion=12.18.1.2080
mcp_mappings=snapshot_20160525
jei_version=3.7.0.+
ic2_version=2.5.5-ex19
tesla_version=1.10.2-1.2.1.42
jei_version=3.8.1.242
ic2_version=2.6.38-ex110
version_major=5
version_minor=1
version_patch=6
version_minor=2
version_patch=12
+2 -2
View File
@@ -1,6 +1,6 @@
#Tue Jun 21 15:23:47 PDT 2016
#Mon Sep 14 12:28:28 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
+1 -1
Submodule lang updated: 2d88011e4a...a31d99f6f6.
+6 -2
View File
@@ -12,6 +12,7 @@ package forestry;
import java.io.File;
import forestry.plugins.compat.PluginIC2;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
@@ -27,6 +28,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
import forestry.api.core.ForestryAPI;
import forestry.core.EventHandlerCore;
import forestry.core.climate.ClimateEventHandler;
import forestry.core.config.Config;
import forestry.core.config.Constants;
import forestry.core.config.GameMode;
@@ -50,8 +52,9 @@ import forestry.plugins.PluginManager;
version = Constants.VERSION,
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
acceptedMinecraftVersions = "[1.10]",
dependencies = "required-after:Forge@[12.18.0.1989,);"
+ "after:JEI@[3.7.0,);")
dependencies = "required-after:Forge@[12.18.1.2080,);"
+ "after:JEI@[3.8.0,);"
+ "after:" + PluginIC2.modId + ";")
public class Forestry {
@Mod.Instance(Constants.MOD_ID)
@@ -76,6 +79,7 @@ public class Forestry {
EventHandlerCore eventHandlerCore = new EventHandlerCore();
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
MinecraftForge.EVENT_BUS.register(new ClimateEventHandler());
configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID);
Config.load();
@@ -5,18 +5,17 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nonnull;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.climate.IClimateProvider;
import forestry.api.core.IErrorLogicSource;
import forestry.api.genetics.IHousing;
public interface IBeeHousing extends IHousing, IErrorLogicSource {
public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvider {
/**
* Used by BeeManager.beeRoot.createBeeHousingModifier(IBeeHousing housing)
@@ -32,14 +31,11 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
*/
Iterable<IBeeListener> getBeeListeners();
@Nonnull
IBeeHousingInventory getBeeInventory();
IBeekeepingLogic getBeekeepingLogic();
EnumTemperature getTemperature();
EnumHumidity getHumidity();
int getBlockLightValue();
boolean canBlockSeeTheSky();
@@ -47,8 +43,6 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
World getWorldObj();
Biome getBiome();
GameProfile getOwner();
/**
@@ -3,7 +3,7 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@API(apiVersion = "4.8.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
package forestry.api.apiculture;
import net.minecraftforge.fml.common.API;
@@ -92,11 +92,38 @@ public enum EnumForestryWoodType implements IWoodType {
return VALUES[meta];
}
@Override
public int getCarbonization() {
return carbonization;
}
@Override
public int getCombustability() {
return combustability;
}
@Override
public String getPlankTexture() {
return "forestry:blocks/wood/planks." + getName();
}
@Override
public String getDoorLowerTexture() {
return "forestry:blocks/doors/" + getName() + "_lower";
}
@Override
public String getDoorUpperTexture() {
return "forestry:blocks/doors/" + getName() + "_upper";
}
@Override
public String getBarkTexture() {
return "forestry:blocks/wood/bark." + getName();
}
@Override
public String getHeartTexture() {
return "forestry:blocks/wood/heart." + getName();
}
}
@@ -71,4 +71,44 @@ public enum EnumVanillaWoodType implements IWoodType {
public int getCombustability() {
return combustability;
}
@Override
public String getPlankTexture() {
if(this == DARK_OAK){
return "blocks/planks_big_oak";
}
return "blocks/planks_" + getName();
}
@Override
public String getDoorLowerTexture() {
if(this == OAK){
return "blocks/door_wood_lower";
}
return "blocks/door_wood_lower";
}
@Override
public String getDoorUpperTexture() {
if(this == OAK){
return "blocks/door_wood_upper";
}
return "blocks/door_" + getName() + "_upper";
}
@Override
public String getBarkTexture() {
if(this == DARK_OAK){
return "blocks/log_big_oak";
}
return "blocks/log_" + getName();
}
@Override
public String getHeartTexture() {
if(this == DARK_OAK){
return "blocks/log_big_oak_top";
}
return "blocks/log_" + getName() + "_top";
}
}
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.arboriculture;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@@ -22,5 +24,7 @@ public interface IWoodAccess {
ItemStack getStack(IWoodType woodType, WoodBlockKind kind, boolean fireproof);
IBlockState getBlock(IWoodType woodType, WoodBlockKind kind, boolean fireproof);
List<IWoodType> getRegisteredWoodTypes();
}
@@ -0,0 +1,19 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IWoodItemMeshDefinition extends ItemMeshDefinition {
ResourceLocation getDefaultModelLocation(ItemStack stack);
}
@@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IWoodStateMapper extends IStateMapper {
ModelResourceLocation getModelLocation(IBlockState state);
ModelResourceLocation getDefaultModelResourceLocation(IBlockState state);
}
@@ -14,4 +14,14 @@ public interface IWoodType extends IStringSerializable {
int getCarbonization();
int getCombustability();
String getPlankTexture();
String getDoorLowerTexture();
String getDoorUpperTexture();
String getBarkTexture();
String getHeartTexture();
}
@@ -1,12 +1,68 @@
package forestry.api.arboriculture;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelProcessingHelper;
public enum WoodBlockKind {
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR;
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR(false);
public final boolean retextureItem;
private WoodBlockKind() {
this(true);
}
private WoodBlockKind(boolean retextureItem) {
this.retextureItem = retextureItem;
}
@Override
public String toString() {
return super.toString().toLowerCase(Locale.ENGLISH);
}
public IModel retextureModel(IModel model, IWoodType type, ImmutableMap<String, String> customTextures){
Map<String, String> textures = new HashMap<>();
switch (this) {
case SLAB:
case STAIRS:
String textureLocation = type.getPlankTexture();
textures.put("particle", textureLocation);
textures.put("side", textureLocation);
textures.put("top", textureLocation);
textures.put("bottom", textureLocation);
textures.put("all", textureLocation);
break;
case PLANKS:
textures.put("particle", type.getPlankTexture());
textures.put("all", type.getPlankTexture());
break;
case FENCE_GATE:
case FENCE:
textures.put("particle", type.getPlankTexture());
textures.put("side", type.getPlankTexture());
textures.put("texture", type.getPlankTexture());
break;
case DOOR:
textures.put("particle", type.getDoorLowerTexture());
textures.put("bottom", type.getDoorLowerTexture());
textures.put("top", type.getDoorUpperTexture());
break;
case LOG:
textures.put("particle", type.getBarkTexture());
textures.put("side", type.getBarkTexture());
textures.put("all", type.getBarkTexture());
textures.put("end", type.getHeartTexture());
break;
default:
break;
}
textures.putAll(customTextures);
return ModelProcessingHelper.retexture(model, new ImmutableMap.Builder<String, String>().putAll(textures).build());
}
}
@@ -10,10 +10,6 @@ import java.util.List;
public interface ICircuit {
String getUID();
boolean requiresDiscovery();
int getLimit();
String getUnlocalizedName();
boolean isCircuitable(Object tile);
@@ -0,0 +1,7 @@
package forestry.api.climate;
public enum EnumClimatiserModes {
POSITIVE, NEGATIVE, NONE
}
@@ -0,0 +1,7 @@
package forestry.api.climate;
public enum EnumClimatiserTypes {
TEMPERATURE, HUMIDITY, NONE
}
@@ -0,0 +1,18 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
public interface IClimateControl {
float getControlTemperature();
float getControlHumidity();
void setControlTemperature(float temperature);
void setControlHumidity(float humidity);
}
@@ -0,0 +1,14 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
import forestry.api.core.ILocatable;
public interface IClimateControlProvider extends ILocatable {
IClimateControl getClimateControl();
}
@@ -1,14 +1,9 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
* Copyright 2011-2014 SirSengir
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core;
package forestry.api.climate;
public interface IClimateControlled {
/**
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IClimateManager {
float getTemperature(World world, BlockPos pos);
float getHumidity(World world, BlockPos pos);
IClimateProvider getDefaultClimate(World world, BlockPos pos);
void addRegion(IClimateRegion region);
void removeRegion(IClimateRegion region);
void addSource(IClimateSourceProvider source);
void removeSource(IClimateSourceProvider source);
@Nullable
IClimateRegion getRegionForPos(World world, BlockPos pos);
@Nonnull
Map<Integer, List<IClimateRegion>> getRegions();
}
@@ -0,0 +1,34 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
import javax.annotation.Nonnull;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import net.minecraft.util.math.BlockPos;
public interface IClimatePosition extends INbtReadable, INbtWritable {
@Nonnull
IClimateRegion getClimateRegion();
@Nonnull
BlockPos getPos();
void setTemperature(float temperature);
void addTemperature(float temperature);
float getTemperature();
void setHumidity(float humidity);
void addHumidity(float humidity);
float getHumidity();
}
@@ -0,0 +1,18 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import net.minecraft.world.biome.Biome;
public interface IClimateProvider {
Biome getBiome();
EnumTemperature getTemperature();
EnumHumidity getHumidity();
}
@@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
import java.util.Collection;
import java.util.Map;
import javax.annotation.Nonnull;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IClimateRegion extends INbtReadable, INbtWritable {
@Nonnull
World getWorld();
/**
* Update the climate in a region.
*/
void updateClimate(int ticks);
int getTicksPerUpdate();
@Nonnull
Map<BlockPos, IClimatePosition> getPositions();
void addSource(IClimateSource source);
void removeSource(IClimateSource source);
Collection<IClimateSource> getSources();
Collection<BlockPos> getOtherPositions();
float getTemperature();
float getHumidity();
}
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
/**
* A climate source is used to change the climate in a region.
*/
public interface IClimateSource {
/**
* @param tickCount The current tick count.
* @param region The climate region, in that the source stands.
*/
void changeClimate(int tickCount, IClimateRegion region);
/**
* @return The ticks that are required for one change.
*/
int getTicksForChange(IClimateRegion region);
IClimateSourceProvider getProvider();
}
@@ -0,0 +1,13 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
import forestry.api.core.ILocatable;
public interface IClimateSourceProvider extends ILocatable {
IClimateSource getClimateSource();
}
@@ -0,0 +1,18 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.climate;
public interface IClimatiserDefinition {
float getChange();
double getRange();
EnumClimatiserModes getMode();
EnumClimatiserTypes getType();
}
@@ -3,10 +3,7 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core;
@API(apiVersion = "2.1.0", owner = "Forestry", provides = "ForestryAPI|climate")
package forestry.api.climate;
public enum EnumCamouflageType {
DEFAULT, GLASS, DOOR;
public static final EnumCamouflageType[] VALUES = values();
}
import net.minecraftforge.fml.common.API;
@@ -5,13 +5,14 @@
******************************************************************************/
package forestry.api.core;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IClimateManager {
float getTemperature(World world, BlockPos pos);
public class CamouflageManager {
float getHumidity(World world, BlockPos pos);
public static ICamouflageAccess camouflageAccess;
public static final String DEFAULT = "default";
public static final String GLASS = "glass";
public static final String DOOR = "door";
}
@@ -7,6 +7,7 @@ package forestry.api.core;
import java.util.Set;
import forestry.api.climate.IClimateManager;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
public interface ICamouflageAccess {
/**
* Register a item camouflage handler for a type.
*
* @param type The camouflage type for of handler.
* @param itemHandler The handler that is to register.
*/
void registerCamouflageItemHandler(@Nonnull ICamouflageItemHandler itemHandler);
/**
* @return A list of all item camouflage handler's that are registered for that camouflage type.
*/
List<ICamouflageItemHandler> getCamouflageItemHandler(@Nonnull String type);
void addItemToBlackList(@Nonnull String type, @Nonnull ItemStack camouflageBlock);
boolean isItemBlackListed(@Nonnull String type, @Nonnull ItemStack camouflageBlock);
ICamouflageItemHandler getHandlerFromItem(ItemStack stack);
}
@@ -6,28 +6,26 @@
package forestry.api.core;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
public interface ICamouflageHandler{
public interface ICamouflageHandler extends ILocatable {
/**
* @return The item of the block that is the camouflage of this handler for the EnumCamouflageType.
* @return The item of the block that is the camouflage of this handler for the type.
*/
ItemStack getCamouflageBlock(EnumCamouflageType type);
/**
* @return The default camouflage block item for the EnumCamouflageType.
*/
ItemStack getDefaultCamouflageBlock(EnumCamouflageType type);
ItemStack getCamouflageBlock(String type);
/**
* Set the camouflage block item for the EnumCamouflageType.
* @return The default camouflage block item for the type.
*/
void setCamouflageBlock(EnumCamouflageType type, ItemStack camouflageBlock);
ItemStack getDefaultCamouflageBlock(String type);
/**
* @return The coordinates of the handler as a BlockPos.
* @return True if the handler can handle this type of camouflage.
*/
BlockPos getCoordinates();
boolean canHandleType(String type);
/**
* Set the camouflage block item for the type.
*/
void setCamouflageBlock(String type, ItemStack camouflageBlock);
}
@@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core;
import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface ICamouflageItemHandler {
boolean canHandle(ItemStack stack);
String getType();
float getLightTransmittance(ItemStack stack, ICamouflageHandler camouflageHandler);
@SideOnly(Side.CLIENT)
Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile);
}
@@ -9,7 +9,7 @@ import net.minecraft.util.math.BlockPos;
public interface ICamouflagedTile {
EnumCamouflageType getCamouflageType();
String getCamouflageType();
BlockPos getCoordinates();
@@ -1,21 +1,21 @@
/*******************************************************************************
* 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.core.tiles;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface ILocatable {
BlockPos getCoordinates();
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
World getWorldObj();
}
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.api.core;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface ILocatable {
BlockPos getCoordinates();
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
World getWorldObj();
}
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
@@ -38,7 +39,7 @@ public interface IModelBaker {
void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite texture, int colorIndex);
void addBakedModel(@Nonnull IBakedModel model);
void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model);
void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite);
@@ -8,8 +8,6 @@ package forestry.api.core;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -8,22 +8,10 @@ package forestry.api.fuels;
import net.minecraftforge.fluids.Fluid;
public class EngineBronzeFuel {
/**
* Item that is valid fuel for a biogas engine.
*/
public final Fluid liquid;
/**
* Power produced by this fuel per work cycle of the engine.
*/
public final int powerPerCycle;
/**
* How many work cycles a single "stack" of this type lasts.
*/
public final int burnDuration;
/**
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
*/
public final int dissipationMultiplier;
private final Fluid liquid;
private final int powerPerCycle;
private final int burnDuration;
private final int dissipationMultiplier;
public EngineBronzeFuel(Fluid liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
this.liquid = liquid;
@@ -31,4 +19,32 @@ public class EngineBronzeFuel {
this.burnDuration = burnDuration;
this.dissipationMultiplier = dissipationMultiplier;
}
/**
* Item that is valid fuel for a biogas engine.
*/
public Fluid getLiquid() {
return liquid;
}
/**
* Power produced by this fuel per work cycle of the engine.
*/
public int getPowerPerCycle() {
return powerPerCycle;
}
/**
* How many work cycles a single "stack" of this type lasts.
*/
public int getBurnDuration() {
return burnDuration;
}
/**
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
*/
public int getDissipationMultiplier() {
return dissipationMultiplier;
}
}
@@ -9,18 +9,9 @@ import net.minecraft.item.ItemStack;
public class EngineCopperFuel {
/**
* Item that is valid fuel for a peat-fired engine.
*/
public final ItemStack fuel;
/**
* Power produced by this fuel per work cycle.
*/
public final int powerPerCycle;
/**
* Amount of work cycles this item lasts before being consumed.
*/
public final int burnDuration;
private final ItemStack fuel;
private final int powerPerCycle;
private final int burnDuration;
public EngineCopperFuel(ItemStack fuel, int powerPerCycle, int burnDuration) {
this.fuel = fuel;
@@ -28,4 +19,24 @@ public class EngineCopperFuel {
this.burnDuration = burnDuration;
}
/**
* Item that is valid fuel for a peat-fired engine.
*/
public ItemStack getFuel() {
return fuel;
}
/**
* Power produced by this fuel per work cycle.
*/
public int getPowerPerCycle() {
return powerPerCycle;
}
/**
* Amount of work cycles this item lasts before being consumed.
*/
public int getBurnDuration() {
return burnDuration;
}
}
@@ -8,22 +8,34 @@ package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class FermenterFuel {
/**
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
*/
public final ItemStack item;
/**
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
*/
public final int fermentPerCycle;
/**
* Amount of work cycles a single item of this fuel lasts before expiring.
*/
public final int burnDuration;
private final ItemStack item;
private final int fermentPerCycle;
private final int burnDuration;
public FermenterFuel(ItemStack item, int fermentPerCycle, int burnDuration) {
this.item = item;
this.fermentPerCycle = fermentPerCycle;
this.burnDuration = burnDuration;
}
/**
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
*/
public ItemStack getItem() {
return item;
}
/**
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
*/
public int getFermentPerCycle() {
return fermentPerCycle;
}
/**
* Amount of work cycles a single item of this fuel lasts before expiring.
*/
public int getBurnDuration() {
return burnDuration;
}
}
@@ -9,18 +9,9 @@ import net.minecraftforge.fluids.FluidStack;
public class GeneratorFuel {
/**
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
*/
public final FluidStack fuelConsumed;
/**
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
*/
public final int eu;
/**
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
*/
public final int rate;
private final FluidStack fuelConsumed;
private final int eu;
private final int rate;
public GeneratorFuel(FluidStack fuelConsumed, int eu, int rate) {
this.fuelConsumed = fuelConsumed;
@@ -28,4 +19,24 @@ public class GeneratorFuel {
this.rate = rate;
}
/**
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
*/
public FluidStack getFuelConsumed() {
return fuelConsumed;
}
/**
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
*/
public int getEu() {
return eu;
}
/**
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
*/
public int getRate() {
return rate;
}
}
@@ -8,22 +8,10 @@ package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class MoistenerFuel {
/**
* The item to use
*/
public final ItemStack item;
/**
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
*/
public final ItemStack product;
/**
* How much this item contributes to the final product of the moistener (i.e. mycelium)
*/
public final int moistenerValue;
/**
* What stage this product represents. Resources with lower stage value will be consumed first.
*/
public final int stage;
private final ItemStack item;
private final ItemStack product;
private final int moistenerValue;
private final int stage;
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
this.item = item;
@@ -31,4 +19,32 @@ public class MoistenerFuel {
this.stage = stage;
this.moistenerValue = moistenerValue;
}
/**
* The item to use
*/
public ItemStack getItem() {
return item;
}
/**
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
*/
public ItemStack getProduct() {
return product;
}
/**
* How much this item contributes to the final product of the moistener (i.e. mycelium)
*/
public int getMoistenerValue() {
return moistenerValue;
}
/**
* What stage this product represents. Resources with lower stage value will be consumed first.
*/
public int getStage() {
return stage;
}
}
@@ -3,7 +3,7 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@API(apiVersion = "2.0.1", owner = "ForestryAPI|core", provides = "ForestryAPI|fuels")
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|fuels")
package forestry.api.fuels;
import net.minecraftforge.fml.common.API;
@@ -0,0 +1,20 @@
package forestry.api.genetics;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* Called after Forestry has registered all his species alleles of a individual.
*/
public class AlleleSpeciesRegisterEvent extends Event {
private final ISpeciesRoot root;
public AlleleSpeciesRegisterEvent(ISpeciesRoot root) {
this.root = root;
}
public ISpeciesRoot getRoot() {
return root;
}
}
@@ -3,23 +3,22 @@ package forestry.api.genetics;
import java.util.List;
import java.util.Map;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.core.gui.GuiAlyzer;
public interface IAlyzerPlugin {
@SideOnly(Side.CLIENT)
void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack);
void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack);
@SideOnly(Side.CLIENT)
void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack);
void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack);
@SideOnly(Side.CLIENT)
void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack);
void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack);
Map<String, ItemStack> getIconStacks();
@@ -5,10 +5,12 @@
******************************************************************************/
package forestry.api.genetics;
import net.minecraft.block.state.IBlockState;
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 IMutationBuilder {
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.genetics;
import forestry.api.climate.IClimateProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -15,7 +16,7 @@ public interface IMutationCondition {
* Most will return 1 if the condition is met and 0 otherwise,
* but the float offers flexibility for more advanced conditions.
*/
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate);
/**
* A localized description of the mutation condition. (i.e. "A temperature of HOT is required.")
@@ -10,7 +10,7 @@ import forestry.api.multiblock.IGreenhouseController;
public class DefaultGreenhouseListener implements IGreenhouseListener {
@Override
public <G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork) {
public boolean canWork(IGreenhouseController greenhouse, boolean canWork) {
return true;
}
@@ -1,12 +1,7 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
* Copyright 2011-2014 SirSengir
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
@@ -15,17 +10,17 @@ import javax.annotation.Nullable;
import net.minecraftforge.fml.common.eventhandler.Event;
import forestry.api.core.EnumCamouflageType;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflagedTile;
import forestry.api.multiblock.IGreenhouseController;
public class GreenhouseEvents extends Event {
@Nullable
public final IGreenhouseState state;
public final IGreenhouseController controller;
public GreenhouseEvents(@Nullable IGreenhouseState state) {
this.state = state;
public GreenhouseEvents(@Nullable IGreenhouseController state) {
this.controller = state;
}
public static class CamouflageChangeEvent extends GreenhouseEvents{
@@ -35,10 +30,10 @@ public class GreenhouseEvents extends Event {
@Nonnull
public ICamouflageHandler camouflageHandler;
@Nonnull
public final EnumCamouflageType camouflageType;
public final String camouflageType;
public CamouflageChangeEvent(IGreenhouseState state, @Nullable ICamouflagedTile camouflagedBlock, @Nonnull ICamouflageHandler camouflageHandler, @Nonnull EnumCamouflageType camouflageType) {
super(state);
public CamouflageChangeEvent(IGreenhouseController controller, @Nullable ICamouflagedTile camouflagedBlock, @Nonnull ICamouflageHandler camouflageHandler, @Nonnull String camouflageType) {
super(controller);
this.camouflagedBlock = camouflagedBlock;
this.camouflageHandler = camouflageHandler;
@@ -51,8 +46,8 @@ public class GreenhouseEvents extends Event {
@Nonnull
public IInternalBlock internalBlock;
public InternalBlockEvent(IGreenhouseState state, @Nonnull IInternalBlock internalBlock) {
super(state);
public InternalBlockEvent(IGreenhouseController controller, @Nonnull IInternalBlock internalBlock) {
super(controller);
this.internalBlock = internalBlock;
}
@@ -60,8 +55,8 @@ public class GreenhouseEvents extends Event {
public static class CreateInternalBlockEvent extends InternalBlockEvent{
public CreateInternalBlockEvent(IGreenhouseState state, IInternalBlock internalBlock) {
super(state, internalBlock);
public CreateInternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
super(controller, internalBlock);
}
}
@@ -70,8 +65,8 @@ public class GreenhouseEvents extends Event {
@Nonnull
public final IInternalBlockFace face;
public CheckInternalBlockFaceEvent(IGreenhouseState state, IInternalBlock internalBlock, @Nonnull IInternalBlockFace face) {
super(state, internalBlock);
public CheckInternalBlockFaceEvent(IGreenhouseController controller, IInternalBlock internalBlock, @Nonnull IInternalBlockFace face) {
super(controller, internalBlock);
this.face = face;
}
@@ -5,15 +5,8 @@
******************************************************************************/
package forestry.api.greenhouse;
import java.util.ArrayList;
import java.util.List;
public class GreenhouseManager {
public static IGreenhouseAccess greenhouseAccess;
public static IGreenhouseHelper greenhouseHelper;
public static List<Class<? extends IGreenhouseLogic>> greenhouseLogics = new ArrayList<>();
}
@@ -1,25 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
import javax.annotation.Nonnull;
import forestry.api.core.EnumCamouflageType;
import net.minecraft.item.ItemStack;
public interface IGreenhouseAccess {
void registerGreenhouseGlass(@Nonnull ItemStack glass, float lightTransmittance);
boolean isGreenhouseGlass(@Nonnull ItemStack glass);
float getGreenhouseGlassLightTransmittance(@Nonnull ItemStack glass);
void addToCamouflageBlockBlackList(@Nonnull EnumCamouflageType type, @Nonnull ItemStack camouflageBlock);
boolean isOnCamouflageBlockBlackList(@Nonnull EnumCamouflageType type, @Nonnull ItemStack camouflageBlock);
}
@@ -5,14 +5,21 @@
******************************************************************************/
package forestry.api.greenhouse;
import java.util.List;
import forestry.api.multiblock.IGreenhouseController;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IGreenhouseHelper {
/**
* @return A {@link IGreenhouseState} of a greenhouse, when the pos is a greenhouse
* @return A {@link IGreenhouseController} of a greenhouse, when the pos is a greenhouse
*/
IGreenhouseState getGreenhouseState(World world, BlockPos pos);
IGreenhouseController getGreenhouseController(World world, BlockPos pos);
void addGreenhouseLogic(Class<? extends IGreenhouseLogic> logic);
List<Class<? extends IGreenhouseLogic>> getGreenhouseLogics();
}
@@ -10,12 +10,12 @@ import forestry.api.multiblock.IGreenhouseController;
public interface IGreenhouseListener {
/**
* Called before the greenhouse work.
* Called before the greenhouse update the climate system.
*
* @param greenhouse The greenhouse multiblock.
* @param greenhouse The greenhouse of the listener.
* @param canWork The actual {@link Boolean} value.
* @return True if the greenhouse can work.
* @return True if the greenhouse can update the climate.
*/
<G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork);
boolean canWork(IGreenhouseController greenhouse, boolean canWork);
}
@@ -1,29 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
import java.util.Collection;
import java.util.Set;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.multiblock.IMultiblockComponent;
public interface IGreenhouseState {
EnumTemperature getTemperature();
EnumHumidity getHumidity();
float getExactTemperature();
float getExactHumidity();
Set<IInternalBlock> getInternalBlocks();
Collection<IMultiblockComponent> getGreenhouseComponents();
}
@@ -7,6 +7,7 @@ package forestry.api.greenhouse;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import net.minecraft.util.math.BlockPos;
@@ -3,7 +3,7 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|greenhouse")
@API(apiVersion = "5.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|greenhouse")
package forestry.api.greenhouse;
import net.minecraftforge.fml.common.API;
@@ -5,10 +5,11 @@
******************************************************************************/
package forestry.api.lepidopterology;
import forestry.api.climate.IClimateProvider;
import forestry.api.genetics.IHousing;
import forestry.api.genetics.IIndividual;
public interface IButterflyNursery extends IHousing {
public interface IButterflyNursery extends IHousing, IClimateProvider {
IButterfly getCaterpillar();
@@ -7,7 +7,7 @@ package forestry.api.multiblock;
import forestry.api.apiculture.IBeeListener;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.core.IClimateControlled;
import forestry.api.climate.IClimateControlled;
/**
* Needs to be implemented by TileEntities that want to be part of an alveary.
@@ -5,8 +5,10 @@
******************************************************************************/
package forestry.api.multiblock;
import forestry.api.core.IClimateControlled;
import forestry.api.greenhouse.IGreenhouseHousing;
import forestry.api.climate.IClimateControl;
import forestry.api.climate.IClimateControlProvider;
import forestry.api.climate.IClimateSourceProvider;
import forestry.api.climate.IClimatiserDefinition;
import forestry.api.greenhouse.IGreenhouseListener;
import forestry.api.lepidopterology.IButterflyCocoon;
import net.minecraft.item.ItemStack;
@@ -19,11 +21,17 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
IGreenhouseListener getGreenhouseListener();
}
interface ClimateControl extends IGreenhouseComponent, IClimateControlProvider {
@Override
IClimateControl getClimateControl();
}
interface Door extends IGreenhouseComponent {
}
interface Climatiser extends IGreenhouseComponent {
<G extends IGreenhouseController & IGreenhouseHousing & IClimateControlled> void changeClimate(int tickCount, G greenhouse);
interface Climatiser extends IGreenhouseComponent, IClimateSourceProvider {
IClimatiserDefinition getDefinition();
}
interface ButterflyHatch extends IGreenhouseComponent {
@@ -7,13 +7,18 @@ package forestry.api.multiblock;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import forestry.api.climate.IClimateControl;
import forestry.api.climate.IClimateControlProvider;
import forestry.api.climate.IClimateRegion;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.IClimateControlled;
import forestry.api.greenhouse.EnumGreenhouseEventType;
import forestry.api.greenhouse.IGreenhouseHousing;
import forestry.api.greenhouse.IGreenhouseLogic;
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlled {
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlProvider {
/**
* Handle change events.
@@ -24,5 +29,12 @@ public interface IGreenhouseController extends IMultiblockController, IGreenhous
* @return The logics of the greenhouse.
*/
List<IGreenhouseLogic> getLogics();
@Nullable
IClimateRegion getRegion();
@Override
@Nonnull
IClimateControl getClimateControl();
}
@@ -15,4 +15,6 @@ public interface IMultiblockLogicFactory {
IMultiblockLogicFarm createFarmLogic();
IMultiblockLogicGreenhouse createGreenhouseLogic();
IMultiblockLogicCharcoalPile createCharcoalPileLogic();
}
@@ -5,43 +5,42 @@
******************************************************************************/
package forestry.api.storage;
import java.util.List;
import javax.annotation.Nonnull;
import java.util.function.Predicate;
import net.minecraft.item.ItemStack;
public interface IBackpackDefinition extends Predicate<ItemStack> {
/**
* To make your own backpack, create a backpack definition and register it with
* {@link IBackpackInterface#registerBackpackDefinition(String, IBackpackDefinition)}.
*/
public interface IBackpackDefinition {
/**
* @return Human-readable name of the backpack.
*/
@Nonnull
String getName(ItemStack backpack);
/**
* @return Primary colour for the backpack icon.
* @return Primary color for the backpack icon.
*/
int getPrimaryColour();
/**
* @return Secondary colour for backpack icon.
* @return Secondary color for backpack icon, normally white.
*/
int getSecondaryColour();
/**
* Adds an item as valid for this backpack.
* Filters items that can be put into a backpack.
*
* @param validItem
* For Backpack Implementers: you can create a new filter with
* {@link IBackpackInterface#createBackpackFilter()} or
* {@link IBackpackInterface#createNaturalistBackpackFilter(String)}
* or implement your own.
*
* @return the backpack's item filter.
*/
void addValidItem(ItemStack validItem);
void addValidItems(List<ItemStack> validItems);
void addValidOreDictName(String oreDictName);
/**
* Returns true if the ItemStack is a valid item for this backpack type.
*/
@Override
boolean test(ItemStack itemstack);
@Nonnull
Predicate<ItemStack> getFilter();
}
@@ -0,0 +1,45 @@
package forestry.api.storage;
import java.util.function.Predicate;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/**
* A configurable backpack filter. Useful for implementers of {@link IBackpackDefinition}.
* Get a new instance from {@link IBackpackInterface#createBackpackFilter()}.
*/
public interface IBackpackFilterConfigurable extends Predicate<ItemStack> {
/**
* Adds an item as valid for this backpack to pick up.
*/
void acceptItem(ItemStack validItem);
/**
* Adds an item as invalid for this backpack, used to make exceptions to oreDictionary matches.
*
* @see #acceptOreDictName(String)
*/
void rejectItem(ItemStack invalidItem);
/**
* Adds an ore dictionary name as valid for this backpack.
* The backpack will pick up any item that has this oreDictName.
*
* @see OreDictionary
*/
void acceptOreDictName(String oreDictName);
/**
* Removes an ore dictionary name as valid for this backpack.
* The backpack will not pick up any item that has this oreDictName.
*
* @see OreDictionary
*/
void rejectOreDictName(String oreDictName);
/**
* Clear all the rules from this filter.
*/
void clear();
}
@@ -7,32 +7,83 @@ package forestry.api.storage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.function.Predicate;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
import net.minecraftforge.oredict.OreDictionary;
/**
* The Backpack Interface allows you to add items to Forestry backpacks or create your own backpacks.
* <p>
* To create your own backpack, create an {@link IBackpackDefinition}.
* Backpack definitions have a filter, which you can create here with
* {@link #createBackpackFilter()}
* or {@link #createNaturalistBackpackFilter(String)}
* or create your own.
* <p>
* After you've registered your backpack definition, create the item with
* {@link #createBackpack(String, EnumBackpackType)}
* or {@link #createNaturalistBackpack(String, ISpeciesRoot)}
* and then register the returned item with {@link GameRegistry#register(IForgeRegistryEntry)} like any other item.
*/
public interface IBackpackInterface {
/**
* Get a backpack with a given uid so you can add items to it or get information about it.
* returns null if there is no backpack for the given uid.
* Add an accepted item to a Forestry backpack.
*
* @param backpackUid The unique ID of the Forestry backpack. See {@link BackpackManager} for valid UIDs.
* @param itemStack The itemStack that the backpack should accept.
* {@link OreDictionary#WILDCARD_VALUE} can be used for meta value.
*/
void addItemToForestryBackpack(@Nonnull String backpackUid, @Nonnull ItemStack itemStack);
/**
* Register a backpack definition with a given uid.
*/
void registerBackpackDefinition(@Nonnull String backpackUid, @Nonnull IBackpackDefinition definition);
/**
* Get a backpack definition with a given uid.
*/
@Nullable
IBackpackDefinition getBackpack(@Nonnull String uid);
IBackpackDefinition getBackpackDefinition(@Nonnull String backpackUid);
/**
* Register a backpack with a given uid
*/
void registerBackpack(@Nonnull String uid, @Nonnull IBackpackDefinition definition);
/**
* Adds a backpack with the given definition and type, returning the item.
* Creates a backpack with the given UID and type, returning the item.
* The backpack's definition must first be registered with {@link #registerBackpackDefinition(String, IBackpackDefinition)}.
*
* @param definition
* Definition of backpack behaviour.
* @param type
* Type of backpack.
* @param backpackUid The unique ID of the backpack.
* @param type Type of backpack.
* @return Created backpack item.
*/
@Nonnull
Item createBackpack(@Nonnull IBackpackDefinition definition, @Nonnull EnumBackpackType type);
Item createBackpack(@Nonnull String backpackUid, @Nonnull EnumBackpackType type);
/**
* Create a backpack that can hold items from a specific {@link ISpeciesRoot}.
* The backpack's definition must first be registered with {@link #registerBackpackDefinition(String, IBackpackDefinition)}.
*
* @param backpackUid The unique ID of the backpack.
* @param speciesRoot The species root.
* @return Created backpack item.
*/
Item createNaturalistBackpack(@Nonnull String backpackUid, @Nonnull ISpeciesRoot speciesRoot);
/**
* Makes a new configurable backpack filter. Useful for implementing {@link IBackpackDefinition}.
*/
IBackpackFilterConfigurable createBackpackFilter();
/**
* Makes a new naturalist backpack filter. Only accepts items from a specific {@link ISpeciesRoot}.
* Useful for implementing {@link IBackpackDefinition} for naturalist's backpacks.
*
* @param speciesRootUid The species root's unique ID. See {@link ISpeciesRoot#getUID()}.
* @return a new backpack filter for the specified species root
* @see #createNaturalistBackpack(String, ISpeciesRoot)
*/
Predicate<ItemStack> createNaturalistBackpackFilter(String speciesRootUid);
}
@@ -3,7 +3,7 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|storage")
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|storage")
package forestry.api.storage;
import net.minecraftforge.fml.common.API;
@@ -11,6 +11,7 @@
package forestry.apiculture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -233,7 +234,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
if (beeType == EnumBeeType.PRINCESS) {
tickBreed();
} else if (beeType == EnumBeeType.QUEEN) {
queenWorkTick(queen);
queenWorkTick(queen, queenStack);
}
}
@@ -246,7 +247,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
}
}
private void queenWorkTick(IBee queen) {
private void queenWorkTick(@Nullable IBee queen, @Nonnull ItemStack queenStack) {
if (queen == null) {
beeProgress = 0;
beeProgressMax = 0;
@@ -272,7 +273,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
// Write the changed queen back into the item stack.
NBTTagCompound nbttagcompound = new NBTTagCompound();
queen.writeToNBT(nbttagcompound);
housing.getBeeInventory().getQueen().setTagCompound(nbttagcompound);
queenStack.setTagCompound(nbttagcompound);
housing.getBeeInventory().setQueen(queenStack);
}
beeProgress = queen.getHealth();
@@ -16,7 +16,6 @@ import net.minecraft.util.EnumFacing;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBeeHousingInventory;
import forestry.core.access.IAccessHandler;
import forestry.core.inventory.InventoryAdapterRestricted;
import forestry.core.utils.InventoryUtil;
import forestry.core.utils.SlotUtil;
@@ -27,8 +26,8 @@ public class InventoryBeeHousing extends InventoryAdapterRestricted implements I
public static final int SLOT_PRODUCT_1 = 2;
public static final int SLOT_PRODUCT_COUNT = 7;
public InventoryBeeHousing(int size, IAccessHandler accessHandler) {
super(size, "Items", accessHandler);
public InventoryBeeHousing(int size) {
super(size, "Items");
}
@Override
@@ -10,8 +10,6 @@
******************************************************************************/
package forestry.apiculture;
import com.google.common.collect.ImmutableMap;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -19,34 +17,7 @@ import java.util.Objects;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import com.google.common.collect.ImmutableMap;
import forestry.Forestry;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeType;
@@ -119,6 +90,32 @@ import forestry.food.items.ItemRegistryFood;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ForestryPlugin(pluginID = ForestryPluginUids.APICULTURE, name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description")
public class PluginApiculture extends BlankForestryPlugin {
@@ -266,7 +263,7 @@ public class PluginApiculture extends BlankForestryPlugin {
VillagerRegistry villagerRegistry = VillagerRegistry.instance();
villagerRegistry.registerVillageCreationHandler(villageHandler);
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER);
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER, Constants.TEXTURE_SKIN_ZOMBIE_BEEKPEEPER);
villagerRegistry.register(villagerApiarist);
ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
@@ -559,7 +556,7 @@ 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)}, new FluidStack(FluidRegistry.WATER, 2000));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND)}, new FluidStack(FluidRegistry.LAVA, 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));
@@ -12,10 +12,11 @@ package forestry.apiculture.blocks;
import forestry.api.core.Tabs;
import forestry.core.blocks.BlockBase;
import net.minecraft.block.material.Material;
public class BlockApiculture extends BlockBase<BlockTypeApiculture> {
public BlockApiculture(BlockTypeApiculture type) {
super(type);
super(type, Material.WOOD);
setCreativeTab(Tabs.tabApiculture);
setHarvestLevel("axe", 0);
}
@@ -12,6 +12,7 @@ package forestry.apiculture.blocks;
import java.util.Map;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import forestry.api.core.Tabs;
@@ -36,7 +37,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
beeHouse = new BlockApiculture(BlockTypeApiculture.BEE_HOUSE);
registerBlock(beeHouse, new ItemBlockForestry(beeHouse), "bee_house");
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST);
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST, Material.WOOD);
registerBlock(beeChest, new ItemBlockForestry(beeChest), "bee_chest");
beeChest.setCreativeTab(Tabs.tabApiculture);
beeChest.setHarvestLevel("axe", 0);
@@ -2,13 +2,13 @@ package forestry.apiculture.compat;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import forestry.api.apiculture.BeeManager;
import forestry.api.genetics.IAlleleSpecies;
import forestry.apiculture.PluginApiculture;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.genetics.Genome;
import forestry.core.utils.JeiUtil;
import mezz.jei.api.BlankModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.ISubtypeRegistry;
@@ -19,29 +19,31 @@ import net.minecraft.item.ItemStack;
public class ApicultureJeiPlugin extends BlankModPlugin {
@Override
public void register(@Nonnull IModRegistry registry) {
List<ItemStack> frames = Arrays.asList(
new ItemStack(PluginApiculture.items.frameImpregnated),
new ItemStack(PluginApiculture.items.frameProven),
new ItemStack(PluginApiculture.items.frameUntreated)
ItemRegistryApiculture items = PluginApiculture.items;
JeiUtil.addDescription(registry, "frames",
items.frameImpregnated,
items.frameProven,
items.frameUntreated
);
registry.addDescription(frames, "for.jei.description.frames");
List<ItemStack> apiaristSuit = Arrays.asList(
new ItemStack(PluginApiculture.items.apiaristBoots),
new ItemStack(PluginApiculture.items.apiaristChest),
new ItemStack(PluginApiculture.items.apiaristHat),
new ItemStack(PluginApiculture.items.apiaristLegs)
JeiUtil.addDescription(registry, "apiarist.suit",
items.apiaristBoots,
items.apiaristChest,
items.apiaristHat,
items.apiaristLegs
);
registry.addDescription(apiaristSuit, "for.jei.description.apiarist.suit");
registry.addDescription(new ItemStack(PluginApiculture.items.habitatLocator), "for.jei.description.habitat.locator");
registry.addDescription(new ItemStack(PluginApiculture.items.scoop), "for.jei.description.scoop");
JeiUtil.addDescription(registry,
items.habitatLocator,
items.scoop,
items.imprinter
);
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);
subtypeRegistry.registerNbtInterpreter(items.beeDroneGE, BeeSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerNbtInterpreter(items.beePrincessGE, BeeSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerNbtInterpreter(items.beeQueenGE, BeeSubtypeInterpreter.INSTANCE);
}
private static class BeeSubtypeInterpreter implements ISubtypeRegistry.ISubtypeInterpreter {
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.entities;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -36,9 +37,12 @@ import forestry.core.config.Config;
import forestry.core.inventory.IInventoryAdapter;
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
@Nonnull
private static final IBeeModifier beeModifier = new ApiaryBeeModifier();
@Nonnull
private final IBeeListener beeListener = new ApiaryBeeListener(this);
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
@Nonnull
private final InventoryApiary inventory = new InventoryApiary();
@SuppressWarnings("unused")
public EntityMinecartApiary(World world) {
@@ -64,6 +68,7 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
return inventory;
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return inventory;
@@ -10,17 +10,12 @@
******************************************************************************/
package forestry.apiculture.entities;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.Random;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import com.google.common.base.Optional;
import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeekeepingLogic;
@@ -36,10 +31,24 @@ import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.IForestryPacketServer;
import forestry.core.network.IStreamableGui;
import forestry.core.owner.GameProfileDataSerializer;
import forestry.core.owner.IOwnedTile;
import forestry.core.owner.IOwnerHandler;
import forestry.core.owner.OwnerHandler;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IClimatised;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IOwnedTile, IGuiBeeHousingInventory, IClimatised, IStreamableGui {
private static final DataParameter<Optional<GameProfile>> OWNER = EntityDataManager.createKey(EntityMinecart.class, GameProfileDataSerializer.INSTANCE);
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IGuiBeeHousingInventory, IClimatised, IStreamableGui {
private static final Random random = new Random();
private static final int beeFXInterval = 4;
private static final int pollenFXInterval = 50;
@@ -49,6 +58,23 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
private final IBeekeepingLogic beeLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
private final IErrorLogic errorLogic = ForestryAPI.errorStateRegistry.createErrorLogic();
private final OwnerHandler ownerHandler = new OwnerHandler() {
@Override
public void setOwner(@Nonnull GameProfile owner) {
super.setOwner(owner);
dataManager.set(OWNER, Optional.of(owner));
}
@Override
public GameProfile getOwner() {
Optional<GameProfile> gameProfileOptional = dataManager.get(OWNER);
if (gameProfileOptional.isPresent()) {
return gameProfileOptional.get();
} else {
return null;
}
}
};
// CLIENT
private int breedingProgressPercent = 0;
@@ -63,6 +89,18 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
super(world, posX, posY, posZ);
}
@Override
protected void entityInit() {
super.entityInit();
this.dataManager.register(OWNER, Optional.absent());
}
/* IOwnedTile */
@Override
public IOwnerHandler getOwnerHandler() {
return ownerHandler;
}
/* IBeeHousing */
@Override
public IBeekeepingLogic getBeekeepingLogic() {
@@ -111,7 +149,7 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
@Override
public GameProfile getOwner() {
return getAccessHandler().getOwner();
return getOwnerHandler().getOwner();
}
@Override
@@ -174,11 +212,13 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
protected void readEntityFromNBT(NBTTagCompound nbtTagCompound) {
super.readEntityFromNBT(nbtTagCompound);
beeLogic.readFromNBT(nbtTagCompound);
ownerHandler.readFromNBT(nbtTagCompound);
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbtTagCompound) {
super.writeEntityToNBT(nbtTagCompound);
beeLogic.writeToNBT(nbtTagCompound);
ownerHandler.writeToNBT(nbtTagCompound);
}
}
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.entities;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
@@ -33,7 +34,7 @@ import forestry.core.inventory.IInventoryAdapter;
public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
private static final IBeeListener beeListener = new DefaultBeeListener();
private final InventoryBeeHousing beeInventory = new InventoryBeeHousing(9, getAccessHandler());
private final InventoryBeeHousing beeInventory = new InventoryBeeHousing(9);
@SuppressWarnings("unused")
public EntityMinecartBeehouse(World world) {
@@ -72,6 +73,7 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
return Collections.singleton(beeListener);
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return beeInventory;
@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
@@ -47,208 +48,217 @@ public class BeeAlyzerPlugin implements IAlyzerPlugin {
@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack) {
IBee bee = BeeManager.beeRoot.getMember(itemStack);
if (bee == null) {
return;
}
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
TextLayoutHelper textLayout = gui.getTextLayout();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
textLayout.newLine();
textLayout.newLine();
{
String customPrimaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
String customSecondaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
gui.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), bee, EnumBeeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryBeeKey), GuiAlyzer.checkCustomName(customSecondaryBeeKey));
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
if(gui instanceof GuiAlyzer){
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
IBee bee = BeeManager.beeRoot.getMember(itemStack);
if (bee == null) {
return;
}
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
textLayout.newLine();
textLayout.newLine();
{
String customPrimaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
String customSecondaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), bee, EnumBeeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryBeeKey), GuiAlyzer.checkCustomName(customSecondaryBeeKey));
textLayout.newLine();
}
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
textLayout.newLine();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.speed"), bee, EnumBeeChromosome.SPEED);
textLayout.newLine();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
textLayout.newLine();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
textLayout.newLine();
textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
guiAlyzer.drawFertilityInfo(primaryFertility.getValue(), GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(primaryFertility.isDominant()), 0);
guiAlyzer.drawFertilityInfo(secondaryFertility.getValue(), GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(secondaryFertility.isDominant()), 0);
textLayout.newLine();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.area"), bee, EnumBeeChromosome.TERRITORY);
textLayout.newLine();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), bee, EnumBeeChromosome.EFFECT);
textLayout.newLine();
textLayout.endPage();
}
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
textLayout.newLine();
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.speed"), bee, EnumBeeChromosome.SPEED);
textLayout.newLine();
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
textLayout.newLine();
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
textLayout.newLine();
textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
gui.drawFertilityInfo(primaryFertility.getValue(), GuiAlyzer.COLUMN_1, gui.getColorCoding(primaryFertility.isDominant()), 0);
gui.drawFertilityInfo(secondaryFertility.getValue(), GuiAlyzer.COLUMN_2, gui.getColorCoding(secondaryFertility.isDominant()), 0);
textLayout.newLine();
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.area"), bee, EnumBeeChromosome.TERRITORY);
textLayout.newLine();
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), bee, EnumBeeChromosome.EFFECT);
textLayout.newLine();
textLayout.endPage();
}
@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack) {
IBee bee = BeeManager.beeRoot.getMember(itemStack);
if (bee == null) {
return;
}
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
TextLayoutHelper textLayout = gui.getTextLayout();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
textLayout.newLine();
gui.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
textLayout.newLine();
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
gui.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
gui.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
textLayout.newLine(16);
gui.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
textLayout.newLine();
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
gui.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
gui.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
textLayout.newLine(16);
String yes = Translator.translateToLocal("for.yes");
String no = Translator.translateToLocal("for.no");
String diurnal0, diurnal1, nocturnal0, nocturnal1;
if (bee.getGenome().getNeverSleeps()) {
nocturnal0 = diurnal0 = yes;
} else {
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
}
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue()) {
nocturnal1 = diurnal1 = yes;
} else {
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
diurnal1 = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
}
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, gui.getColorCoding(false));
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, gui.getColorCoding(false));
textLayout.newLineCompressed();
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, gui.getColorCoding(false));
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, gui.getColorCoding(false));
textLayout.newLineCompressed();
String primary = StringUtil.readableBoolean(bee.getGenome().getToleratesRain(), yes, no);
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERATES_RAIN)).getValue(), yes, no);
gui.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERATES_RAIN);
textLayout.newLineCompressed();
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
gui.drawRow(Translator.translateToLocal("for.gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
textLayout.newLine();
String displayText;
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
String displayTextKey = "for.bees.stock.pristine";
if (!bee.isNatural()) {
displayTextKey = "for.bees.stock.ignoble";
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
if(gui instanceof GuiAlyzer){
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
IBee bee = BeeManager.beeRoot.getMember(itemStack);
if (bee == null) {
return;
}
displayText = Translator.translateToLocal(displayTextKey);
textLayout.drawCenteredLine(displayText, 8, 208, gui.getFontColor().get("gui.beealyzer.binomial"));
}
if (bee.getGeneration() >= 0) {
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
textLayout.newLine();
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
textLayout.newLine();
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
guiAlyzer.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
guiAlyzer.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
textLayout.newLine(16);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
textLayout.newLine();
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
guiAlyzer.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
guiAlyzer.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
textLayout.newLine(16);
String yes = Translator.translateToLocal("for.yes");
String no = Translator.translateToLocal("for.no");
String diurnal0, diurnal1, nocturnal0, nocturnal1;
if (bee.getGenome().getNeverSleeps()) {
nocturnal0 = diurnal0 = yes;
} else {
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
}
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue()) {
nocturnal1 = diurnal1 = yes;
} else {
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
diurnal1 = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
}
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
textLayout.newLineCompressed();
displayText = Translator.translateToLocalFormatted("for.gui.beealyzer.generations", bee.getGeneration());
textLayout.drawCenteredLine(displayText, 8, 208, gui.getFontColor().get("gui.beealyzer.binomial"));
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
textLayout.newLineCompressed();
String primary = StringUtil.readableBoolean(bee.getGenome().getToleratesRain(), yes, no);
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERATES_RAIN)).getValue(), yes, no);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERATES_RAIN);
textLayout.newLineCompressed();
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
textLayout.newLine();
String displayText;
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
String displayTextKey = "for.bees.stock.pristine";
if (!bee.isNatural()) {
displayTextKey = "for.bees.stock.ignoble";
}
displayText = Translator.translateToLocal(displayTextKey);
textLayout.drawCenteredLine(displayText, 8, 208, guiAlyzer.getFontColor().get("gui.beealyzer.binomial"));
}
if (bee.getGeneration() >= 0) {
textLayout.newLineCompressed();
displayText = Translator.translateToLocalFormatted("for.gui.beealyzer.generations", bee.getGeneration());
textLayout.drawCenteredLine(displayText, 8, 208, guiAlyzer.getFontColor().get("gui.beealyzer.binomial"));
}
textLayout.endPage();
}
textLayout.endPage();
}
@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack) {
IBee bee = BeeManager.beeRoot.getMember(itemStack);
if (bee == null) {
return;
}
TextLayoutHelper textLayout = gui.getTextLayout();
WidgetManager widgetManager = gui.getWidgetManager();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
textLayout.newLine();
int x = GuiAlyzer.COLUMN_0;
for (ItemStack stack : bee.getProduceList()) {
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
x += 18;
if (x > 148) {
x = GuiAlyzer.COLUMN_0;
textLayout.newLine();
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
if(gui instanceof GuiAlyzer){
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
IBee bee = BeeManager.beeRoot.getMember(itemStack);
if (bee == null) {
return;
}
}
textLayout.newLine();
textLayout.newLine();
textLayout.newLine();
textLayout.newLine();
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
textLayout.newLine();
x = GuiAlyzer.COLUMN_0;
for (ItemStack stack : bee.getSpecialtyList()) {
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
x += 18;
if (x > 148) {
x = GuiAlyzer.COLUMN_0;
textLayout.newLine();
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
WidgetManager widgetManager = guiAlyzer.getWidgetManager();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
textLayout.newLine();
int x = GuiAlyzer.COLUMN_0;
for (ItemStack stack : bee.getProduceList()) {
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
x += 18;
if (x > 148) {
x = GuiAlyzer.COLUMN_0;
textLayout.newLine();
}
}
textLayout.newLine();
textLayout.newLine();
textLayout.newLine();
textLayout.newLine();
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
textLayout.newLine();
x = GuiAlyzer.COLUMN_0;
for (ItemStack stack : bee.getSpecialtyList()) {
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
x += 18;
if (x > 148) {
x = GuiAlyzer.COLUMN_0;
textLayout.newLine();
}
}
textLayout.endPage();
}
textLayout.endPage();
}
@Override
@@ -21,7 +21,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.MinecraftForge;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.EnumBeeType;
@@ -32,6 +32,7 @@ import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeMutationBuilder;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
import forestry.api.genetics.IAllele;
import forestry.apiculture.PluginApiculture;
import forestry.apiculture.genetics.alleles.AlleleEffect;
@@ -1019,6 +1020,7 @@ public enum BeeDefinition implements IBeeDefinition {
for (BeeDefinition bee : values()) {
bee.registerMutations();
}
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(BeeManager.beeRoot));
}
public static void preInit() {
@@ -45,7 +45,7 @@ public class BeeMutation extends Mutation implements IBeeMutation, IBeeMutationB
World world = housing.getWorldObj();
BlockPos housingPos = housing.getCoordinates();
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1);
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1, housing);
if (processedChance <= 0) {
return 0;
}
@@ -1,9 +1,15 @@
package forestry.apiculture.genetics.alleles;
import java.util.List;
import java.util.Random;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import forestry.core.genetics.EffectData;
import forestry.core.utils.VectUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockMushroom;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.init.Blocks;
@@ -11,12 +17,6 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import forestry.core.genetics.EffectData;
public class AlleleEffectFungification extends AlleleEffectThrottled {
@@ -24,7 +24,7 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
private static final int ENTITY_THROTTLE = 6;
public AlleleEffectFungification() {
super("mycophilic", true, 10, false, false);
super("mycophilic", true, 20, false, false);
}
@Override
@@ -57,50 +57,51 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
World world = housing.getWorldObj();
BlockPos housingCoordinates = housing.getCoordinates();
Vec3i area = getModifiedArea(genome, housing);
int blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX());
int blockY = getRandomOffset(world.rand, housingCoordinates.getY(), area.getY());
int blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ());
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
BlockPos pos = new BlockPos(blockX, blockY, blockZ);
Block block = world.getBlockState(pos).getBlock();
if (isSuitableForMycelium(world, block, pos)) {
world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState());
break;
} else if (isSuitableForGrowth(block)) {
doMushroomGrowth(block, world, pos);
break;
}
blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX());
blockY = getRandomOffset(world.rand, housingCoordinates.getY(), area.getY());
blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ());
}
Vec3i halfArea = new Vec3i(area.getX() / 2, area.getY() / 2, area.getZ() / 2);
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
BlockPos pos = VectUtil.getRandomPositionInArea(world.rand, area).subtract(halfArea).add(housingCoordinates);
IBlockState blockState = world.getBlockState(pos);
if (convertToMycelium(world, blockState, pos)) {
return;
} else if (growGiantMushroom(world, blockState, pos)) {
return;
}
}
}
private static void doEntityEffect(IBeeGenome genome, IBeeHousing housing) {
List<EntityCow> cows = getEntitiesInRange(genome, housing, EntityCow.class);
for (EntityCow cow : cows) {
convertCowToMooshroom(cow);
if (convertCowToMooshroom(cow)) {
return;
}
}
}
private static int getRandomOffset(Random random, int centrePos, int offset) {
return centrePos + random.nextInt(offset) - offset / 2;
}
private static boolean isSuitableForMycelium(World world, Block block, BlockPos pos) {
return block == Blocks.GRASS || block == Blocks.DIRT && world.canBlockSeeSky(pos);
private static boolean convertToMycelium(World world, IBlockState blockState, BlockPos pos) {
Block block = blockState.getBlock();
if (block == Blocks.GRASS || block == Blocks.DIRT && world.canBlockSeeSky(pos)) {
world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState());
return true;
}
return false;
}
private static boolean isSuitableForGrowth(Block block) {
return block == Blocks.RED_MUSHROOM || block == Blocks.BROWN_MUSHROOM;
private static boolean growGiantMushroom(World world, IBlockState blockState, BlockPos pos) {
Block block = blockState.getBlock();
if (block instanceof BlockMushroom) {
BlockMushroom mushroom = (BlockMushroom) block;
mushroom.generateBigMushroom(world, pos, blockState, world.rand);
return true;
}
return false;
}
private static void convertCowToMooshroom(EntityCow cow) {
private static boolean convertCowToMooshroom(EntityCow cow) {
if (cow instanceof EntityMooshroom) {
return;
return false;
}
World worldObj = cow.worldObj;
cow.setDead();
@@ -110,14 +111,6 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
mooshroom.renderYawOffset = cow.renderYawOffset;
worldObj.spawnEntityInWorld(mooshroom);
worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, cow.posX, cow.posY + cow.height / 2.0F, cow.posZ, 0.0D, 0.0D, 0.0D);
}
private static void doMushroomGrowth(Block block, World world, BlockPos pos) {
WorldGenBigMushroom giantMushroomGenerator;
giantMushroomGenerator = new WorldGenBigMushroom(block);
world.setBlockToAir(pos);
giantMushroomGenerator.generate(world, world.rand, pos);
return true;
}
}
@@ -22,15 +22,14 @@ import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeekeepingMode;
import forestry.api.apiculture.IHiveFrame;
import forestry.apiculture.InventoryBeeHousing;
import forestry.core.access.IAccessHandler;
import forestry.core.utils.SlotUtil;
public class InventoryApiary extends InventoryBeeHousing implements IApiaryInventory {
public static final int SLOT_FRAMES_1 = 9;
public static final int SLOT_FRAMES_COUNT = 3;
public InventoryApiary(IAccessHandler accessHandler) {
super(12, accessHandler);
public InventoryApiary() {
super(12);
}
@Override
@@ -12,17 +12,6 @@ package forestry.apiculture.items;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.ForestryAPI;
@@ -36,6 +25,15 @@ import forestry.apiculture.inventory.ItemInventoryHabitatLocator;
import forestry.apiculture.render.TextureHabitatLocator;
import forestry.core.items.ItemWithGui;
import forestry.core.utils.Translator;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemHabitatLocator extends ItemWithGui implements ISpriteRegister {
private static final String iconName = "forestry:items/biomefinder";
@@ -69,6 +67,8 @@ public class ItemHabitatLocator extends ItemWithGui implements ISpriteRegister {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> list, boolean flag) {
super.addInformation(itemstack, player, list, flag);
Biome currentBiome = player.worldObj.getBiome(player.getPosition());
float temperatureValue = ForestryAPI.climateManager.getTemperature(player.worldObj, player.getPosition());
@@ -66,7 +66,8 @@ public class ItemMinecartBeehouse extends ItemMinecart implements IItemModelRegi
} else {
entityMinecart = new EntityMinecartApiary(worldIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F);
}
entityMinecart.setOwner(playerIn.getGameProfile());
entityMinecart.getOwnerHandler().setOwner(playerIn.getGameProfile());
if (stack.hasDisplayName()) {
entityMinecart.setCustomNameTag(stack.getDisplayName());
@@ -1,7 +1,10 @@
package forestry.apiculture.items;
import java.util.List;
import forestry.api.apiculture.IArmorApiarist;
import forestry.api.apiculture.IHiveTile;
import forestry.api.core.Tabs;
import forestry.core.items.ItemForestry;
import forestry.core.proxy.Proxies;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -9,20 +12,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import forestry.api.apiculture.IArmorApiarist;
import forestry.api.apiculture.IHiveTile;
import forestry.api.core.Tabs;
import forestry.core.items.ItemForestry;
import forestry.core.proxy.Proxies;
import forestry.core.utils.Translator;
public class ItemSmoker extends ItemForestry implements IArmorApiarist {
public ItemSmoker() {
super(Tabs.tabApiculture);
@@ -106,12 +102,6 @@ public class ItemSmoker extends ItemForestry implements IArmorApiarist {
return 32;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
super.addInformation(stack, playerIn, tooltip, advanced);
tooltip.add(Translator.translateToLocal("item.for.smoker.description"));
}
@Override
public boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect) {
return true;
@@ -15,31 +15,21 @@ import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeHousingInventory;
import forestry.api.apiculture.IBeeListener;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.apiculture.IBeekeepingLogic;
import forestry.api.climate.IClimateControlled;
import forestry.api.core.BiomeHelper;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.ForestryAPI;
import forestry.api.core.IClimateControlled;
import forestry.api.multiblock.IAlvearyComponent;
import forestry.api.multiblock.IMultiblockComponent;
import forestry.apiculture.AlvearyBeeModifier;
import forestry.apiculture.InventoryBeeHousing;
import forestry.core.access.EnumAccess;
import forestry.core.inventory.FakeInventoryAdapter;
import forestry.core.inventory.IInventoryAdapter;
import forestry.core.multiblock.IMultiblockControllerInternal;
@@ -50,9 +40,17 @@ import forestry.core.network.DataOutputStreamForestry;
import forestry.core.proxy.Proxies;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.Translator;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public class AlvearyController extends RectangularMultiblockControllerBase implements IAlvearyControllerInternal, IClimateControlled {
@Nonnull
private final InventoryBeeHousing inventory;
private final IBeekeepingLogic beekeepingLogic;
@@ -71,12 +69,13 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
public AlvearyController(World world) {
super(world, AlvearyMultiblockSizeLimits.instance);
this.inventory = new InventoryBeeHousing(9, getAccessHandler());
this.inventory = new InventoryBeeHousing(9);
this.beekeepingLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
this.beeModifiers.add(new AlvearyBeeModifier());
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return inventory;
@@ -340,20 +339,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
return new Vec3d(coord.getX() + 0.5, coord.getY() + 1.5, coord.getZ() + 0.5);
}
@Override
public void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess) {
if (oldAccess == EnumAccess.SHARED || newAccess == EnumAccess.SHARED) {
// pipes connected to this need to update
for (IMultiblockComponent part : connectedParts) {
if (part instanceof TileEntity) {
TileEntity tile = (TileEntity) part;
worldObj.notifyBlockOfStateChange(tile.getPos(), tile.getBlockType());
}
}
markDirty();
}
}
@Override
public float getExactTemperature() {
BlockPos coords = getReferenceCoord();
@@ -369,8 +354,11 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
@Override
public EnumTemperature getTemperature() {
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(this);
if (beeModifier.isHellish() && tempChange >= 0) {
return EnumTemperature.HELLISH;
Biome biome = getBiome();
if (beeModifier.isHellish() || BiomeHelper.isBiomeHellish(biome)) {
if (tempChange >= 0) {
return EnumTemperature.HELLISH;
}
}
return EnumTemperature.getFromValue(getExactTemperature());
@@ -383,7 +371,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
@Override
public GameProfile getOwner() {
return getAccessHandler().getOwner();
return getOwnerHandler().getOwner();
}
@Override
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.multiblock;
import javax.annotation.Nonnull;
import java.util.Collections;
import net.minecraft.util.math.BlockPos;
@@ -45,6 +46,7 @@ public class FakeAlvearyController extends FakeMultiblockController implements I
return Collections.emptyList();
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return FakeBeeHousingInventory.instance;
@@ -11,13 +11,13 @@
package forestry.apiculture.multiblock;
import forestry.api.multiblock.IAlvearyController;
import forestry.core.access.IRestrictedAccess;
import forestry.core.owner.IOwnedTile;
import forestry.core.inventory.IInventoryAdapter;
import forestry.core.multiblock.IMultiblockControllerInternal;
import forestry.core.network.IStreamableGui;
import forestry.core.tiles.IClimatised;
public interface IAlvearyControllerInternal extends IAlvearyController, IMultiblockControllerInternal, IClimatised, IRestrictedAccess, IStreamableGui {
public interface IAlvearyControllerInternal extends IAlvearyController, IMultiblockControllerInternal, IClimatised, IOwnedTile, IStreamableGui {
IInventoryAdapter getInternalInventory();
int getHealthScaled(int i);
@@ -10,9 +10,12 @@
******************************************************************************/
package forestry.apiculture.multiblock;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.List;
import forestry.core.owner.IOwnedTile;
import forestry.core.owner.IOwnerHandler;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
@@ -33,9 +36,6 @@ import forestry.api.multiblock.IMultiblockController;
import forestry.apiculture.blocks.BlockAlvearyType;
import forestry.apiculture.gui.ContainerAlveary;
import forestry.apiculture.gui.GuiAlveary;
import forestry.core.access.EnumAccess;
import forestry.core.access.IAccessHandler;
import forestry.core.access.IRestrictedAccess;
import forestry.core.config.Config;
import forestry.core.gui.IHintSource;
import forestry.core.inventory.IInventoryAdapter;
@@ -46,7 +46,7 @@ import forestry.core.network.IStreamableGui;
import forestry.core.tiles.IClimatised;
import forestry.core.tiles.ITitled;
public abstract class TileAlveary extends MultiblockTileEntityForestry<MultiblockLogicAlveary> implements IBeeHousing, IAlvearyComponent, IRestrictedAccess, IStreamableGui, ITitled, IClimatised, IHintSource {
public abstract class TileAlveary extends MultiblockTileEntityForestry<MultiblockLogicAlveary> implements IBeeHousing, IAlvearyComponent, IOwnedTile, IStreamableGui, ITitled, IClimatised, IHintSource {
private final String unlocalizedTitle;
protected TileAlveary() {
@@ -99,6 +99,7 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
return getMultiblockLogic().getController().getBeeListeners();
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return getMultiblockLogic().getController().getBeeInventory();
@@ -141,13 +142,8 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
}
@Override
public IAccessHandler getAccessHandler() {
return getMultiblockLogic().getController().getAccessHandler();
}
@Override
public void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess) {
getMultiblockLogic().getController().onSwitchAccess(oldAccess, newAccess);
public IOwnerHandler getOwnerHandler() {
return getMultiblockLogic().getController().getOwnerHandler();
}
@Override
@@ -11,20 +11,22 @@
package forestry.apiculture.multiblock;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import forestry.api.core.IClimateControlled;
import forestry.api.climate.IClimateControlled;
import forestry.api.multiblock.IAlvearyComponent;
import forestry.apiculture.network.packets.PacketActiveUpdate;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IActivatable;
import forestry.energy.EnergyHelper;
import forestry.energy.EnergyManager;
import forestry.energy.EnergyTransferMode;
import forestry.energy.compat.rf.IEnergyReceiverDelegated;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import cofh.api.energy.IEnergyReceiver;
public abstract class TileAlvearyClimatiser extends TileAlveary implements IEnergyReceiver, IActivatable, IAlvearyComponent.Climatiser {
public abstract class TileAlvearyClimatiser extends TileAlveary implements IEnergyReceiverDelegated, IActivatable, IAlvearyComponent.Climatiser {
private static final int WORK_CYCLES = 1;
private static final int ENERGY_PER_OPERATION = 50;
@@ -49,13 +51,13 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
this.definition = definition;
this.energyManager = new EnergyManager(1000, 2000);
this.energyManager.setReceiveOnly();
this.energyManager.setExternalMode(EnergyTransferMode.RECEIVE);
}
/* UPDATING */
@Override
public void changeClimate(int tick, IClimateControlled climateControlled) {
if (workingTime < 20 && energyManager.consumeEnergyToDoWork(WORK_CYCLES, ENERGY_PER_OPERATION)) {
if (workingTime < 20 && EnergyHelper.consumeEnergyToDoWork(energyManager, WORK_CYCLES, ENERGY_PER_OPERATION)) {
// one tick of work for every 10 RF
workingTime += ENERGY_PER_OPERATION / 10;
}
@@ -122,25 +124,23 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
}
}
/* IEnergyHandler */
@Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) {
return energyManager.receiveEnergy(from, maxReceive, simulate);
public EnergyManager getEnergyManager() {
return energyManager;
}
@Override
public int getEnergyStored(EnumFacing from) {
return energyManager.getEnergyStored(from);
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return energyManager.hasCapability(capability) || super.hasCapability(capability, facing);
}
@Nonnull
@Override
public int getMaxEnergyStored(EnumFacing from) {
return energyManager.getMaxEnergyStored(from);
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
T energyCapability = energyManager.getCapability(capability);
if (energyCapability != null) {
return energyCapability;
}
return super.getCapability(capability, facing);
}
@Override
public boolean canConnectEnergy(EnumFacing from) {
return energyManager.canConnectEnergy(from);
}
}
@@ -22,8 +22,7 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import forestry.api.core.IClimateControlled;
import forestry.api.climate.IClimateControlled;
import forestry.api.multiblock.IAlvearyComponent;
import forestry.apiculture.blocks.BlockAlvearyType;
import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
@@ -1,10 +1,13 @@
package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import forestry.api.apiculture.IBeeHousingInventory;
public class FakeBeeHousingInventory implements IBeeHousingInventory {
@Nonnull
public static final FakeBeeHousingInventory instance = new FakeBeeHousingInventory();
private FakeBeeHousingInventory() {
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -30,15 +31,19 @@ import forestry.apiculture.inventory.IApiaryInventory;
import forestry.apiculture.inventory.InventoryApiary;
public class TileApiary extends TileBeeHousingBase implements IApiary {
@Nonnull
private final IBeeModifier beeModifier = new ApiaryBeeModifier();
@Nonnull
private final IBeeListener beeListener = new ApiaryBeeListener(this);
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
@Nonnull
private final InventoryApiary inventory = new InventoryApiary();
public TileApiary() {
super("apiary");
setInternalInventory(inventory);
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return inventory;
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import java.util.Collections;
import net.minecraft.entity.player.EntityPlayer;
@@ -24,20 +25,24 @@ import forestry.apiculture.gui.ContainerBeeHousing;
import forestry.apiculture.gui.GuiBeeHousing;
public class TileBeeHouse extends TileBeeHousingBase {
@Nonnull
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
@Nonnull
private final IBeeListener beeListener;
@Nonnull
private final InventoryBeeHousing beeInventory;
public TileBeeHouse() {
super("bee.house");
this.beeListener = new DefaultBeeListener();
beeInventory = new InventoryBeeHousing(12, getAccessHandler());
beeInventory = new InventoryBeeHousing(12);
beeInventory.disableAutomation();
setInternalInventory(beeInventory);
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return beeInventory;
@@ -13,13 +13,7 @@ package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import java.io.IOException;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeekeepingLogic;
@@ -30,11 +24,19 @@ import forestry.apiculture.gui.IGuiBeeHousingInventory;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.IStreamableGui;
import forestry.core.owner.IOwnedTile;
import forestry.core.owner.IOwnerHandler;
import forestry.core.owner.OwnerHandler;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IClimatised;
import forestry.core.tiles.TileBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing, IClimatised, IGuiBeeHousingInventory, IStreamableGui {
public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing, IOwnedTile, IClimatised, IGuiBeeHousingInventory, IStreamableGui {
private final OwnerHandler ownerHandler = new OwnerHandler();
private final IBeekeepingLogic beeLogic;
private Biome cachedBiome;
@@ -57,6 +59,7 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
beeLogic.writeToNBT(nbttagcompound);
ownerHandler.writeToNBT(nbttagcompound);
return nbttagcompound;
}
@@ -64,6 +67,7 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
beeLogic.readFromNBT(nbttagcompound);
ownerHandler.readFromNBT(nbttagcompound);
}
@Nonnull
@@ -71,6 +75,7 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
public NBTTagCompound getUpdateTag() {
NBTTagCompound updateTag = super.getUpdateTag();
beeLogic.writeToNBT(updateTag);
ownerHandler.writeToNBT(updateTag);
return updateTag;
}
@@ -78,6 +83,12 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
super.handleUpdateTag(tag);
beeLogic.readFromNBT(tag);
ownerHandler.readFromNBT(tag);
}
@Override
public IOwnerHandler getOwnerHandler() {
return ownerHandler;
}
/* ICLIMATISED */
@@ -171,7 +182,7 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
@Override
public GameProfile getOwner() {
return getAccessHandler().getOwner();
return getOwnerHandler().getOwner();
}
@Override
@@ -15,26 +15,8 @@ import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
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;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import com.google.common.base.Predicate;
import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
@@ -62,6 +44,27 @@ import forestry.core.tiles.IActivatable;
import forestry.core.utils.DamageSourceForestry;
import forestry.core.utils.InventoryUtil;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.IMob;
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;
import net.minecraft.util.EntitySelectors;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public class TileHive extends TileEntity implements ITickable, IHiveTile, IActivatable, IBeeHousing {
private static final DamageSource damageSourceBeeHive = new DamageSourceForestry("bee.hive");
@@ -74,6 +77,9 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
private final BeekeepingLogic beeLogic;
@Nonnull
private final IErrorLogic errorLogic;
@Nonnull
private final Predicate<EntityLivingBase> beeTargetPredicate;
private IBee containedBee = null;
private boolean active = false;
private boolean angry = false;
@@ -89,6 +95,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
inventory = new HiveBeeHousingInventory(this);
beeLogic = new BeekeepingLogic(this);
errorLogic = ForestryAPI.errorStateRegistry.createErrorLogic();
beeTargetPredicate = new BeeTargetPredicate(this);
}
@Override
@@ -113,7 +120,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
if (calmTime == 0) {
if (canWork) {
AxisAlignedBB boundingBox = AlleleEffect.getBounding(getContainedBee().getGenome(), this);
List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox);
List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox, beeTargetPredicate);
if (!entities.isEmpty()) {
Collections.shuffle(entities);
EntityLivingBase entity = entities.get(0);
@@ -293,6 +300,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
return Collections.emptyList();
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return inventory;
@@ -356,4 +364,28 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
return getPos();
}
private static class BeeTargetPredicate implements Predicate<EntityLivingBase> {
@Nonnull
private final IHiveTile hive;
public BeeTargetPredicate(@Nonnull IHiveTile hive) {
this.hive = hive;
}
@Override
public boolean apply(@Nullable EntityLivingBase input) {
if (input != null && input.isEntityAlive() && !input.isInvisible()) {
if (input instanceof EntityPlayer) {
return EntitySelectors.CAN_AI_TARGET.apply(input);
} else if (hive.isAngry()) {
return true;
} else if (input instanceof IMob) {
// don't attack semi-passive vanilla mobs
return !(input instanceof EntityEnderman) && !(input instanceof EntityPigZombie);
}
}
return false;
}
}
}
@@ -62,7 +62,7 @@ public enum HiveDescription implements IHiveDescription {
}
},
JUNGLE(IHiveRegistry.HiveType.JUNGLE, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
END(IHiveRegistry.HiveType.END, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) {
END(IHiveRegistry.HiveType.END, 2.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) {
@Override
public boolean isGoodBiome(Biome biome) {
return BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END);
@@ -17,7 +17,7 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.BlockStairs;
@@ -57,9 +57,8 @@ import forestry.apiculture.flowers.Flower;
import forestry.apiculture.flowers.FlowerRegistry;
import forestry.apiculture.tiles.TileBeeHouse;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.blocks.log.BlockArbLog;
import forestry.core.PluginCore;
import forestry.core.blocks.BlockCore;
import forestry.core.blocks.BlockBase;
import forestry.core.config.Constants;
import forestry.core.tiles.TileUtil;
import forestry.plugins.ForestryPluginUids;
@@ -140,9 +139,9 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
fillWithBlocks(world, structBoundingBox, 8, 1, 6, 8, 1, 10, fence, fence, false);
fillWithBlocks(world, structBoundingBox, 2, 1, 10, 7, 1, 10, fence, fence, false);
setBlockState(world, fenceGate.withProperty(BlockFenceGate.FACING, EnumFacing.EAST), 8, 1, 8, structBoundingBox);
setBlockState(world, fenceGate.withProperty(BlockFenceGate.FACING, EnumFacing.EAST), 1, 1, 8, structBoundingBox);
setBlockState(world, fenceGate.withProperty(BlockFenceGate.FACING, EnumFacing.NORTH), 4, 1, 10, structBoundingBox);
setBlockState(world, fenceGate.withProperty(BlockHorizontal.FACING, EnumFacing.EAST), 8, 1, 8, structBoundingBox);
setBlockState(world, fenceGate.withProperty(BlockHorizontal.FACING, EnumFacing.EAST), 1, 1, 8, structBoundingBox);
setBlockState(world, fenceGate.withProperty(BlockHorizontal.FACING, EnumFacing.NORTH), 4, 1, 10, structBoundingBox);
// Flowers
plantFlowerGarden(world, structBoundingBox, 2, 1, 5, 7, 1, 9);
@@ -171,7 +170,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
IBlockState slabCeiling = slabs.withProperty(BlockSlab.HALF, BlockSlab.EnumBlockHalf.TOP);
fillWithBlocks(world, structBoundingBox, 1, 4, 1, 7, 4, 4, slabCeiling, slabCeiling, false);
IBlockState logBracing = logs.withProperty(BlockArbLog.LOG_AXIS, BlockLog.EnumAxis.X);
IBlockState logBracing = logs.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X);
fillWithBlocks(world, structBoundingBox, 0, 4, 1, 8, 4, 1, logBracing, logBracing, false);
fillWithBlocks(world, structBoundingBox, 0, 4, 4, 8, 4, 4, logBracing, logBracing, false);
@@ -219,7 +218,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
// Escritoire
if (random.nextInt(2) == 0) {
IBlockState escritoireBlock = PluginCore.blocks.escritoire.getDefaultState().withProperty(BlockCore.FACING, EnumFacing.EAST);
IBlockState escritoireBlock = PluginCore.blocks.escritoire.getDefaultState().withProperty(BlockBase.FACING, EnumFacing.EAST);
setBlockState(world, escritoireBlock, 1, 1, 3, structBoundingBox);
}
@@ -0,0 +1,80 @@
/*******************************************************************************
* 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.arboriculture;
import forestry.api.core.CamouflageManager;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflageItemHandler;
import forestry.api.core.ICamouflagedTile;
import forestry.arboriculture.items.ItemBlockWoodDoor;
import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class CamouflageHandlerArbDoor implements ICamouflageItemHandler {
@Override
public boolean canHandle(ItemStack stack) {
if(stack == null || stack.getItem() == null || stack.stackSize <= 0){
return false;
}
if(stack.getItem() instanceof ItemBlockWoodDoor){
return true;
}
return false;
}
@Override
public String getType() {
return CamouflageManager.DOOR;
}
@Override
public float getLightTransmittance(ItemStack stack, ICamouflageHandler camouflageHandler) {
return 0F;
}
@SideOnly(Side.CLIENT)
@Override
public Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile) {
if(camouflageHandler == null || stack == null || stack.getItem() == null || stack.stackSize <= 0 || !(stack.getItem() instanceof ItemBlockWoodDoor)){
return null;
}
World world = camouflageHandler.getWorldObj();
BlockPos pos = camouflageTile.getCoordinates();
IBlockState blockState = world.getBlockState(pos);
IBlockState currentState = blockState.getActualState(world, pos);
ItemBlockWoodDoor itemDoor = (ItemBlockWoodDoor) stack.getItem();
IBlockState doorState = itemDoor.block.getDefaultState()
.withProperty(BlockDoor.FACING, currentState.getValue(BlockDoor.FACING))
.withProperty(BlockDoor.HINGE, currentState.getValue(BlockDoor.HINGE))
.withProperty(BlockDoor.OPEN, currentState.getValue(BlockDoor.OPEN))
.withProperty(BlockDoor.POWERED, currentState.getValue(BlockDoor.POWERED))
.withProperty(BlockDoor.HALF, currentState.getValue(BlockDoor.HALF));
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
return Pair.of(doorState, modelShapes.getModelForState(doorState));
}
}
@@ -11,8 +11,8 @@
package forestry.arboriculture;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collection;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.WoodBlockKind;
@@ -16,6 +16,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.Map.Entry;
import forestry.api.arboriculture.EnumForestryWoodType;
import forestry.api.arboriculture.EnumGermlingType;
@@ -27,6 +28,7 @@ import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import forestry.api.core.CamouflageManager;
import forestry.api.core.ForestryAPI;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.ILeafTranslator;
@@ -53,8 +55,10 @@ import forestry.arboriculture.items.ItemCharcoal;
import forestry.arboriculture.items.ItemGrafter;
import forestry.arboriculture.items.ItemRegistryArboriculture;
import forestry.arboriculture.models.TextureLeaves;
import forestry.arboriculture.models.WoodTextures;
import forestry.arboriculture.network.PacketRegistryArboriculture;
import forestry.arboriculture.proxy.ProxyArboriculture;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
import forestry.arboriculture.tiles.TileFruitPod;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.arboriculture.tiles.TilePile;
@@ -66,7 +70,9 @@ import forestry.core.fluids.Fluids;
import forestry.core.genetics.alleles.AllelePlantType;
import forestry.core.items.ItemFruit.EnumFruit;
import forestry.core.network.IPacketRegistry;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.render.TextureManager;
import forestry.core.utils.IMCUtil;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.OreDictUtil;
@@ -87,7 +93,9 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
@@ -173,6 +181,8 @@ public class PluginArboriculture extends BlankForestryPlugin {
// Commands
PluginCore.rootCommand.addChildCommand(new CommandTree());
CamouflageManager.camouflageAccess.registerCamouflageItemHandler(new CamouflageHandlerArbDoor());
}
@Override
@@ -198,7 +208,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
blocks.treeChest.init();
if (Config.enableVillagers) {
villagerArborist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_ARBORIST, Constants.TEXTURE_SKIN_LUMBERJACK);
villagerArborist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_ARBORIST, Constants.TEXTURE_SKIN_LUMBERJACK, Constants.TEXTURE_SKIN_ZOMBIE_LUMBERJACK);
VillagerRegistry.instance().register(villagerArborist);
VillagerRegistry.VillagerCareer arboristCareer = new VillagerRegistry.VillagerCareer(villagerArborist, "arborist");
@@ -409,7 +419,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
}
//Dirt Pile Block
RecipeUtil.addShapelessRecipe(new ItemStack(PluginArboriculture.blocks.piles.get(EnumPileType.DIRT)), OreDictUtil.DUST_ASH, Items.CLAY_BALL, OreDictUtil.DUST_ASH, OreDictUtil.DIRT, OreDictUtil.DIRT, OreDictUtil.DIRT, OreDictUtil.TREE_LEAVES, Items.CLAY_BALL, OreDictUtil.TREE_LEAVES);
RecipeUtil.addShapelessRecipe(new ItemStack(PluginArboriculture.blocks.piles.get(EnumPileType.DIRT)), PluginCore.items.fertilizerBio, Items.CLAY_BALL, PluginCore.items.fertilizerBio, OreDictUtil.DIRT, OreDictUtil.DIRT, OreDictUtil.DIRT, PluginCore.items.fertilizerBio, Items.CLAY_BALL, PluginCore.items.fertilizerBio);
}
@@ -548,9 +558,33 @@ public class PluginArboriculture extends BlankForestryPlugin {
@SideOnly(Side.CLIENT)
public void registerSprites(TextureStitchEvent.Pre event) {
TextureLeaves.registerAllSprites();
WoodTextures.deserializeFile(Proxies.render.getSelectedTexturePack());
for (IAlleleFruit alleleFruit : AlleleFruit.getFruitAlleles()) {
alleleFruit.getProvider().registerSprites();
}
List<ResourceLocation> textures = new ArrayList<>();
for(IWoodType type : TreeManager.woodAccess.getRegisteredWoodTypes()){
textures.add(new ResourceLocation(type.getHeartTexture()));
textures.add(new ResourceLocation(type.getBarkTexture()));
textures.add(new ResourceLocation(type.getDoorLowerTexture()));
textures.add(new ResourceLocation(type.getDoorUpperTexture()));
textures.add(new ResourceLocation(type.getPlankTexture()));
for(WoodBlockKind kind : WoodBlockKind.values()){
for(Entry<String, String> loc : WoodTextures.getLocations(type, kind).entrySet()){
textures.add(new ResourceLocation(loc.getValue()));
}
}
}
for(ResourceLocation loc : textures){
TextureManager.getInstance();
TextureManager.registerSprite(loc);
}
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onModelBake(ModelBakeEvent event) {
((ProxyArboricultureClient)proxy).onModelBake(event);
}
@SubscribeEvent
@@ -11,6 +11,8 @@
package forestry.arboriculture;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.HashMap;
@@ -43,6 +45,7 @@ import forestry.core.utils.Log;
public class WoodAccess implements IWoodAccess {
private static final Map<WoodBlockKind, WoodMap> woodMaps = new EnumMap<>(WoodBlockKind.class);
private static final List<IWoodType> registeredWoodTypes = new ArrayList<>();
static {
for (WoodBlockKind woodBlockKind : WoodBlockKind.values()) {
@@ -195,6 +198,9 @@ public class WoodAccess implements IWoodAccess {
int meta = woodTyped.getMetaFromState(blockState);
IWoodType woodType = woodTyped.getWoodType(meta);
ItemStack itemStack = new ItemStack(woodTyped, 1, meta);
if(!(woodType instanceof EnumVanillaWoodType)){
PluginArboriculture.proxy.registerWoodModel(woodTyped, true);
}
register(woodType, woodBlockKind, fireproof, blockState, itemStack);
}
}
@@ -207,6 +213,9 @@ public class WoodAccess implements IWoodAccess {
IBlockState blockState = woodTyped.getDefaultState();
IWoodType woodType = woodTyped.getWoodType(0);
ItemStack itemStack = new ItemStack(woodTyped);
if(!(woodType instanceof EnumVanillaWoodType)){
PluginArboriculture.proxy.registerWoodModel(woodTyped, false);
}
register(woodType, woodBlockKind, fireproof, blockState, itemStack);
}
@@ -218,6 +227,9 @@ public class WoodAccess implements IWoodAccess {
throw new NullPointerException("Invalid itemStack: " + itemStack);
}
WoodMap woodMap = woodMaps.get(woodBlockKind);
if(!registeredWoodTypes.contains(woodType)){
registeredWoodTypes.add(woodType);
}
woodMap.getItem(fireproof).put(woodType, itemStack);
woodMap.getBlock(fireproof).put(woodType, blockState);
}
@@ -249,4 +261,9 @@ public class WoodAccess implements IWoodAccess {
}
return blockState;
}
@Override
public List<IWoodType> getRegisteredWoodTypes() {
return registeredWoodTypes;
}
}
Loaded 100 of 1442 files, more files were not shown because too many files have changed in this diff. Show more