Compare commits

..
64 Commits
Author SHA1 Message Date
mezz b83da5c628 Merge branch 'mc-1.7.10' into 4.2 2016-03-22 12:29:14 -07:00
mezz 4a2af4743f Fix #1117 Radioactive bee effect can bypass apiarist suit 2016-03-22 12:28:31 -07:00
mezz e90771e38a Merge branch 'dev' into 4.2 2016-03-06 10:01:54 -08:00
mezz 9c98a6a00b Bump Version 2016-03-06 10:01:23 -08:00
mezz 75a3a7b935 Fix #1093 Electrical Engine circuit board does not sync 2016-03-06 10:00:22 -08:00
mezz 99020cde7f Fix #1086 Squeezer NEI integration can't lookup multi stack recipes. 2016-02-28 23:40:57 -08:00
mezz 98e13299d6 Fix #1061 Squeezer is very "liberal" regarding oredict in Recipes 2016-02-28 23:39:55 -08:00
mezz 010fe4662a Fix #1081 FillBucketHook does not check bucket type 2016-02-28 23:18:55 -08:00
mezz 92ee6dbc0d Merge branch 'dev' into 4.2 2016-02-22 15:34:50 -08:00
mezz 98c7b3b5ed Bump version 2016-02-22 15:34:21 -08:00
Nirek-K 507b03043e Add module checks to RotaryCraft plugin 2016-02-21 19:34:34 -06:00
mezz c1e00ff395 Do not save player profile properties to nbt 2016-02-19 19:08:17 -08:00
Nirek-K 897123c883 Add missing Snow diplacable tags for plugin flowers. 2016-02-19 13:14:00 -06:00
Nirek-K 0ed33cf9a3 Increase wax cast durability to 16, Fabricator tank to 8, Add 4 to 4 Plain glass Fabrication recipe, change stamp defs to be oreDictionary. 2016-02-19 12:41:35 -06:00
Nirek-K 8ba8c0fb17 Forgot Sandstone had variants. Add variants->Fabricator. 2016-02-18 06:25:16 -06:00
Nirek-K 9c40b03751 Tank should probably be a multiple of 2, derp. 2016-02-18 06:05:42 -06:00
Nirek-K 194c0a0e77 Add Red Sand, Sandstone to Fabricator->glass, slightly increase fabricator glasstank. 2016-02-18 05:51:30 -06:00
Nirek-K 77157aa9cb Add new pinecones from BoP to squeezable for seedoil. 2016-02-12 15:16:24 -06:00
Nirek-K f4681d251c Increase seed oil yield of Harvestcraft peanuts, and tree nuts to be slightly more viable oil sources. 2016-02-12 11:00:09 -06:00
mezz 96cc1b869c Merge branch 'dev' into 4.2 2016-02-11 17:36:46 -08:00
mezz 20ca044be0 Bump version 2016-02-11 17:36:30 -08:00
mezz 6cd9f33c3f Close #1060 Close #1065 Disable Growthcraft plugin for version 2.5.0+ 2016-02-11 17:35:21 -08:00
Nirek-K 7585c6a265 Fix #1067 add module checks to BoP Plugin 2016-02-11 00:48:38 -06:00
Nirek-K 91a5084bde Further cleanup GC plugin nulls. 2016-02-10 15:29:26 -06:00
Nirek-K 0876a50be2 Add missing null check to Growthcraft plugin. 2016-02-10 08:19:40 -06:00
mezz 1941690330 Merge branch 'dev' into 4.2 2016-02-01 18:06:09 -08:00
mezz bbd39ea5c7 Fix #1053 NPE when loading with old configs 2016-02-01 18:05:51 -08:00
mezz 53f4107ee3 Merge branch 'dev' into 4.2 2016-01-28 20:38:06 -08:00
mezz 6265c01f60 Bump version 2016-01-28 20:37:46 -08:00
Nirek-K b9478e16b7 Add Orchard farmland, dirt traversal for ic2 plants. 2016-01-24 15:49:31 -06:00
Nirek-K 2cdee67624 Add Carrots equal to Apples in the squeezer(juice/mulch), potatoes at double fermenter rate of wheat (choice between pure fermenting, and seeds for seedoil) 2016-01-24 03:35:55 -06:00
Nirek-K 58fe331fe3 And missed one in HC too. 2016-01-24 03:17:37 -06:00
Nirek-K a4d5117a97 Missed a check in BoP, also fix PlantMegaPack 2016-01-24 03:05:27 -06:00
Nirek-K 32a9a6ff5c Fix #1051 Check for Farming module before adding BoP and Harvestcraft crops. 2016-01-24 02:19:15 -06:00
mezz 9f2f2ed85b Fix #1043 Crash from mods spawning wood items with wildcard metadata 2016-01-15 20:07:54 -08:00
mezz 22258c2dac Merge branch 'dev' into 4.2 2016-01-11 07:40:17 -08:00
mezz e0c1c538aa Fix ClientTickEvent crash on disconnect from server 2016-01-10 21:04:35 -08:00
mezz 825768e522 Fix naturalist's eye lag on multiplayer servers 2016-01-01 11:55:39 -08:00
mezz dd21d83ea3 Merge branch 'dev' into 4.2 2015-12-30 04:39:13 -08:00
mezz d0ead16eaa Bump version to 4.2.4 2015-12-30 04:38:44 -08:00
mezz 1d924d5ed5 Merge pull request #1004 from estebes/dev
Add IC2 crops support to multifarms (uses orchard farm logic)
2015-12-30 04:37:20 -08:00
mezz ff7adac9e1 Fix #1001 Slabs can't combine on placement in same block 2015-12-30 04:34:23 -08:00
mezz 45993f8213 Fix #999 Forestry Wood Logs Placement Issue 2015-12-30 02:31:19 -08:00
mezz 33573fea20 Fix #1022 Indistinguishable pollination color for some tree species 2015-12-29 12:34:26 -08:00
mezz 178142bf7a Fix #922 New tree branching generates non-connected logs 2015-12-29 11:17:42 -08:00
mezz 5d2aaea757 Fix #1008 Backpack superposition bug 2015-12-29 09:40:37 -08:00
mezz fbb02e43f5 Limit packets from engines supplying power to nearly full receivers 2015-12-29 08:20:05 -08:00
mezz 896767ae1b auto format 2015-12-23 23:06:45 -08:00
mezz d11034e4aa Merge branch 'dev' into 4.2 2015-12-22 17:47:29 -08:00
mezz cc64b09ad4 Fix #1017 crash when accessing bee cart gui 2015-12-22 17:44:38 -08:00
mezz d5ebc02999 Fix BreedingTracker crash 2015-12-19 16:02:08 -08:00
mezz 8415b657f2 Use Forge 10.13.4.1566 fuel burn time workaround.
Fix #960 Fireproof wood have fuel value,
Fix #469 Burn time of wooden slabs should be 150 ticks
2015-12-13 13:47:55 -08:00
mezz f0099b728f Merge branch 'dev' into 4.2 2015-12-12 22:52:38 -08:00
mezz 1ceccddbd0 Fix sync issues with researched mutations, use smaller packets 2015-12-12 22:51:59 -08:00
mezz c875e8ed5d Merge branch 'dev' into 4.2 2015-12-12 18:10:38 -08:00
mezz f3ee4f8694 Bump version to 4.2.2 2015-12-12 18:09:51 -08:00
mezz c2437a8a13 Fix #1009 Minor fluid dupe on right-clicking nearly-full machine 2015-12-12 18:08:40 -08:00
mezz e2f32ab767 Sync mail to client on login, do not display mail indicator on logout 2015-12-12 17:45:12 -08:00
mezz d0c8c92863 Fix #1010 Automatically sync breeding trackers to client 2015-12-12 17:27:18 -08:00
Nirek-K a8c84cfcf9 Possibly fix IE plugin loading too early, add small RotaryCraft plugin. 2015-12-11 12:06:28 -06:00
mezz 8f8f6a05f7 Fix #1006 Farm Block Recipes broken 2015-12-09 14:43:58 -08:00
mezz 721c8fd0ad Make AlleleEffectFertile only tick IGrowable and IPlantable 2015-12-08 18:22:16 -08:00
estebes 962a17494c Added IC2 crops support to multifarms (uses orchard farm logic) 2015-12-05 11:10:34 +00:00
mezz 01e43d8a18 #987 Use fluid names instead of IDs 2015-12-03 12:19:04 -08:00
96 changed files with 1083 additions and 384 deletions

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
mcversion=1.7.10
forgeversion=10.13.4.1541-1.7.10
forgeversion=10.13.4.1566-1.7.10
version_major=4
version_minor=2
version_patch=1
version_patch=11
+1 -1
Submodule lang updated: 265a8e573a...cb5900228e.
+5 -2
View File
@@ -17,6 +17,7 @@ import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -58,7 +59,7 @@ import forestry.plugins.PluginManager;
name = "Forestry",
version = Version.VERSION,
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
dependencies = "required-after:Forge@[10.13.4.1448,);"
dependencies = "required-after:Forge@[10.13.4.1566,);"
+ "after:Buildcraft|Core@[6.1.7,);"
+ "after:ExtrabiomesXL;"
+ "after:BiomesOPlenty;"
@@ -85,7 +86,9 @@ public class Forestry {
packetHandler = new PacketHandler();
// Register event handler
MinecraftForge.EVENT_BUS.register(new EventHandlerCore());
EventHandlerCore eventHandlerCore = new EventHandlerCore();
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
FMLCommonHandler.instance().bus().register(eventHandlerCore);
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
configFolder = new File(event.getModConfigurationDirectory(), "forestry");
@@ -20,7 +20,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeHousingInventory;
import forestry.api.apiculture.IBeeListener;
import forestry.api.apiculture.IBeeModifier;
@@ -112,7 +111,11 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
@Override
public Object getContainer(EntityPlayer player, int data) {
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
return new ContainerMinecartBeehouse(player.inventory, this, true);
}
@Override
public int getIdOfEntity() {
return getEntityId();
}
}
@@ -18,7 +18,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.DefaultBeeListener;
import forestry.api.apiculture.IBeeHousingInventory;
import forestry.api.apiculture.IBeeListener;
@@ -97,7 +96,11 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
@Override
public Object getContainer(EntityPlayer player, int data) {
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
return new ContainerMinecartBeehouse(player.inventory, this, false);
}
@Override
public int getIdOfEntity() {
return getEntityId();
}
}
@@ -225,7 +225,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
if (PluginManager.Module.AGRICRAFT.isEnabled()) {
Block cropBlock = GameRegistry.findBlock("AgriCraft", "crops");
if (block == cropBlock) {
if(block instanceof IPlantable) {
if (block instanceof IPlantable) {
//For agricraft versions which implement IPlantable in the BlockCrop class
block = ((IPlantable) block).getPlant(world, x, y, z);
} else {
@@ -13,8 +13,6 @@ package forestry.apiculture.genetics;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IApiaristTracker;
@@ -27,11 +25,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
/** Required for creation from map storage */
public ApiaristTracker(String s) {
this(s, null);
}
public ApiaristTracker(String s, GameProfile player) {
super(s, player);
super(s);
}
private int queensTotal = 0;
@@ -328,10 +328,13 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
// Create a tracker if there is none yet.
if (tracker == null) {
tracker = new ApiaristTracker(filename, player);
tracker = new ApiaristTracker(filename);
world.setItemData(filename, tracker);
}
tracker.setUsername(player);
tracker.setWorld(world);
return tracker;
}
@@ -13,9 +13,12 @@ package forestry.apiculture.genetics.alleles;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
@@ -58,8 +61,8 @@ public class AlleleEffectFertile extends AlleleEffectThrottled {
private static boolean tryTickColumn(World world, int x, int z, int maxY, int minY) {
for (int y = maxY; y >= minY; --y) {
if (!world.isAirBlock(x, y, z)) {
Block block = world.getBlock(x, y, z);
Block block = world.getBlock(x, y, z);
if (block.getTickRandomly() && (block instanceof IGrowable || block instanceof IPlantable)) {
world.scheduleBlockUpdate(x, y, z, block, 5);
return true;
}
@@ -49,7 +49,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
// Entities are not attacked if they wear a full set of apiarist's armor.
int count = BeeManager.armorApiaristHelper.wearsItems(entity, getUID(), true);
damage -= count;
damage -= (count * 2);
if (damage <= 0) {
continue;
}
@@ -13,7 +13,6 @@ package forestry.apiculture.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import forestry.api.apiculture.BeeManager;
import forestry.api.core.Tabs;
import forestry.apiculture.gui.GuiBeealyzer;
import forestry.apiculture.inventory.ItemInventoryBeealyzer;
@@ -22,7 +21,7 @@ import forestry.core.items.ItemWithGui;
public class ItemBeealyzer extends ItemWithGui {
public ItemBeealyzer() {
super(Tabs.tabApiculture);
setCreativeTab(Tabs.tabApiculture);
}
@Override
@@ -33,7 +32,6 @@ public class ItemBeealyzer extends ItemWithGui {
@Override
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
ItemInventoryBeealyzer inventory = new ItemInventoryBeealyzer(player, heldItem);
return new ContainerAlyzer(inventory, player);
}
@@ -41,7 +41,7 @@ public class ItemHabitatLocator extends ItemWithGui {
private final HabitatLocatorLogic locatorLogic;
public ItemHabitatLocator() {
super(Tabs.tabApiculture);
setCreativeTab(Tabs.tabApiculture);
setMaxStackSize(1);
locatorLogic = new HabitatLocatorLogic();
}
@@ -13,7 +13,6 @@ package forestry.apiculture.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import forestry.api.apiculture.BeeManager;
import forestry.api.core.Tabs;
import forestry.apiculture.gui.ContainerImprinter;
import forestry.apiculture.gui.GuiImprinter;
@@ -22,7 +21,7 @@ import forestry.core.items.ItemWithGui;
public class ItemImprinter extends ItemWithGui {
public ItemImprinter() {
super(Tabs.tabApiculture);
setCreativeTab(Tabs.tabApiculture);
}
@Override
@@ -32,7 +31,6 @@ public class ItemImprinter extends ItemWithGui {
@Override
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
return new ContainerImprinter(player.inventory, new ItemInventoryImprinter(player, heldItem));
}
}
@@ -21,7 +21,7 @@ public class ItemWaxCast extends ItemForestry implements ICraftingPlan {
public ItemWaxCast() {
super(Tabs.tabApiculture);
setMaxStackSize(1);
setMaxDamage(10);
setMaxDamage(16);
setNoRepair();
}
@@ -18,7 +18,6 @@ import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.Vec3;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeHousingInventory;
import forestry.api.apiculture.IBeeListener;
@@ -195,7 +194,6 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
@Override
public Object getContainer(EntityPlayer player, int data) {
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
return new ContainerAlveary(player.inventory, this);
}
}
@@ -23,7 +23,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeHousingInventory;
import forestry.api.apiculture.IBeeListener;
import forestry.api.apiculture.IBeeModifier;
@@ -96,7 +95,6 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
@Override
public Object getContainer(EntityPlayer player, int data) {
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
return new ContainerBeeHousing(player.inventory, this, true);
}
}
@@ -14,7 +14,6 @@ import java.util.Collections;
import net.minecraft.entity.player.EntityPlayer;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.DefaultBeeListener;
import forestry.api.apiculture.IBeeHousingInventory;
import forestry.api.apiculture.IBeeListener;
@@ -62,7 +61,6 @@ public class TileBeehouse extends TileBeeHousingBase {
@Override
public Object getContainer(EntityPlayer player, int data) {
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
return new ContainerBeeHousing(player.inventory, this, false);
}
}
@@ -36,6 +36,7 @@ public class FruitProviderPod extends FruitProviderNone {
PAPAYA((short) 2013, (short) 2014, (short) 2015);//, COCONUT((short)2016, (short)2017, (short)2018);
public final short[] uids;
EnumPodType(short stage1, short stage2, short stage3) {
uids = new short[]{stage1, stage2, stage3};
}
@@ -10,8 +10,6 @@
******************************************************************************/
package forestry.arboriculture.blocks;
import javax.annotation.Nullable;
import forestry.arboriculture.tiles.TileArboristChest;
import forestry.core.blocks.IMachinePropertiesTESR;
import forestry.core.proxy.Proxies;
@@ -46,8 +46,9 @@ public class BlockPlanks extends BlockWood {
@Override
public IIcon getIcon(int side, int meta) {
EnumWoodType woodType = EnumWoodType.LARCH;
if (meta > 0 && meta < EnumWoodType.VALUES.length)
if (meta > 0 && meta < EnumWoodType.VALUES.length) {
woodType = EnumWoodType.VALUES[meta];
}
return IconProviderWood.getPlankIcon(woodType);
}
@@ -12,6 +12,7 @@ package forestry.arboriculture.blocks;
import forestry.arboriculture.items.ItemBlockLeaves;
import forestry.arboriculture.items.ItemBlockWood;
import forestry.arboriculture.items.ItemBlockWoodSlab;
import forestry.core.blocks.BlockRegistry;
import forestry.core.items.ItemBlockForestry;
@@ -19,11 +20,13 @@ public class BlockRegistryArboriculture extends BlockRegistry {
public final BlockLog logs;
public final BlockPlanks planks;
public final BlockSlab slabs;
public final BlockSlab slabsDouble;
public final BlockArbFence fences;
public final BlockArbStairs stairs;
public final BlockLog logsFireproof;
public final BlockPlanks planksFireproof;
public final BlockSlab slabsFireproof;
public final BlockSlab slabsDoubleFireproof;
public final BlockArbFence fencesFireproof;
public final BlockArbStairs stairsFireproof;
@@ -40,9 +43,13 @@ public class BlockRegistryArboriculture extends BlockRegistry {
planks = registerBlock(new BlockPlanks(false), ItemBlockWood.class, "planks");
registerOreDictWildcard("plankWood", planks);
slabs = registerBlock(new BlockSlab(false), ItemBlockWood.class, "slabs");
BlockSlab blockSlab = new BlockSlab(false, false);
BlockSlab blockSlabDouble = new BlockSlab(true, false);
slabs = registerBlock(blockSlab, ItemBlockWoodSlab.class, "slabs", blockSlabDouble, blockSlab);
registerOreDictWildcard("slabWood", slabs);
slabsDouble = registerBlock(blockSlabDouble, ItemBlockWoodSlab.class, "slabsDouble", blockSlabDouble, blockSlab);
fences = registerBlock(new BlockArbFence(false), ItemBlockWood.class, "fences");
registerOreDictWildcard("fenceWood", fences);
@@ -55,9 +62,13 @@ public class BlockRegistryArboriculture extends BlockRegistry {
planksFireproof = registerBlock(new BlockPlanks(true), ItemBlockWood.class, "planksFireproof");
registerOreDictWildcard("plankWood", planksFireproof);
slabsFireproof = registerBlock(new BlockSlab(true), ItemBlockWood.class, "slabsFireproof");
BlockSlab blockSlabFireproof = new BlockSlab(false, true);
BlockSlab blockSlabDoubleFireproof = new BlockSlab(true, true);
slabsFireproof = registerBlock(blockSlabFireproof, ItemBlockWoodSlab.class, "slabsFireproof", blockSlabDoubleFireproof, blockSlabFireproof);
registerOreDictWildcard("slabWood", slabsFireproof);
slabsDoubleFireproof = registerBlock(blockSlabDoubleFireproof, ItemBlockWoodSlab.class, "slabsDoubleFireproof", blockSlabDoubleFireproof, blockSlabFireproof);
fencesFireproof = registerBlock(new BlockArbFence(true), ItemBlockWood.class, "fencesFireproof");
registerOreDictWildcard("fenceWood", fencesFireproof);
@@ -46,8 +46,8 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
private final ParticleHelper.Callback particleCallback;
private final boolean fireproof;
public BlockSlab(boolean fireproof) {
super(false, Material.wood);
public BlockSlab(boolean doubleSlab, boolean fireproof) {
super(doubleSlab, Material.wood);
this.fireproof = fireproof;
@@ -61,9 +61,8 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
this.particleCallback = new ParticleHelper.DefaultCallback(this);
}
@Override
public boolean isOpaqueCube() {
return false;
public boolean isDoubleSlab() {
return field_150004_a;
}
/* ICONS */
@@ -100,8 +99,10 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List list) {
for (EnumWoodType woodType : EnumWoodType.VALUES) {
list.add(TreeManager.woodItemAccess.getSlab(woodType, fireproof));
if (!isDoubleSlab()) {
for (EnumWoodType woodType : EnumWoodType.VALUES) {
list.add(TreeManager.woodItemAccess.getSlab(woodType, fireproof));
}
}
}
@@ -12,8 +12,6 @@ package forestry.arboriculture.genetics;
import net.minecraft.entity.player.EntityPlayer;
import com.mojang.authlib.GameProfile;
import forestry.api.arboriculture.IArboristTracker;
import forestry.api.arboriculture.TreeManager;
import forestry.api.genetics.IBreedingTracker;
@@ -24,11 +22,7 @@ public class ArboristTracker extends BreedingTracker implements IArboristTracker
/** Required for creation from map storage */
public ArboristTracker(String s) {
this(s, null);
}
public ArboristTracker(String s, GameProfile player) {
super(s, player);
super(s);
}
@Override
@@ -45,7 +45,6 @@ import forestry.arboriculture.genetics.alleles.AlleleFruit;
import forestry.arboriculture.genetics.alleles.AlleleGrowth;
import forestry.arboriculture.render.IconProviderGermling;
import forestry.arboriculture.render.IconProviderGermlingVanilla;
import forestry.arboriculture.render.IconProviderLeaves;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.arboriculture.worldgen.BlockTypeLog;
import forestry.arboriculture.worldgen.WorldGenAcacia;
@@ -462,7 +461,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
// only available by rare villager trade
}
},
Jungle(TreeBranchDefinition.TROPICAL, "jungle", "tectona", false, EnumLeafType.JUNGLE, new Color(4764952), new Color(0x539d12), 3, new ItemStack(Blocks.log, 1, 3)) {
Jungle(TreeBranchDefinition.TROPICAL, "jungle", "tectona", false, EnumLeafType.JUNGLE, new Color(4764952), new Color(0x658917), 3, new ItemStack(Blocks.log, 1, 3)) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenJungle(tree);
@@ -868,7 +867,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
.restrictHumidity(EnumHumidity.DAMP);
}
},
Papaya(TreeBranchDefinition.CARICA, "papaya", "papaya", true, EnumLeafType.PALM, new Color(0x6d9f58), new Color(0x9ee67f), EnumWoodType.PAPAYA) {
Papaya(TreeBranchDefinition.CARICA, "papaya", "papaya", true, EnumLeafType.PALM, new Color(0x6d9f58), new Color(0x75E675), EnumWoodType.PAPAYA) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenPapaya(tree);
@@ -893,7 +892,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
registerMutation(Jungle, Cherry, 5);
}
},
Date(TreeBranchDefinition.PHOENIX, "datePalm", "dactylifera", true, EnumLeafType.PALM, new Color(0xcbcd79), new Color(0xf0f38f), EnumWoodType.PALM) {
Date(TreeBranchDefinition.PHOENIX, "datePalm", "dactylifera", true, EnumLeafType.PALM, new Color(0xcbcd79), new Color(0xB3F370), EnumWoodType.PALM) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenDate(tree);
@@ -963,7 +962,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
this.branch = branch;
ILeafIconProvider leafIconProvider = new IconProviderLeaves(leafType, primary, secondary);
ILeafIconProvider leafIconProvider = TreeManager.treeFactory.getLeafIconProvider(leafType, primary, secondary);
IGermlingIconProvider germlingIconProvider = new IconProviderGermlingVanilla(vanillaMeta);
this.species = TreeManager.treeFactory.createSpecies(uid, unlocalizedName, "Sengir", unlocalizedDescription, dominant, branch.getBranch(), binomial, leafIconProvider, germlingIconProvider, this);
@@ -979,7 +978,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
this.branch = branch;
ILeafIconProvider leafIconProvider = new IconProviderLeaves(leafType, primary, secondary);
ILeafIconProvider leafIconProvider = TreeManager.treeFactory.getLeafIconProvider(leafType, primary, secondary);
IGermlingIconProvider germlingIconProvider = new IconProviderGermling(uid);
this.species = TreeManager.treeFactory.createSpecies(uid, unlocalizedName, "Sengir", unlocalizedDescription, dominant, branch.getBranch(), binomial, leafIconProvider, germlingIconProvider, this);
@@ -272,10 +272,13 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
// Create a tracker if there is none yet.
if (tracker == null) {
tracker = new ArboristTracker(filename, player);
tracker = new ArboristTracker(filename);
world.setItemData(filename, tracker);
}
tracker.setUsername(player);
tracker.setWorld(world);
return tracker;
}
@@ -44,6 +44,10 @@ public class ItemBlockWood extends ItemBlockForestry {
EnumWoodType woodType = getWoodType(stack);
Block block = Block.getBlockFromItem(stack.getItem());
return placeWood(stack, woodType, block, player, world, x, y, z, metadata);
}
public static boolean placeWood(ItemStack stack, EnumWoodType woodType, Block block, @Nullable EntityPlayer player, World world, int x, int y, int z, int metadata) {
boolean placed = world.setBlock(x, y, z, block, metadata, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
if (!placed) {
return false;
@@ -117,7 +121,12 @@ public class ItemBlockWood extends ItemBlockForestry {
if (ordinal >= 0 && ordinal < EnumWoodType.VALUES.length) {
return EnumWoodType.VALUES[ordinal];
}
return null;
return EnumWoodType.LARCH;
}
@Override
public int getMetadata(int i) {
return 0;
}
@Override
@@ -0,0 +1,173 @@
package forestry.arboriculture.items;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.arboriculture.EnumWoodType;
import forestry.arboriculture.blocks.BlockSlab;
import forestry.arboriculture.tiles.TileWood;
import forestry.core.tiles.TileUtil;
public class ItemBlockWoodSlab extends ItemBlockWood {
private final BlockSlab slab;
private final BlockSlab doubleSlab;
private final boolean isDoubleSlab;
public ItemBlockWoodSlab(Block block, BlockSlab doubleSlab, BlockSlab slab) {
super(block);
this.doubleSlab = doubleSlab;
this.slab = slab;
this.isDoubleSlab = (block == doubleSlab);
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (isDoubleSlab) {
return super.onItemUse(itemStack, player, world, x, y, z, side, hitX, hitY, hitZ);
} else if (itemStack.stackSize == 0) {
return false;
} else if (!player.canPlayerEdit(x, y, z, side, itemStack)) {
return false;
} else {
Block block = world.getBlock(x, y, z);
int i1 = world.getBlockMetadata(x, y, z);
boolean flag = (i1 & 8) != 0;
EnumWoodType blockWoodType = null;
EnumWoodType stackWoodType = getWoodType(itemStack);
TileWood tile = TileUtil.getTile(world, x, y, z, TileWood.class);
if (tile != null) {
blockWoodType = tile.getWoodType();
}
if ((side == 1 && !flag || side == 0 && flag) && block == this.slab && blockWoodType == stackWoodType) {
if (world.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z))) {
if (placeWood(itemStack, stackWoodType, doubleSlab, player, world, x, y, z, 0)) {
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.doubleSlab.stepSound.func_150496_b(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getPitch() * 0.8F);
--itemStack.stackSize;
}
}
return true;
} else {
if (this.func_150946_a(itemStack, player, world, x, y, z, side)) {
return true;
} else {
return super.onItemUse(itemStack, player, world, x, y, z, side, hitX, hitY, hitZ);
}
}
}
}
@Override
@SideOnly(Side.CLIENT)
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack itemStack) {
int i1 = x;
int j1 = y;
int k1 = z;
Block block = world.getBlock(x, y, z);
int l1 = world.getBlockMetadata(x, y, z);
boolean flag = (l1 & 8) != 0;
EnumWoodType blockWoodType = null;
EnumWoodType stackWoodType = getWoodType(itemStack);
TileWood tile = TileUtil.getTile(world, x, y, z, TileWood.class);
if (tile != null) {
blockWoodType = tile.getWoodType();
}
if ((side == 1 && !flag || side == 0 && flag) && block == this.slab && stackWoodType == blockWoodType) {
return true;
} else {
if (side == 0) {
--y;
}
if (side == 1) {
++y;
}
if (side == 2) {
--z;
}
if (side == 3) {
++z;
}
if (side == 4) {
--x;
}
if (side == 5) {
++x;
}
Block block1 = world.getBlock(x, y, z);
tile = TileUtil.getTile(world, x, y, z, TileWood.class);
if (tile == null) {
blockWoodType = null;
} else {
blockWoodType = tile.getWoodType();
}
if (block1 == this.slab && stackWoodType == blockWoodType) {
return true;
} else {
return super.func_150936_a(world, i1, j1, k1, side, player, itemStack);
}
}
}
private boolean func_150946_a(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side) {
if (side == 0) {
--y;
}
if (side == 1) {
++y;
}
if (side == 2) {
--z;
}
if (side == 3) {
++z;
}
if (side == 4) {
--x;
}
if (side == 5) {
++x;
}
Block block = world.getBlock(x, y, z);
EnumWoodType blockWoodType = null;
EnumWoodType stackWoodType = getWoodType(itemStack);
TileWood tile = TileUtil.getTile(world, x, y, z, TileWood.class);
if (tile != null) {
blockWoodType = tile.getWoodType();
}
if (block == this.slab && blockWoodType == stackWoodType) {
if (world.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z))) {
if (placeWood(itemStack, stackWoodType, doubleSlab, player, world, x, y, z, 0)) {
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.doubleSlab.stepSound.func_150496_b(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getPitch() * 0.8F);
--itemStack.stackSize;
}
}
return true;
} else {
return false;
}
}
}
@@ -21,7 +21,7 @@ import forestry.core.items.ItemWithGui;
public class ItemTreealyzer extends ItemWithGui {
public ItemTreealyzer() {
super(Tabs.tabArboriculture);
setCreativeTab(Tabs.tabArboriculture);
}
@Override
@@ -40,16 +40,25 @@ public abstract class IconProviderWood {
@SideOnly(Side.CLIENT)
public static IIcon getPlankIcon(EnumWoodType woodType) {
if (woodType == null) {
woodType = EnumWoodType.LARCH;
}
return icons[0][woodType.ordinal()];
}
@SideOnly(Side.CLIENT)
public static IIcon getBarkIcon(EnumWoodType woodType) {
if (woodType == null) {
woodType = EnumWoodType.LARCH;
}
return icons[1][woodType.ordinal()];
}
@SideOnly(Side.CLIENT)
public static IIcon getHeartIcon(EnumWoodType woodType) {
if (woodType == null) {
woodType = EnumWoodType.LARCH;
}
return icons[2][woodType.ordinal()];
}
@@ -23,12 +23,14 @@ import net.minecraft.world.World;
import forestry.api.arboriculture.EnumWoodType;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.blocks.BlockSlab;
import forestry.arboriculture.items.ItemBlockWood;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.IStreamable;
import forestry.core.network.packets.PacketTileStream;
import forestry.core.tiles.TileUtil;
import forestry.plugins.PluginArboriculture;
public class TileWood extends TileEntity implements IStreamable {
private EnumWoodType woodType;
@@ -93,7 +95,16 @@ public class TileWood extends TileEntity implements IStreamable {
}
EnumWoodType woodType = wood.getWoodType();
ItemStack itemStack = new ItemStack(block);
int amount = 1;
if (block instanceof BlockSlab) {
BlockSlab blockSlab = (BlockSlab) block;
if (blockSlab.isDoubleSlab()) {
amount = 2;
block = PluginArboriculture.blocks.slabs;
}
}
ItemStack itemStack = new ItemStack(block, amount);
ItemBlockWood.saveToItemStack(woodType, itemStack);
return itemStack;
}
@@ -285,8 +285,11 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
wood.setDirection(branchDirection);
}
}
addWood(world, x, y, z, EnumReplaceMode.SOFT);
branchEnds.add(new ChunkCoordinates(x, y, z));
if (addWood(world, x, y, z, EnumReplaceMode.SOFT)) {
branchEnds.add(new ChunkCoordinates(x, y, z));
} else {
break;
}
}
}
}
@@ -295,28 +298,30 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
}
@Override
protected void addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace) {
protected boolean addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace) {
if (replace == EnumReplaceMode.ALL
|| (replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(world, startX + x, startY + y, startZ + z))
|| world.isAirBlock(startX + x, startY + y, startZ + z)) {
type.setBlock(world, tree, startX + x, startY + y, startZ + z);
return true;
}
return false;
}
protected final void clearBlock(World world, int x, int y, int z) {
air.setBlock(world, startX + x, startY + y, startZ + z);
}
protected final void addWood(World world, int x, int y, int z, EnumReplaceMode replace) {
addBlock(world, x, y, z, wood, replace);
protected final boolean addWood(World world, int x, int y, int z, EnumReplaceMode replace) {
return addBlock(world, x, y, z, wood, replace);
}
protected final void addLeaf(World world, int x, int y, int z, EnumReplaceMode replace) {
addBlock(world, x, y, z, leaf, replace);
protected final boolean addLeaf(World world, int x, int y, int z, EnumReplaceMode replace) {
return addBlock(world, x, y, z, leaf, replace);
}
protected final void addVine(World world, int x, int y, int z, ITreeBlockType vine) {
addBlock(world, x, y, z, vine, EnumReplaceMode.NONE);
protected final boolean addVine(World world, int x, int y, int z, ITreeBlockType vine) {
return addBlock(world, x, y, z, vine, EnumReplaceMode.NONE);
}
protected final void addVines(World world, int x, int y, int z, float chance) {
@@ -10,15 +10,23 @@
******************************************************************************/
package forestry.core;
import java.util.Collection;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.event.world.WorldEvent;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.ISpeciesRoot;
import forestry.core.errors.ErrorStateRegistry;
import forestry.core.render.TextureManager;
import forestry.plugins.PluginManager;
@@ -43,6 +51,18 @@ public class EventHandlerCore {
}
}
@SubscribeEvent
public void handlePlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
EntityPlayer player = event.player;
if (player != null) {
Collection<ISpeciesRoot> speciesRoots = AlleleManager.alleleRegistry.getSpeciesRoot().values();
for (ISpeciesRoot speciesRoot : speciesRoots) {
IBreedingTracker breedingTracker = speciesRoot.getBreedingTracker(player.getEntityWorld(), player.getGameProfile());
breedingTracker.synchToPlayer(player);
}
}
}
@SubscribeEvent
public void handleWorldLoad(WorldEvent.Load event) {
for (ISaveEventHandler handler : PluginManager.saveEventHandlers) {
@@ -10,13 +10,14 @@
******************************************************************************/
package forestry.core;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
import forestry.core.proxy.Proxies;
import forestry.core.utils.GeneticsUtil;
public class TickHandlerCoreClient {
@@ -24,18 +25,30 @@ public class TickHandlerCoreClient {
private boolean hasNaturalistEye;
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
public void onClientTick(TickEvent.ClientTickEvent event) {
if (event.phase != Phase.END) {
return;
}
EntityPlayer player = event.player;
Minecraft minecraft = Minecraft.getMinecraft();
if (minecraft == null) {
return;
}
EntityPlayer player = minecraft.thePlayer;
if (player == null) {
return;
}
boolean hasNaturalistEye = GeneticsUtil.hasNaturalistEye(player);
if (this.hasNaturalistEye != hasNaturalistEye) {
this.hasNaturalistEye = hasNaturalistEye;
Proxies.common.getClientInstance().renderGlobal.markBlockRangeForRenderUpdate(
(int) player.posX - 32, (int) player.posY - 32, (int) player.posZ - 32,
(int) player.posX + 32, (int) player.posY + 32, (int) player.posZ + 32);
RenderGlobal renderGlobal = minecraft.renderGlobal;
if (renderGlobal != null) {
renderGlobal.markBlockRangeForRenderUpdate(
(int) player.posX - 32, (int) player.posY - 32, (int) player.posZ - 32,
(int) player.posX + 32, (int) player.posY + 32, (int) player.posZ + 32);
}
}
}
}
@@ -176,6 +176,7 @@ public final class AccessHandler implements IAccessHandler {
if (this.owner != null) {
NBTTagCompound nbt = new NBTTagCompound();
NBTUtil.func_152460_a(nbt, owner);
nbt.removeTag("Properties");
data.setTag("owner", nbt);
}
}
@@ -12,5 +12,6 @@ package forestry.core.access;
public interface IRestrictedAccess {
IAccessHandler getAccessHandler();
void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess);
}
@@ -22,12 +22,12 @@ import forestry.core.utils.StringUtil;
import forestry.plugins.PluginManager;
public abstract class BlockRegistry {
protected static <T extends Block> T registerBlock(T block, Class<? extends ItemBlock> itemClass, String name) {
protected static <T extends Block> T registerBlock(T block, Class<? extends ItemBlock> itemClass, String name, Object... itemCtorArgs) {
if (PluginManager.getStage() != PluginManager.Stage.SETUP) {
throw new RuntimeException("Tried to register Block outside of Setup");
}
block.setBlockName("for." + name);
GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block));
GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block), itemCtorArgs);
return block;
}
@@ -49,11 +49,19 @@ public final class FluidHelper {
FluidStack liquid = getFluidStackInContainer(current);
if (fill && liquid != null) {
int used = tank.fill(side, liquid, true);
int canUseAmount = tank.fill(side, liquid, false);
if (canUseAmount == 0) {
return false;
}
if (used > 0) {
ItemStack drainedContainer = getDrainedContainer(current, canUseAmount);
if (ItemStackUtil.isIdenticalItem(current, drainedContainer)) {
return false;
}
int usedAmount = tank.fill(side, liquid, true);
if (usedAmount > 0) {
if (!player.capabilities.isCreativeMode) {
ItemStack drainedContainer = getDrainedContainer(current, used);
if (current.stackSize > 1) {
player.inventory.decrStackSize(player.inventory.currentItem, 1);
if (drainedContainer != null && !player.inventory.addItemStackToInventory(drainedContainer)) {
@@ -32,7 +32,7 @@ import forestry.core.utils.StringUtil;
*/
public class FilteredTank extends StandardTank {
private final Set<Integer> filters = new HashSet<>(); // FluidIDs
private final Set<String> filters = new HashSet<>(); // FluidNames
public FilteredTank(int capacity, Fluid... filters) {
this(capacity, Arrays.asList(filters), null);
@@ -50,7 +50,7 @@ public class FilteredTank extends StandardTank {
public void setFilters(Collection<Fluid> filters) {
this.filters.clear();
for (Fluid fluid : filters) {
this.filters.add(fluid.getID());
this.filters.add(fluid.getName());
}
}
@@ -64,14 +64,14 @@ public class FilteredTank extends StandardTank {
@Override
public boolean accepts(Fluid fluid) {
return filters.contains(fluid.getID());
return filters.contains(fluid.getName());
}
private boolean liquidMatchesFilter(FluidStack resource) {
if (resource == null || filters == null) {
return false;
}
return filters.contains(resource.getFluid().getID());
return filters.contains(resource.getFluid().getName());
}
@Override
@@ -83,8 +83,8 @@ public class FilteredTank extends StandardTank {
toolTip.clear();
if (Proxies.common.isShiftDown() || filters.size() < 5) {
for (Integer filterId : filters) {
Fluid fluidFilter = FluidRegistry.getFluid(filterId);
for (String filterName : filters) {
Fluid fluidFilter = FluidRegistry.getFluid(filterName);
EnumRarity rarity = fluidFilter.getRarity();
if (rarity == null) {
rarity = EnumRarity.common;
@@ -10,7 +10,9 @@
******************************************************************************/
package forestry.core.genetics;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -18,11 +20,13 @@ import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.WorldSavedData;
import com.mojang.authlib.GameProfile;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import forestry.api.core.ForestryEvent;
import forestry.api.genetics.AlleleManager;
@@ -31,7 +35,7 @@ import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IMutation;
import forestry.api.genetics.ISpeciesRoot;
import forestry.core.network.packets.PacketGenomeTrackerUpdate;
import forestry.core.network.packets.PacketGenomeTrackerSync;
import forestry.core.proxy.Proxies;
public abstract class BreedingTracker extends WorldSavedData implements IBreedingTracker {
@@ -44,6 +48,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
private static final String RESEARCHED_KEY = "RD";
private static final String MODE_NAME_KEY = "BMS";
private static final String MUTATION_FORMAT = "%s-%s=%s";
private static final Collection<String> emptyStringCollection = Collections.emptyList();
public static final String TYPE_KEY = "TYPE";
@@ -52,13 +57,23 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
private final Set<String> researchedMutations = new HashSet<>();
private String modeName;
private final GameProfile username;
@Nullable
private GameProfile username;
@Nullable
private World world;
protected BreedingTracker(String s, GameProfile username) {
protected BreedingTracker(String s) {
super(s);
}
public void setUsername(@Nullable GameProfile username) {
this.username = username;
}
public void setWorld(@Nullable World world) {
this.world = world;
}
@Override
public String getModeName() {
return modeName;
@@ -85,14 +100,31 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
@Override
public void synchToPlayer(EntityPlayer player) {
if (player instanceof EntityPlayerMP) {
if (player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) {
IBreedingTracker breedingTracker = getBreedingTracker(player);
String modeName = breedingTracker.getModeName();
setModeName(modeName);
NBTTagCompound nbttagcompound = new NBTTagCompound();
encodeToNBT(nbttagcompound);
Proxies.net.sendToPlayer(new PacketGenomeTrackerUpdate(nbttagcompound), (EntityPlayerMP) player);
PacketGenomeTrackerSync packet = new PacketGenomeTrackerSync(nbttagcompound);
Proxies.net.sendToPlayer(packet, player);
}
}
private void syncToPlayer(Collection<String> discoveredSpecies, Collection<String> discoveredMutations, Collection<String> researchedMutations) {
if (world != null && username != null && username.getName() != null) {
EntityPlayer player = world.getPlayerEntityByName(username.getName());
if (player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) {
IBreedingTracker breedingTracker = getBreedingTracker(player);
String modeName = breedingTracker.getModeName();
setModeName(modeName);
NBTTagCompound nbtTagCompound = new NBTTagCompound();
writeToNBT(nbtTagCompound, discoveredSpecies, discoveredMutations, researchedMutations);
PacketGenomeTrackerSync packet = new PacketGenomeTrackerSync(nbtTagCompound);
Proxies.net.sendToPlayer(packet, player);
}
}
}
@@ -121,20 +153,22 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
if (modeName != null && !modeName.isEmpty()) {
nbttagcompound.setString(MODE_NAME_KEY, modeName);
}
nbttagcompound.setString(TYPE_KEY, speciesRootUID());
writeValuesToNBT(nbttagcompound, discoveredSpecies, SPECIES_COUNT_KEY, SPECIES_KEY);
writeValuesToNBT(nbttagcompound, discoveredMutations, MUTATIONS_COUNT_KEY, MUTATIONS_KEY);
writeValuesToNBT(nbttagcompound, researchedMutations, RESEARCHED_COUNT_KEY, RESEARCHED_KEY);
writeToNBT(nbttagcompound, discoveredSpecies, discoveredMutations, researchedMutations);
}
private static void readValuesFromNBT(NBTTagCompound nbttagcompound, Collection<String> values, String countKey, String key) {
values.clear();
private void writeToNBT(NBTTagCompound nbtTagCompound, Collection<String> discoveredSpecies, Collection<String> discoveredMutations, Collection<String> researchedMutations) {
if (modeName != null && !modeName.isEmpty()) {
nbtTagCompound.setString(MODE_NAME_KEY, modeName);
}
nbtTagCompound.setString(TYPE_KEY, speciesRootUID());
writeValuesToNBT(nbtTagCompound, discoveredSpecies, SPECIES_COUNT_KEY, SPECIES_KEY);
writeValuesToNBT(nbtTagCompound, discoveredMutations, MUTATIONS_COUNT_KEY, MUTATIONS_KEY);
writeValuesToNBT(nbtTagCompound, researchedMutations, RESEARCHED_COUNT_KEY, RESEARCHED_KEY);
}
private static void readValuesFromNBT(NBTTagCompound nbttagcompound, Set<String> values, String countKey, String key) {
if (nbttagcompound.hasKey(countKey)) {
final int count = nbttagcompound.getInteger(countKey);
for (int i = 0; i < count; i++) {
@@ -175,13 +209,15 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(speciesRootUID());
ForestryEvent event = new ForestryEvent.MutationDiscovered(speciesRoot, username, mutation, this);
MinecraftForge.EVENT_BUS.post(event);
syncToPlayer(emptyStringCollection, Collections.singleton(mutationString), emptyStringCollection);
}
}
@Override
public boolean isDiscovered(IMutation mutation) {
String mutationString = getMutationString(mutation);
return discoveredMutations.contains(mutationString);
return discoveredMutations.contains(mutationString) || researchedMutations.contains(mutationString);
}
@Override
@@ -208,6 +244,8 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(speciesRootUID());
ForestryEvent event = new ForestryEvent.SpeciesDiscovered(speciesRoot, username, species, this);
MinecraftForge.EVENT_BUS.post(event);
syncToPlayer(Collections.singleton(species.getUID()), emptyStringCollection, emptyStringCollection);
}
}
@@ -219,6 +257,8 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
markDirty();
registerMutation(mutation);
syncToPlayer(emptyStringCollection, emptyStringCollection, Collections.singleton(mutationString));
}
}
+11 -13
View File
@@ -16,7 +16,6 @@ import java.util.Map;
import java.util.Stack;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
@@ -163,14 +162,6 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
textLayout.newLine();
textLayout.drawLine("IV : " + StringUtil.localize("gui.evolution"), COLUMN_0 + 4);
textLayout.newLine();
String mode = breedingTracker.getModeName();
if (mode != null && !mode.isEmpty()) {
String rules = StringUtil.localize(guiName + ".behaviour") + ": " + WordUtils.capitalize(mode);
textLayout.drawCenteredLine(rules, 8, 208, fontColor.get(guiName + ".binomial"));
}
textLayout.endPage();
}
@@ -278,7 +269,7 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
x += columnWidth;
if (x >= columnWidth * 4) {
x = 0;
textLayout.newLine();
textLayout.newLine(16);
}
}
@@ -290,7 +281,7 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
ItemStack partnerBee = iconStacks.get(combination.getPartner(species).getUID());
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), partnerBee));
drawProbabilityArrow(combination.getBaseChance(), guiLeft + x + 18, guiTop + textLayout.getLineY() + 4);
drawProbabilityArrow(combination, guiLeft + x + 18, guiTop + textLayout.getLineY() + 4);
IAllele result = combination.getTemplate()[EnumBeeChromosome.SPECIES.ordinal()];
ItemStack resultBee = iconStacks.get(result.getUID());
@@ -301,7 +292,7 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
drawQuestionMark(guiLeft + x, guiTop + textLayout.getLineY());
drawProbabilityArrow(combination.getBaseChance(), guiLeft + x + 18, guiTop + textLayout.getLineY() + 4);
drawProbabilityArrow(combination, guiLeft + x + 18, guiTop + textLayout.getLineY() + 4);
drawQuestionMark(guiLeft + x + 32, guiTop + textLayout.getLineY());
}
@@ -311,7 +302,8 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
drawTexturedModalRect(x, y, 78, 240, 16, 16);
}
private void drawProbabilityArrow(float chance, int x, int y) {
private void drawProbabilityArrow(IMutation combination, int x, int y) {
float chance = combination.getBaseChance();
int line = 247;
int column = 100;
switch (EnumMutateChance.rateChance(chance)) {
@@ -339,6 +331,12 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
// Probability arrow
Proxies.render.bindTexture(textureFile);
drawTexturedModalRect(x, y, column, line, 15, 9);
boolean researched = breedingTracker.isResearched(combination);
if (researched) {
fontRendererObj.drawString("+", x + 9, y + 1, 0);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
}
protected void drawToleranceInfo(IAlleleTolerance toleranceAllele, int x) {
@@ -29,7 +29,7 @@ public class GuiHandler implements IGuiHandler {
public static void openGui(EntityPlayer entityplayer, IGuiHandlerEntity guiHandler, short data) {
int guiData = encodeGuiData(guiHandler, data);
entityplayer.openGui(ForestryAPI.instance, guiData, entityplayer.worldObj, guiHandler.getEntityId(), 0, 0);
entityplayer.openGui(ForestryAPI.instance, guiData, entityplayer.worldObj, guiHandler.getIdOfEntity(), 0, 0);
}
public static void openGui(EntityPlayer entityplayer, IGuiHandlerItem guiHandler) {
@@ -28,9 +28,6 @@ import forestry.core.gui.tooltips.ToolTipLine;
public class GuiUtil {
public static void drawItemStack(GuiForestry gui, ItemStack stack, int xPos, int yPos) {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
RenderItem itemRender = GuiForestry.getItemRenderer();
@@ -17,5 +17,6 @@ public interface IGuiHandlerEntity extends IGuiHandlerForestry {
Object getContainer(EntityPlayer player, int data);
int getEntityId();
// can't be named getEntityId() for obfuscation reasons
int getIdOfEntity();
}
@@ -16,9 +16,11 @@ package forestry.core.gui.buttons;
public interface IButtonTextureSet {
int getX();
int getY();
int getHeight();
int getWidth();
}
@@ -16,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import forestry.core.config.Constants;
import forestry.core.network.DataInputStreamForestry;
@@ -14,7 +14,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import forestry.api.core.INBTTagable;
import forestry.core.utils.InventoryUtil;
@@ -28,8 +28,11 @@ import forestry.core.utils.StringUtil;
public class ItemOverlay extends ItemForestry {
public interface IOverlayInfo {
String getName();
int getPrimaryColor();
int getSecondaryColor();
boolean isSecret();
}
@@ -22,10 +22,10 @@ public class ItemRegistryFluids extends ItemRegistry {
public final ItemLiquidContainer waxCapsuleEmpty;
public final ItemLiquidContainer refractoryEmpty;
private final Table<EnumContainerType, Integer, ItemLiquidContainer> containers = HashBasedTable.create();
private final Table<EnumContainerType, String, ItemLiquidContainer> containers = HashBasedTable.create();
public ItemLiquidContainer getContainer(EnumContainerType type, Fluids fluid) {
return containers.get(type, fluid.getFluid().getID());
return containers.get(type, fluid.getFluid().getName());
}
public ItemRegistryFluids() {
@@ -45,7 +45,7 @@ public class ItemRegistryFluids extends ItemRegistry {
String name = type.getContainerNameKey() + fluidType.getContainerNameKey();
registerItem(liquidContainer, name);
containers.put(type, fluidType.getFluid().getID(), liquidContainer);
containers.put(type, fluidType.getFluid().getName(), liquidContainer);
}
}
}
@@ -10,7 +10,6 @@
******************************************************************************/
package forestry.core.items;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
@@ -22,11 +21,7 @@ import forestry.core.gui.IGuiHandlerItem;
public abstract class ItemWithGui extends ItemForestry implements IGuiHandlerItem {
public ItemWithGui() {
}
public ItemWithGui(CreativeTabs creativeTabs) {
super(creativeTabs);
setMaxStackSize(1);
}
@Override
@@ -61,6 +61,7 @@ public abstract class MultiblockTileEntityForestry<T extends IMultiblockLogic> e
if (this.owner != null) {
NBTTagCompound nbt = new NBTTagCompound();
NBTUtil.func_152460_a(nbt, owner);
nbt.removeTag("Properties");
data.setTag("owner", nbt);
}
@@ -14,5 +14,6 @@ import java.io.IOException;
public interface IStreamableGui {
void writeGuiData(DataOutputStreamForestry data) throws IOException;
void readGuiData(DataInputStreamForestry data) throws IOException;
}
@@ -18,7 +18,7 @@ import forestry.core.network.packets.PacketChipsetClick;
import forestry.core.network.packets.PacketErrorUpdate;
import forestry.core.network.packets.PacketErrorUpdateEntity;
import forestry.core.network.packets.PacketFXSignal;
import forestry.core.network.packets.PacketGenomeTrackerUpdate;
import forestry.core.network.packets.PacketGenomeTrackerSync;
import forestry.core.network.packets.PacketGuiEnergy;
import forestry.core.network.packets.PacketGuiLayoutSelect;
import forestry.core.network.packets.PacketGuiSelectRequest;
@@ -47,7 +47,7 @@ public class PacketRegistryCore extends PacketRegistry {
registerClientPacket(new PacketItemStackDisplay());
registerClientPacket(new PacketFXSignal());
registerClientPacket(new PacketTankLevelUpdate());
registerClientPacket(new PacketGenomeTrackerUpdate());
registerClientPacket(new PacketGenomeTrackerSync());
registerServerPacket(new PacketGuiSelectRequest());
registerServerPacket(new PacketPipetteClick());
@@ -27,12 +27,12 @@ import forestry.core.network.IForestryPacketClient;
import forestry.core.network.PacketIdClient;
import forestry.core.proxy.Proxies;
public class PacketGenomeTrackerUpdate extends PacketNBT implements IForestryPacketClient {
public class PacketGenomeTrackerSync extends PacketNBT implements IForestryPacketClient {
public PacketGenomeTrackerUpdate() {
public PacketGenomeTrackerSync() {
}
public PacketGenomeTrackerUpdate(NBTTagCompound nbtTagCompound) {
public PacketGenomeTrackerSync(NBTTagCompound nbtTagCompound) {
super(nbtTagCompound);
}
@@ -24,7 +24,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -215,12 +214,12 @@ public abstract class RecipeUtil {
@SuppressWarnings("unchecked")
public static void addRecipe(ItemStack itemstack, Object... obj) {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(itemstack, obj));
CraftingManager.getInstance().getRecipeList().add(new ShapedRecipeCustom(itemstack, obj));
}
@SuppressWarnings("unchecked")
public static void addPriorityRecipe(ItemStack itemStack, Object... obj) {
CraftingManager.getInstance().getRecipeList().add(0, new ShapedOreRecipe(itemStack, obj));
CraftingManager.getInstance().getRecipeList().add(0, new ShapedRecipeCustom(itemStack, obj));
}
public static void addShapelessRecipe(Item item, Object... obj) {
@@ -10,22 +10,106 @@
******************************************************************************/
package forestry.core.recipes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import forestry.api.recipes.IDescriptiveRecipe;
import forestry.core.utils.ItemStackUtil;
public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveRecipe {
private final int width;
private final int height;
//Added in for future ease of change, but hard coded for now.
private static final int MAX_CRAFT_GRID_WIDTH = 3;
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
public ShapedRecipeCustom(int width, int height, ItemStack product, Object... ingredients) {
super(product, ingredients);
this.width = width;
this.height = height;
private ItemStack output = null;
private Object[] input = null;
private int width;
private int height;
private boolean mirrored = true;
public ShapedRecipeCustom(ItemStack result, Object... recipe) {
super(result, recipe);
output = result.copy();
String shape = "";
int idx = 0;
if (recipe[idx] instanceof Boolean) {
mirrored = (Boolean) recipe[idx];
if (recipe[idx + 1] instanceof Object[]) {
recipe = (Object[]) recipe[idx + 1];
} else {
idx = 1;
}
}
if (recipe[idx] instanceof String[]) {
String[] parts = ((String[]) recipe[idx++]);
for (String s : parts) {
width = s.length();
shape += s;
}
height = parts.length;
} else {
while (recipe[idx] instanceof String) {
String s = (String) recipe[idx++];
shape += s;
width = s.length();
height++;
}
}
if (width * height != shape.length()) {
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe) {
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
for (; idx < recipe.length; idx += 2) {
Character chr = (Character) recipe[idx];
Object in = recipe[idx + 1];
if (in instanceof ItemStack) {
itemMap.put(chr, ((ItemStack) in).copy());
} else if (in instanceof Item) {
itemMap.put(chr, new ItemStack((Item) in));
} else if (in instanceof Block) {
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
} else if (in instanceof String) {
itemMap.put(chr, OreDictionary.getOres((String) in));
} else {
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe) {
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
input = new Object[width * height];
int x = 0;
for (char chr : shape.toCharArray()) {
input[x++] = itemMap.get(chr);
}
}
@Override
@@ -54,24 +138,66 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR
return false;
}
public static ShapedRecipeCustom createShapedRecipe(ItemStack product, Object... materials) {
int index = 0;
int columns = 0;
int rows = 0;
if (materials[index] instanceof String[]) {
String as[] = (String[]) materials[index];
for (String pattern : as) {
rows++;
columns = pattern.length();
}
} else {
while (materials[index] instanceof String) {
String pattern = (String) materials[index++];
rows++;
columns = pattern.length();
@Override
public boolean matches(InventoryCrafting inv, World world) {
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) {
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) {
if (checkMatch(inv, x, y, false)) {
return true;
}
if (mirrored && checkMatch(inv, x, y, true)) {
return true;
}
}
}
return new ShapedRecipeCustom(columns, rows, product, materials);
return false;
}
@SuppressWarnings("unchecked")
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) {
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) {
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) {
int subX = x - startX;
int subY = y - startY;
Object target = null;
if (subX >= 0 && subY >= 0 && subX < width && subY < height) {
if (mirror) {
target = input[width - subX - 1 + subY * width];
} else {
target = input[subX + subY * width];
}
}
ItemStack slot = inv.getStackInRowAndColumn(x, y);
if (target instanceof ItemStack) {
if (!ItemStackUtil.isCraftingEquivalent((ItemStack) target, slot)) {
return false;
}
} else if (target instanceof ArrayList) {
boolean matched = false;
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
while (itr.hasNext() && !matched) {
matched = ItemStackUtil.isCraftingEquivalent(itr.next(), slot);
}
if (!matched) {
return false;
}
} else if (target == null && slot != null) {
return false;
}
}
}
return true;
}
public static ShapedRecipeCustom createShapedRecipe(ItemStack product, Object... materials) {
return new ShapedRecipeCustom(product, materials);
}
}
@@ -34,8 +34,10 @@ import forestry.energy.EnergyManager;
import cofh.api.energy.IEnergyConnection;
public abstract class TileEngine extends TileBase implements IEnergyConnection, IActivatable {
private static final int CANT_SEND_ENERGY_TIME = 20;
private boolean active = false; // Used for smp.
private int cantSendEnergyCountdown = CANT_SEND_ENERGY_TIME;
/**
* Indicates whether the piston is receding from or approaching the
* combustion chamber
@@ -147,8 +149,14 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
if (energyManager.canSendEnergy(getOrientation(), tile)) {
stagePiston = 1; // If we can transfer energy, start running
setActive(true);
cantSendEnergyCountdown = CANT_SEND_ENERGY_TIME;
} else {
setActive(false);
if (isActive()) {
cantSendEnergyCountdown--;
if (cantSendEnergyCountdown <= 0) {
setActive(false);
}
}
}
} else {
setActive(false);
@@ -114,7 +114,6 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve
@Override
public Object getContainer(EntityPlayer player, int page) {
speciesRoot.syncBreedingTrackerToPlayer(player);
return new ContainerNaturalistInventory(player.inventory, this, page);
}
}
@@ -12,7 +12,6 @@ package forestry.core.utils;
import java.util.List;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
@@ -466,7 +466,7 @@ public abstract class InventoryUtil {
int added = addStack(inventory, stack, startSlot, slots, false);
boolean success = all ? (added == stack.stackSize) : (added > 0);
if (success && doAdd) {
if (success && doAdd) {
addStack(inventory, stack, startSlot, slots, true);
}
@@ -66,7 +66,7 @@ public abstract class WorldGenBase extends WorldGenerator {
return false;
}
protected abstract void addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace);
protected abstract boolean addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace);
protected final void generateCuboid(World world, Vector start, Vector area, ITreeBlockType block, EnumReplaceMode replace) {
for (int x = (int) start.x; x < (int) start.x + area.x; x++) {
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.energy.gui;
import forestry.core.network.packets.PacketGuiUpdate;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
@@ -36,13 +37,9 @@ public class ContainerEngineElectric extends ContainerSocketed<TileEngineElectri
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
if (tile == null) {
return;
}
for (Object crafter : crafters) {
tile.sendGUINetworkData(this, (ICrafting) crafter);
if (tile != null) {
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
sendPacketToCrafters(packet);
}
}
@@ -12,12 +12,9 @@ package forestry.energy.tiles;
import net.minecraft.world.IBlockAccess;
import forestry.core.blocks.IMachineProperties;
import forestry.core.blocks.IMachinePropertiesTESR;
import forestry.core.render.IBlockRenderer;
import forestry.core.tiles.MachineDefinition;
import forestry.core.tiles.TileEngine;
import forestry.core.tiles.TileForestry;
import forestry.core.tiles.TileUtil;
public class EngineDefinition extends MachineDefinition {
@@ -10,13 +10,6 @@
******************************************************************************/
package forestry.energy.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.CircuitSocketType;
import forestry.api.circuits.ICircuitBoard;
@@ -26,15 +19,25 @@ import forestry.core.circuits.ISocketable;
import forestry.core.config.Constants;
import forestry.core.errors.EnumErrorCode;
import forestry.core.inventory.InventoryAdapter;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.IStreamableGui;
import forestry.core.tiles.TemperatureState;
import forestry.core.tiles.TileEngine;
import forestry.energy.gui.ContainerEngineElectric;
import forestry.energy.gui.GuiEngineElectric;
import forestry.plugins.compat.PluginIC2;
import ic2.api.energy.prefab.BasicSink;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class TileEngineElectric extends TileEngine implements ISocketable, IInventory {
import java.io.IOException;
public class TileEngineElectric extends TileEngine implements ISocketable, IInventory, IStreamableGui {
protected static class EuConfig {
public int euForCycle;
@@ -92,6 +95,32 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
sockets.writeToNBT(nbttagcompound);
}
@Override
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
data.writeVarInt(currentOutput);
data.writeVarInt(heat);
sockets.writeData(data);
energyManager.writeData(data);
final boolean hasIc2EnergySink = (ic2EnergySink != null);
data.writeBoolean(hasIc2EnergySink);
if (hasIc2EnergySink) {
data.writeVarInt((int) ic2EnergySink.getEnergyStored());
}
}
@Override
public void readGuiData(DataInputStreamForestry data) throws IOException {
currentOutput = data.readVarInt();
heat = data.readVarInt();
sockets.readData(data);
energyManager.readData(data);
final boolean hasIc2EnergySink = data.readBoolean();
if (hasIc2EnergySink) {
final int energyStored = data.readVarInt();
ic2EnergySink.setEnergyStored(energyStored);
}
}
@Override
public void onChunkUnload() {
if (ic2EnergySink != null) {
@@ -219,35 +248,12 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
// / SMP GUI
@Override
public void getGUINetworkData(int i, int j) {
switch (i) {
case 0:
currentOutput = j;
break;
case 1:
energyManager.fromGuiInt(j);
break;
case 2:
heat = j;
break;
case 3:
if (ic2EnergySink != null) {
ic2EnergySink.setEnergyStored(j);
}
break;
}
// handled by IStreamableGui
}
@Override
public void sendGUINetworkData(Container containerEngine, ICrafting iCrafting) {
iCrafting.sendProgressBarUpdate(containerEngine, 0, currentOutput);
iCrafting.sendProgressBarUpdate(containerEngine, 1, energyManager.toGuiInt());
iCrafting.sendProgressBarUpdate(containerEngine, 2, heat);
if (ic2EnergySink != null) {
iCrafting.sendProgressBarUpdate(containerEngine, 3, (short) ic2EnergySink.getEnergyStored());
}
// handled by IStreamableGui
}
// / ENERGY CONFIG CHANGE
@@ -70,17 +70,21 @@ public class SqueezerRecipeManager implements ISqueezerManager {
}
}
// First try to match a specific recipe (without OreDictionary)
for (ISqueezerRecipe recipe : recipes) {
if (ItemStackUtil.containsSets(recipe.getResources(), items, false, false) > 0) {
return recipe;
}
}
// If that fails - try again with OreDictionary support enabled
return null;
}
public static ISqueezerRecipe findRecipeWithIngredient(ItemStack ingredient) {
for (ISqueezerRecipe recipe : recipes) {
if (ItemStackUtil.containsSets(recipe.getResources(), items, true, false) > 0) {
return recipe;
for (ItemStack recipeIngredient : recipe.getResources()) {
if (ItemStackUtil.isCraftingEquivalent(recipeIngredient, ingredient, false, false)) {
return recipe;
}
}
}
@@ -246,11 +246,9 @@ public class NEIHandlerSqueezer extends RecipeHandlerBase {
return;
}
ISqueezerRecipe recipe = SqueezerRecipeManager.findMatchingRecipe(new ItemStack[]{ingred});
ISqueezerRecipe recipe = SqueezerRecipeManager.findRecipeWithIngredient(ingred);
if (recipe != null) {
CachedSqueezerRecipe crecipe = new CachedSqueezerRecipe(recipe);
// Override recipe to show the right input in case it's OD
crecipe.setIngredients(new ItemStack[]{ingred});
this.arecipes.add(crecipe);
}
}
@@ -68,7 +68,7 @@ public class TileFabricator extends TilePowered implements ISlotPickupWatcher, I
setEnergyPerWorkCycle(200);
craftingInventory = new InventoryGhostCrafting<>(this, InventoryGhostCrafting.SLOT_CRAFTING_COUNT);
setInternalInventory(new InventoryFabricator(this));
moltenTank = new FilteredTank(2 * Constants.BUCKET_VOLUME, Fluids.GLASS.getFluid());
moltenTank = new FilteredTank(8 * Constants.BUCKET_VOLUME, Fluids.GLASS.getFluid());
moltenTank.tankMode = StandardTank.TankMode.INTERNAL;
tankManager = new TankManager(this, moltenTank);
}
@@ -0,0 +1,28 @@
package forestry.farming.logic;
import forestry.core.utils.vect.Vect;
import forestry.plugins.compat.PluginIC2;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.Collection;
public class CropBasicIC2Crop extends Crop {
private final TileEntity tileEntity;
public CropBasicIC2Crop(World world, TileEntity tileEntity, Vect position) {
super(world, position);
this.tileEntity = tileEntity;
}
@Override
protected boolean isCrop(Vect pos) {
return PluginIC2.instance.canHarvestCrop(this.tileEntity);
}
@Override
protected Collection<ItemStack> harvestBlock(Vect pos) {
return PluginIC2.instance.getCropDrops(this.tileEntity);
}
}
@@ -40,6 +40,7 @@ import forestry.core.utils.vect.VectUtil;
import forestry.plugins.PluginCore;
public class FarmLogicArboreal extends FarmLogicHomogeneous {
private static final int BRANCH_RANGE = 20;
public FarmLogicArboreal(IFarmHousing housing, ItemStack resource, ItemStack ground, Iterable<IFarmable> germlings) {
super(housing, resource, ground, germlings);
@@ -172,10 +173,10 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
if (candidate.equals(position)) {
continue;
}
if (Math.abs(candidate.x - start.x) > 10) {
if (Math.abs(candidate.x - start.x) > BRANCH_RANGE) {
continue;
}
if (Math.abs(candidate.z - start.z) > 10) {
if (Math.abs(candidate.z - start.z) > BRANCH_RANGE) {
continue;
}
@@ -51,19 +51,25 @@ public class FarmLogicOrchard extends FarmLogic {
public FarmLogicOrchard(IFarmHousing housing) {
super(housing);
this.farmables = Farmables.farmables.get("farmOrchard");
ImmutableList.Builder<Block> traversalBlocksBuilder = ImmutableList.builder();
if (PluginManager.Module.AGRICRAFT.isEnabled()) {
if (PluginManager.Module.AGRICRAFT.isEnabled() || PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
traversalBlocksBuilder.add(Blocks.farmland);
}
if (PluginManager.Module.GROWTHCRAFT.isEnabled()) {
if (PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
traversalBlocksBuilder.add(Blocks.dirt);
}
if (PluginManager.Module.PLANTMEGAPACK.isEnabled()) {
traversalBlocksBuilder.add(Blocks.water);
}
{
Block grapeVine = GameRegistry.findBlock("Growthcraft|Grapes", "grc.grapeVine1");
if (grapeVine != null) {
traversalBlocksBuilder.add(grapeVine);
}
}
if (PluginManager.Module.PLANTMEGAPACK.isEnabled()) {
traversalBlocksBuilder.add(Blocks.water);
}
traversalBlocksBuilder.build();
this.traversalBlocks = traversalBlocksBuilder.build();
}
@@ -0,0 +1,52 @@
package forestry.farming.logic;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.core.utils.vect.Vect;
import forestry.plugins.compat.PluginIC2;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class FarmableBasicIC2Crop implements IFarmable {
@Override
public boolean isSaplingAt(World world, int x, int y, int z) {
TileEntity crop = world.getTileEntity(x, y, z);
if(PluginIC2.instance.isIC2Crop(crop)) {
PluginIC2.instance.babysitCrop(crop);
return true;
}
return false;
}
@Override
public ICrop getCropAt(World world, int x, int y, int z) {
TileEntity crop = world.getTileEntity(x, y, z);
if (crop == null) {
return null;
}
if (!PluginIC2.instance.isIC2Crop(crop)) {
return null;
}
if (!PluginIC2.instance.canHarvestCrop(crop)) {
return null;
}
return new CropBasicIC2Crop(world, crop, new Vect(x, y, z));
}
@Override
public boolean isGermling(ItemStack itemstack) {
return false;
}
@Override
public boolean isWindfall(ItemStack itemstack) {
return false;
}
@Override
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
return false;
}
}
@@ -236,10 +236,13 @@ public class ButterflyHelper extends SpeciesRoot implements IButterflyRoot {
// Create a tracker if there is none yet.
if (tracker == null) {
tracker = new LepidopteristTracker(filename, player);
tracker = new LepidopteristTracker(filename);
world.setItemData(filename, tracker);
}
tracker.setUsername(player);
tracker.setWorld(world);
return tracker;
}
@@ -12,8 +12,6 @@ package forestry.lepidopterology.genetics;
import net.minecraft.entity.player.EntityPlayer;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IIndividual;
import forestry.api.lepidopterology.ButterflyManager;
@@ -25,11 +23,7 @@ public class LepidopteristTracker extends BreedingTracker implements ILepidopter
/** Required for creation from map storage */
public LepidopteristTracker(String s) {
this(s, null);
}
public LepidopteristTracker(String s, GameProfile player) {
super(s, player);
super(s);
}
@Override
@@ -21,7 +21,7 @@ import forestry.lepidopterology.inventory.ItemInventoryFlutterlyzer;
public class ItemFlutterlyzer extends ItemWithGui {
public ItemFlutterlyzer() {
super(Tabs.tabLepidopterology);
setCreativeTab(Tabs.tabLepidopterology);
}
@Override
@@ -10,31 +10,38 @@
******************************************************************************/
package forestry.mail;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import forestry.core.proxy.Proxies;
import forestry.mail.gui.GuiMailboxInfo;
import forestry.mail.network.packets.PacketPOBoxInfoRequest;
public class TickHandlerMailClient {
private static final int THROTTLE_TIME_MS = 10000;
private long lastInfoRequestTime;
import forestry.mail.network.packets.PacketPOBoxInfoUpdate;
public class EventHandlerMailAlert {
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent event) {
if (event.phase != Phase.END) {
return;
}
if (GuiMailboxInfo.instance.hasPOBoxInfo()) {
if (Minecraft.getMinecraft().theWorld != null && GuiMailboxInfo.instance.hasPOBoxInfo()) {
GuiMailboxInfo.instance.render();
} else {
long time = System.currentTimeMillis();
if (time - lastInfoRequestTime > THROTTLE_TIME_MS) {
Proxies.net.sendToServer(new PacketPOBoxInfoRequest());
lastInfoRequestTime = time;
}
}
@SubscribeEvent
public void handlePlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
EntityPlayer player = event.player;
if (player != null) {
MailAddress address = new MailAddress(player.getGameProfile());
POBox pobox = PostRegistry.getOrCreatePOBox(player.worldObj, address);
if (pobox != null) {
Proxies.net.sendToPlayer(new PacketPOBoxInfoUpdate(pobox.getPOBoxInfo()), player);
}
}
}
@@ -32,7 +32,7 @@ import forestry.api.mail.ITradeStation;
import forestry.api.mail.PostManager;
import forestry.core.proxy.Proxies;
import forestry.core.utils.PlayerUtil;
import forestry.mail.network.packets.PacketPOBoxInfoResponse;
import forestry.mail.network.packets.PacketPOBoxInfoUpdate;
import forestry.plugins.PluginMail;
public class PostRegistry implements IPostRegistry {
@@ -75,7 +75,7 @@ public class PostRegistry implements IPostRegistry {
EntityPlayer player = PlayerUtil.getPlayer(world, address.getPlayerProfile());
if (player != null) {
Proxies.net.sendToPlayer(new PacketPOBoxInfoResponse(pobox.getPOBoxInfo()), player);
Proxies.net.sendToPlayer(new PacketPOBoxInfoUpdate(pobox.getPOBoxInfo()), player);
}
}
@@ -30,7 +30,7 @@ import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.utils.PlayerUtil;
import forestry.core.utils.StringUtil;
import forestry.mail.network.packets.PacketPOBoxInfoResponse;
import forestry.mail.network.packets.PacketPOBoxInfoUpdate;
public class PostalCarrier implements IPostalCarrier {
@@ -88,7 +88,7 @@ public class PostalCarrier implements IPostalCarrier {
} else {
EntityPlayer player = PlayerUtil.getPlayer(world, recipient.getPlayerProfile());
if (player instanceof EntityPlayerMP) {
Proxies.net.sendToPlayer(new PacketPOBoxInfoResponse(pobox.getPOBoxInfo()), (EntityPlayerMP) player);
Proxies.net.sendToPlayer(new PacketPOBoxInfoUpdate(pobox.getPOBoxInfo()), (EntityPlayerMP) player);
}
}
@@ -21,7 +21,7 @@ import forestry.core.proxy.Proxies;
import forestry.core.utils.SlotUtil;
import forestry.mail.POBox;
import forestry.mail.POBoxInfo;
import forestry.mail.network.packets.PacketPOBoxInfoResponse;
import forestry.mail.network.packets.PacketPOBoxInfoUpdate;
import forestry.mail.tiles.TileMailbox;
public class ContainerMailbox extends ContainerTile<TileMailbox> {
@@ -55,7 +55,7 @@ public class ContainerMailbox extends ContainerTile<TileMailbox> {
if (SlotUtil.isSlotInRange(slotIndex, SLOT_LETTERS, SLOT_LETTERS_COUNT)) {
if (!player.worldObj.isRemote && mailInventory != null) {
POBoxInfo info = mailInventory.getPOBoxInfo();
Proxies.net.sendToPlayer(new PacketPOBoxInfoResponse(info), player);
Proxies.net.sendToPlayer(new PacketPOBoxInfoUpdate(info), player);
}
}
@@ -21,12 +21,12 @@ import forestry.core.items.ItemOverlay;
import forestry.plugins.PluginCore;
public enum EnumStampDefinition implements ItemOverlay.IOverlayInfo {
P_1("1n", EnumPostage.P_1, PluginCore.items.apatite, new Color(0x4a8ca7), new Color(0xffffff)),
P_1("1n", EnumPostage.P_1, "gemApatite", new Color(0x4a8ca7), new Color(0xffffff)),
P_2("2n", EnumPostage.P_2, "ingotCopper", new Color(0xe8c814), new Color(0xffffff)),
P_5("5n", EnumPostage.P_5, "ingotTin", new Color(0x9c0707), new Color(0xffffff)),
P_10("10n", EnumPostage.P_10, Items.gold_ingot, new Color(0x7bd1b8), new Color(0xffffff)),
P_20("20n", EnumPostage.P_20, Items.diamond, new Color(0xff9031), new Color(0xfff7dd)),
P_50("50n", EnumPostage.P_50, Items.emerald, new Color(0x6431d7), new Color(0xfff7dd)),
P_10("10n", EnumPostage.P_10, "ingotGold", new Color(0x7bd1b8), new Color(0xffffff)),
P_20("20n", EnumPostage.P_20, "gemDiamond", new Color(0xff9031), new Color(0xfff7dd)),
P_50("50n", EnumPostage.P_50, "gemEmerald", new Color(0x6431d7), new Color(0xfff7dd)),
P_100("100n", EnumPostage.P_100, Items.nether_star, new Color(0xd731ba), new Color(0xfff7dd)),
// P_200("200n", EnumPostage.P_200, Items.nether_star, new Color(0xcd9831), new Color(0xfff7dd)),
;
@@ -14,8 +14,7 @@ import forestry.core.network.PacketRegistry;
import forestry.mail.network.packets.PacketLetterInfoRequest;
import forestry.mail.network.packets.PacketLetterInfoResponse;
import forestry.mail.network.packets.PacketLetterTextSet;
import forestry.mail.network.packets.PacketPOBoxInfoRequest;
import forestry.mail.network.packets.PacketPOBoxInfoResponse;
import forestry.mail.network.packets.PacketPOBoxInfoUpdate;
import forestry.mail.network.packets.PacketTraderAddressRequest;
import forestry.mail.network.packets.PacketTraderAddressResponse;
@@ -24,11 +23,10 @@ public class PacketRegistryMail extends PacketRegistry {
public void registerPackets() {
registerServerPacket(new PacketLetterInfoRequest());
registerServerPacket(new PacketTraderAddressRequest());
registerServerPacket(new PacketPOBoxInfoRequest());
registerServerPacket(new PacketLetterTextSet());
registerClientPacket(new PacketLetterInfoResponse());
registerClientPacket(new PacketTraderAddressResponse());
registerClientPacket(new PacketPOBoxInfoResponse());
registerClientPacket(new PacketPOBoxInfoUpdate());
}
}
@@ -1,44 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.mail.network.packets;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayerMP;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.ForestryPacket;
import forestry.core.network.IForestryPacketServer;
import forestry.core.network.PacketIdServer;
import forestry.core.proxy.Proxies;
import forestry.mail.MailAddress;
import forestry.mail.POBox;
import forestry.mail.PostRegistry;
public class PacketPOBoxInfoRequest extends ForestryPacket implements IForestryPacketServer {
public PacketPOBoxInfoRequest() {
}
@Override
public PacketIdServer getPacketId() {
return PacketIdServer.POBOX_INFO_REQUEST;
}
@Override
public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException {
MailAddress address = new MailAddress(player.getGameProfile());
POBox pobox = PostRegistry.getOrCreatePOBox(player.worldObj, address);
if (pobox != null) {
Proxies.net.sendToPlayer(new PacketPOBoxInfoResponse(pobox.getPOBoxInfo()), player);
}
}
}
@@ -22,14 +22,14 @@ import forestry.core.network.PacketIdClient;
import forestry.mail.POBoxInfo;
import forestry.mail.gui.GuiMailboxInfo;
public class PacketPOBoxInfoResponse extends ForestryPacket implements IForestryPacketClient {
public class PacketPOBoxInfoUpdate extends ForestryPacket implements IForestryPacketClient {
public POBoxInfo poboxInfo;
public PacketPOBoxInfoResponse() {
public PacketPOBoxInfoUpdate() {
}
public PacketPOBoxInfoResponse(POBoxInfo info) {
public PacketPOBoxInfoUpdate(POBoxInfo info) {
this.poboxInfo = info;
}
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
@@ -213,7 +214,7 @@ public class PluginApiculture extends ForestryPlugin {
}
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "2.0.0");
if (!config.getLoadedConfigVersion().equals(config.getDefinedConfigVersion())) {
if (!Objects.equals(config.getLoadedConfigVersion(), config.getDefinedConfigVersion())) {
boolean deleted = configFile.delete();
if (deleted) {
config = new LocalizedConfiguration(configFile, "2.0.0");
@@ -21,11 +21,15 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.FuelBurnTimeEvent;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
@@ -38,6 +42,7 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.VillageHandlerArboriculture;
import forestry.arboriculture.WoodItemAccess;
import forestry.arboriculture.blocks.BlockArboricultureType;
@@ -119,6 +124,9 @@ public class PluginArboriculture extends ForestryPlugin {
public void preInit() {
super.preInit();
// register for FuelBurnTimeEvent
MinecraftForge.EVENT_BUS.register(this);
for (EnumWoodType woodType : EnumWoodType.VALUES) {
WoodItemAccess.registerLog(blocks.logs, woodType, false);
WoodItemAccess.registerPlanks(blocks.planks, woodType, false);
@@ -411,11 +419,24 @@ public class PluginArboriculture extends ForestryPlugin {
return 100;
}
if (blocks.slabs == Block.getBlockFromItem(item)) {
return 150;
}
return 0;
}
}
@SubscribeEvent
public void fuelBurnTimeEvent(FuelBurnTimeEvent fuelBurnTimeEvent) {
Item item = fuelBurnTimeEvent.fuel.getItem();
Block block = Block.getBlockFromItem(item);
if (block instanceof IWoodTyped) {
IWoodTyped woodTypedBlock = (IWoodTyped) block;
if (woodTypedBlock.isFireproof()) {
fuelBurnTimeEvent.burnTime = 0;
fuelBurnTimeEvent.setResult(Event.Result.DENY);
} else if (blocks.slabs == block) {
fuelBurnTimeEvent.burnTime = 150;
fuelBurnTimeEvent.setResult(Event.Result.DENY);
}
}
}
}
@@ -259,12 +259,16 @@ public class PluginFactory extends ForestryPlugin {
if (PluginManager.Module.APICULTURE.isEnabled()) {
ItemRegistryApiculture beeItems = PluginApiculture.items;
FluidStack liquidGlass = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME);
FluidStack liquidGlassX4 = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME * 4);
for (int i = 0; i < 16; i++) {
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlass, new ItemStack(Blocks.stained_glass, 4, 15 - i), new Object[]{
"#", "X",
'#', dyes[i],
'X', beeItems.propolis.getWildcard()});
}
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlassX4, new ItemStack(Blocks.glass, 1, 0), new Object[]{
"#", "X",
'X', beeItems.propolis.getWildcard()});
}
// / SQUEEZER
@@ -273,6 +277,8 @@ public class PluginFactory extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.apple)}, Fluids.JUICE.getFluid(appleJuiceAmount),
PluginCore.items.mulch.getItemStack(), appleMulchAmount);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.carrot)}, Fluids.JUICE.getFluid(appleJuiceAmount),
PluginCore.items.mulch.getItemStack(), appleMulchAmount);
int seedOilAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
FluidStack seedOil = Fluids.SEEDOIL.getFluid(seedOilAmount);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.wheat_seeds)}, seedOil);
@@ -303,6 +309,7 @@ public class PluginFactory extends ForestryPlugin {
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.cactus), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cactus"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.wheat), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.potato), (2 * ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat")), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.reeds), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cane"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.brown_mushroom), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.red_mushroom), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS);
@@ -312,6 +319,10 @@ public class PluginFactory extends ForestryPlugin {
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.glass), Fluids.GLASS.getFluid(1000), 1000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.glass_pane), Fluids.GLASS.getFluid(375), 1000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sand), Fluids.GLASS.getFluid(1000), 3000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sand,1,1), Fluids.GLASS.getFluid(1000), 3000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone), Fluids.GLASS.getFluid(4000), 4800);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone,1,1), Fluids.GLASS.getFluid(4000), 4800);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone,1,2), Fluids.GLASS.getFluid(4000), 4800);
// / CARPENTER
RecipeManagers.carpenterManager.addRecipe(50, Fluids.SEEDOIL.getFluid(250), null, PluginCore.items.impregnatedCasing.getItemStack(),
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@@ -175,6 +176,11 @@ public class PluginFluids extends ForestryPlugin {
public static class FillBucketHook {
@SubscribeEvent
public void fillBucket(FillBucketEvent event) {
ItemStack bucket = event.current;
if (bucket == null || bucket.getItem() != Items.bucket) {
return;
}
MovingObjectPosition movingObjectPosition = event.target;
int x = movingObjectPosition.blockX;
int y = movingObjectPosition.blockY;
@@ -28,10 +28,10 @@ import forestry.core.items.EnumElectronTube;
import forestry.core.network.IPacketRegistry;
import forestry.core.recipes.RecipeUtil;
import forestry.core.tiles.MachineDefinition;
import forestry.mail.EventHandlerMailAlert;
import forestry.mail.PostRegistry;
import forestry.mail.PostalCarrier;
import forestry.mail.SaveEventHandlerMail;
import forestry.mail.TickHandlerMailClient;
import forestry.mail.blocks.BlockMailType;
import forestry.mail.blocks.BlockRegistryMail;
import forestry.mail.commands.CommandMail;
@@ -67,7 +67,7 @@ public class PluginMail extends ForestryPlugin {
PluginCore.rootCommand.addChildCommand(new CommandMail());
if (Config.mailAlertEnabled) {
FMLCommonHandler.instance().bus().register(new TickHandlerMailClient());
FMLCommonHandler.instance().bus().register(new EventHandlerMailAlert());
}
blocks.mail.addDefinitions(
@@ -59,6 +59,7 @@ import forestry.plugins.compat.PluginImmersiveEngineering;
import forestry.plugins.compat.PluginMagicalCrops;
import forestry.plugins.compat.PluginNatura;
import forestry.plugins.compat.PluginPlantMegaPack;
import forestry.plugins.compat.PluginRotaryCraft;
import forestry.plugins.compat.PluginWitchery;
public class PluginManager {
@@ -116,6 +117,7 @@ public class PluginManager {
MAGICALCROPS(new PluginMagicalCrops()),
NATURA(new PluginNatura()),
PLANTMEGAPACK(new PluginPlantMegaPack()),
ROTARYCRAFT(new PluginRotaryCraft()),
WITCHERY(new PluginWitchery());
static {
@@ -39,6 +39,7 @@ import forestry.farming.logic.FarmableGenericSapling;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.Plugin;
import forestry.plugins.PluginCore;
import forestry.plugins.PluginManager;
@Plugin(pluginID = "BiomesOPlenty", name = "BiomesOPlenty", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.biomesoplenty.description")
public class PluginBiomesOPlenty extends ForestryPlugin {
@@ -48,7 +49,9 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
private static Block saplings;
private static Block colorizedSaplings;
private static Item food;
private static Item misc;
private static ItemStack persimmon;
private static int amount;
@Override
public boolean isAvailable() {
@@ -71,16 +74,23 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
persimmon = new ItemStack(food, 1, 8);
}
addFlowers();
addFarmCrops();
if (PluginManager.Module.APICULTURE.isEnabled()) {
addFlowers();
}
if (PluginManager.Module.FARMING.isEnabled()) {
addFarmCrops();
}
}
@Override
protected void registerRecipes() {
super.registerRecipes();
addFermenterRecipes();
addSqueezerRecipes();
amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
if (PluginManager.Module.FACTORY.isEnabled()) {
addFermenterRecipes();
addSqueezerRecipes();
}
}
private static void addFarmCrops() {
@@ -106,8 +116,12 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
Block boPTurnip = GameRegistry.findBlock(BoP, "turnip");
if (boPTurnip != null) {
Item boPTurnipSeeds = GameRegistry.findItem(BoP, "turnipSeeds");
ItemStack boPTurnipSeedStack = new ItemStack(boPTurnipSeeds, 1, 0);
if (boPTurnipSeeds != null) {
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(boPTurnipSeeds, 1, 0), boPTurnip, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(boPTurnipSeedStack, boPTurnip, 7));
if (PluginManager.Module.FACTORY.isEnabled()) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{boPTurnipSeedStack}, Fluids.SEEDOIL.getFluid(amount));
}
}
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(boPTurnip, 7));
@@ -128,6 +142,15 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
private static void addSqueezerRecipes() {
ItemStack mulch = new ItemStack(PluginCore.items.mulch);
misc = GameRegistry.findItem(BoP, "misc");
if (misc != null) {
ItemStack pinecone = new ItemStack(misc, 1, 13);
if (pinecone != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{pinecone}, Fluids.SEEDOIL.getFluid(3* amount));
}
}
if (food != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(food)}, Fluids.JUICE.getFluid(50), mulch, 5);
}
@@ -140,22 +163,22 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
private static void addFlowers() {
Block flowers = GameRegistry.findBlock(BoP, "flowers");
if (flowers != null) {
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 0, 1.0, FlowerManager.FlowerTypeVanilla); //Clover
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 1, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeMushrooms); //Swampflower
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Clover
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 1, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms); //Swampflower
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 2, 1.0, FlowerManager.FlowerTypeNether); //Deathbloom
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 3, 1.0, FlowerManager.FlowerTypeVanilla); //GlowFlower
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 4, 1.0, FlowerManager.FlowerTypeVanilla); //Blue Hydrangea
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 5, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeJungle); //Orange Cosmos
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 6, 1.0, FlowerManager.FlowerTypeVanilla); //Pink Daffodil
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 7, 1.0, FlowerManager.FlowerTypeVanilla); //WildFlower
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 3, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //GlowFlower
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 4, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Blue Hydrangea
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 5, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeJungle); //Orange Cosmos
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 6, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Pink Daffodil
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 7, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //WildFlower
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 8, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Violet
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 9, 1.0, FlowerManager.FlowerTypeVanilla); // White Anemone
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 10, 1.0, FlowerManager.FlowerTypeVanilla); // Waterlily
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 11, 1.0, FlowerManager.FlowerTypeVanilla); //EnderLotus (does not actually spawn in the end)
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 9, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // White Anemone
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 10, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // Waterlily
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 11, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //EnderLotus (does not actually spawn in the end)
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 12, 1.0, FlowerManager.FlowerTypeCacti); //Bromeliad
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 13, 1.0, FlowerManager.FlowerTypeNether); // EyeBulb
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 14, 1.0, FlowerManager.FlowerTypeNether); // Unlisted top of the eyebulb
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 15, 1.0, FlowerManager.FlowerTypeVanilla); // Dandelion Puff
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 15, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // Dandelion Puff
}
Block flowers2 = GameRegistry.findBlock(BoP, "flowers2");
@@ -13,6 +13,7 @@ package forestry.plugins.compat;
import com.google.common.collect.ImmutableMap;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -39,7 +40,7 @@ public class PluginGrowthCraft extends ForestryPlugin {
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(GC);
return ModUtil.isModLoaded(GC, "[1.7.10-1.0.0,1.7.10-2.5.0)");
}
@Override
@@ -92,18 +93,20 @@ public class PluginGrowthCraft extends ForestryPlugin {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicGrowthCraft(riceBlock, 7, true, false)); //need to set paddyfield to 7
}
ItemStack emptyComb = new ItemStack(GameRegistry.findItem("Growthcraft|Bees", "grc.honeyComb"), 1, 0);
RecipeManagers.centrifugeManager.addRecipe(20, emptyComb, ImmutableMap.of(
PluginCore.items.beeswax.getItemStack(), 1.0f)
);
if (PluginManager.Module.APICULTURE.isEnabled()) {
ItemStack fullComb = new ItemStack(GameRegistry.findItem("Growthcraft|Bees", "grc.honeyComb"), 1, 1);
RecipeManagers.centrifugeManager.addRecipe(20, fullComb, ImmutableMap.of(
PluginCore.items.beeswax.getItemStack(), 1.0f,
PluginApiculture.items.honeyDrop.getItemStack(), 0.9f,
PluginApiculture.items.honeydew.getItemStack(), 0.1f)
);
Item comb = GameRegistry.findItem("Growthcraft|Bees", "grc.honeyComb");
if (comb != null) {
ItemStack emptyComb = new ItemStack(comb, 1, 0);
RecipeManagers.centrifugeManager.addRecipe(20, emptyComb, ImmutableMap.of(
PluginCore.items.beeswax.getItemStack(), 1.0f)
);
ItemStack fullComb = new ItemStack(comb, 1, 1);
RecipeManagers.centrifugeManager.addRecipe(20, fullComb, ImmutableMap.of(
PluginCore.items.beeswax.getItemStack(), 1.0f,
PluginApiculture.items.honeyDrop.getItemStack(), 0.9f,
PluginApiculture.items.honeydew.getItemStack(), 0.1f)
);
}
}
ItemStack bamboo = GameRegistry.findItemStack("Growthcraft|Bamboo", "grc.bamboo", 1);
@@ -124,7 +127,7 @@ public class PluginGrowthCraft extends ForestryPlugin {
ItemStack grapes = GameRegistry.findItemStack("Growthcraft|Grapes", "grc.grapes", 1); //squeeze
if (grapes != null) {
if (grapes.getItem() != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{grapes}, Fluids.JUICE.getFluid(juiceAmount));
BackpackManager.backpackItems[2].add(grapes);
}
@@ -32,6 +32,7 @@ import forestry.farming.logic.FarmableGenericCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.Plugin;
import forestry.plugins.PluginCore;
import forestry.plugins.PluginManager;
@Plugin(pluginID = "HarvestCraft", name = "HarvestCraft", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.harvestcraft.description")
public class PluginHarvestCraft extends ForestryPlugin {
@@ -201,7 +202,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
if (berrySeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{berrySeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (berrySeed != null && berryBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && berrySeed != null && berryBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(berrySeed, berryBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(berryBlock, 7));
}
@@ -219,7 +220,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
if (fruitSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{fruitSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (fruitSeed != null && fruitBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && fruitSeed != null && fruitBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(fruitSeed, fruitBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(fruitBlock, 7));
}
@@ -238,7 +239,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
if (vegetableSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{vegetableSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (vegetableSeed != null && vegetableBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && vegetableSeed != null && vegetableBlock != null) {
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(vegetableSeed, vegetableBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(vegetableBlock, 7));
}
@@ -257,7 +258,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{grainSeed}, Fluids.SEEDOIL.getFluid(seedamount));
RecipeManagers.moistenerManager.addRecipe(grainSeed, new ItemStack(Blocks.mycelium), 5000);
}
if (grainSeed != null && grainBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && grainSeed != null && grainBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(grainSeed, grainBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(grainBlock, 7));
}
@@ -267,7 +268,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
for (String treeFruitName : treeFruits) {
ItemStack treeFruit = GameRegistry.findItemStack(HC, treeFruitName + "Item", 1);
Block treeFruitBlock = GameRegistry.findBlock(HC, "pam" + (Character.toUpperCase(treeFruitName.charAt(0)) + treeFruitName.substring(1)));
if (treeFruitBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && treeFruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(treeFruitBlock, 2));
}
if (treeFruit != null) {
@@ -278,7 +279,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
for (String treeName : trees) {
Block fruitBlock = GameRegistry.findBlock(HC, "pam" + (Character.toUpperCase(treeName.charAt(0)) + treeName.substring(1)));
if (fruitBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && fruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(fruitBlock, 2));
}
plants.add(treeName);
@@ -286,7 +287,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
for (String treeName : treesSpecial) {
Block fruitBlock = GameRegistry.findBlock(HC, "pam" + (Character.toUpperCase(treeName.charAt(0)) + treeName.substring(1)));
if (fruitBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && fruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(fruitBlock, 2));
}
}
@@ -297,19 +298,19 @@ public class PluginHarvestCraft extends ForestryPlugin {
if (genericCropSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{genericCropSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (genericCropSeed != null && genericCropBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && genericCropSeed != null && genericCropBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(genericCropSeed, genericCropBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(genericCropBlock, 7));
}
plants.add(cropName);
}
ItemStack mustardCropSeed = GameRegistry.findItemStack(HC,"mustard" + "seedItem",1);
Block mustardCropBlock = GameRegistry.findBlock(HC,"pam"+"mustardseeds" + "Crop");
ItemStack mustardFruit = GameRegistry.findItemStack(HC,"mustard" + "seedsItem",1);
ItemStack mustardCropSeed = GameRegistry.findItemStack(HC, "mustard" + "seedItem", 1);
Block mustardCropBlock = GameRegistry.findBlock(HC, "pam" + "mustardseeds" + "Crop");
ItemStack mustardFruit = GameRegistry.findItemStack(HC, "mustard" + "seedsItem", 1);
if (mustardCropSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{mustardCropSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (mustardCropSeed != null && mustardCropBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && mustardCropSeed != null && mustardCropBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(mustardCropSeed, mustardCropBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(mustardCropBlock, 7));
}
@@ -331,23 +332,23 @@ public class PluginHarvestCraft extends ForestryPlugin {
if (cropnutSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{cropnutSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (cropnutSeed != null && cropnutBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && cropnutSeed != null && cropnutBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(cropnutSeed, cropnutBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(cropnutBlock, 7));
}
if (cropnut != null) {
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{cropnut}, Fluids.SEEDOIL.getFluid(3 * seedamount));
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{cropnut}, Fluids.SEEDOIL.getFluid(12 * seedamount));
}
}
for (String nutName : nuts) {
ItemStack nut = GameRegistry.findItemStack(HC, nutName + "Item", 1);
Block nutBlock = GameRegistry.findBlock(HC, "pam" + (Character.toUpperCase(nutName.charAt(0)) + nutName.substring(1)));
if (nutBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && nutBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(nutBlock, 2));
}
if (nut != null) {
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{nut}, Fluids.SEEDOIL.getFluid(3 * seedamount));
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{nut}, Fluids.SEEDOIL.getFluid(15 * seedamount));
}
}
@@ -12,11 +12,19 @@ package forestry.plugins.compat;
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.farming.Farmables;
import forestry.farming.logic.FarmableBasicIC2Crop;
import ic2.api.crops.ICropTile;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@@ -300,6 +308,11 @@ public class PluginIC2 extends ForestryPlugin {
ChipsetManager.solderManager.addRecipe(layoutManual, PluginCore.items.tubes.get(EnumElectronTube.RUBBER, 1), Circuit.farmRubberManual);
}
Block ic2Crop = GameRegistry.findBlock("IC2", "blockCrop");
if (PluginManager.Module.FARMING.isEnabled() && ic2Crop != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicIC2Crop());
}
BlockRegistryEnergy energyBlocks = PluginEnergy.blocks;
if (energyBlocks != null) {
RecipeUtil.addRecipe(energyBlocks.engine.get(BlockEngineType.GENERATOR),
@@ -320,4 +333,78 @@ public class PluginIC2 extends ForestryPlugin {
'V', Blocks.piston);
}
}
/**
* Check if there is an instance of ICropTile.
* @param tileEntity tile entity to be checked.
* @return true if there is an IC2 crop and false otherwise.
*/
@Optional.Method(modid = "IC2")
public boolean isIC2Crop(TileEntity tileEntity) {
if (tileEntity != null && tileEntity instanceof ICropTile) {
return true;
}
return false;
}
/**
* Check if an IC2 crop is ready to be harvested.
* @param tileEntity tile entity to be checked.
* @return true if crop size is optimal for harvest and false otherwise.
*/
@Optional.Method(modid = "IC2")
public boolean canHarvestCrop(TileEntity tileEntity) {
if (isIC2Crop(tileEntity)) {
ICropTile crop = (ICropTile)tileEntity;
if (crop.getCrop() == null) {
return false;
}
if (crop.getSize() == crop.getCrop().getOptimalHavestSize(crop)) {
return true;
}
}
return false;
}
/**
* Perform some of the actions of the crop-matron.
* @param tileEntity
*/
@Optional.Method(modid = "IC2")
public void babysitCrop(TileEntity tileEntity) {
if (isIC2Crop(tileEntity)) {
ICropTile crop = (ICropTile)tileEntity;
/*
This part might be unbalanced until a custom farm logic is added and makes use of weed-ex.
if (crop.getCrop() != null) {
if (crop.getCrop().isWeed(crop)) {
crop.reset();
}
}*/
if (crop.getHydrationStorage() <= 200) {
crop.setHydrationStorage(200);
}
if (crop.getNutrientStorage() <= 100) {
crop.setNutrientStorage(crop.getNutrientStorage() + 100);
}
}
}
/**
* This function takes care of everything related to the harvesting of the
* crop meaning it will calculate the drops and also do setSizeAfterHarvest().
* @param tileEntity tile entity to be checked.
* @return arraylist containing the drops.
*/
@Optional.Method(modid = "IC2")
public ArrayList<ItemStack> getCropDrops(TileEntity tileEntity) {
if (isIC2Crop(tileEntity)) {
ICropTile crop = (ICropTile)tileEntity;
ItemStack[] cropDrops = crop.harvest_automated(true);
if (cropDrops != null) {
return new ArrayList<>(Arrays.asList(cropDrops));
}
}
return null;
}
}
@@ -41,7 +41,7 @@ public class PluginImmersiveEngineering extends ForestryPlugin {
}
@Override
protected void registerRecipes() {
protected void postInit() {
ItemStack hempSeed = GameRegistry.findItemStack(ImEng, "seed", 1);
Block hempCrop = GameRegistry.findBlock(ImEng, "hemp");
@@ -33,6 +33,7 @@ import forestry.farming.logic.FarmableGenericCrop;
import forestry.farming.logic.FarmableStacked;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.Plugin;
import forestry.plugins.PluginManager;
@Plugin(pluginID = "PlantMegaPack", name = "PlantMegaPack", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.plantmegapack.description")
public class PluginPlantMegaPack extends ForestryPlugin {
@@ -158,7 +159,7 @@ public class PluginPlantMegaPack extends ForestryPlugin {
.put("cropRice", 4)
.put("cropWaterSpinach", 4)
.put("cropWildRice", 4)
.put("immersedArrowArum", 4)
.put("immersedCommonReed", 4)
.put("immersedDuckPotato", 4)
@@ -365,7 +366,9 @@ public class PluginPlantMegaPack extends ForestryPlugin {
ItemStack reedStack = GameRegistry.findItemStack(PlantMP, reedLike, 1);
if (reedBlock != null && reedStack != null) {
RecipeUtil.addFermenterRecipes(reedStack, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
Farmables.farmables.get("farmPoales").add(new FarmableStacked(reedBlock, 14, 4));
if (PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmPoales").add(new FarmableStacked(reedBlock, 14, 4));
}
}
}
@@ -380,8 +383,10 @@ public class PluginPlantMegaPack extends ForestryPlugin {
if (seedStack != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{seedStack}, Fluids.SEEDOIL.getFluid(seedamount));
}
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seedStack, landCropBlock, 4));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(landCropBlock, 4));
if (PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seedStack, landCropBlock, 4));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(landCropBlock, 4));
}
}
}
@@ -396,7 +401,7 @@ public class PluginPlantMegaPack extends ForestryPlugin {
for (Map.Entry<String, Integer> wPlant : floatingWaterPlant.entrySet()) {
Block waterPlantBlock = GameRegistry.findBlock(PlantMP, wPlant.getKey());
if (waterPlantBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && waterPlantBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(waterPlantBlock, wPlant.getValue()));
}
}
@@ -412,15 +417,17 @@ public class PluginPlantMegaPack extends ForestryPlugin {
if (foodStack != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{foodStack}, Fluids.JUICE.getFluid(juiceAmount));
}
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(berryBushStack, berryBushCropBlock, berryBushCrop.getValue()));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(berryBushCropBlock, berryBushCrop.getValue()));
if (PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(berryBushStack, berryBushCropBlock, berryBushCrop.getValue()));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(berryBushCropBlock, berryBushCrop.getValue()));
}
}
}
addMetaFlower(desertPlant, FlowerManager.FlowerTypeCacti, false);
addMetaFlower(junglePlant, FlowerManager.FlowerTypeJungle, true);
addMetaFlower(vanillaPlant, FlowerManager.FlowerTypeVanilla, true);
addMetaFlower(fungusPlant, FlowerManager.FlowerTypeMushrooms, true);
addMetaFlower(desertPlant, false, FlowerManager.FlowerTypeCacti);
addMetaFlower(junglePlant, false, FlowerManager.FlowerTypeJungle);
addMetaFlower(vanillaPlant, true, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
addMetaFlower(fungusPlant, true, FlowerManager.FlowerTypeMushrooms);
for (Map.Entry<String, String> special : specialCaseTwoTall.entrySet()) {
Block plantBlock = GameRegistry.findBlock(PlantMP, special.getKey());
@@ -428,7 +435,9 @@ public class PluginPlantMegaPack extends ForestryPlugin {
if (plantBlock != null && plantBlock != null) {
FlowerManager.flowerRegistry.registerAcceptableFlower(plantBlock, special.getValue());
FlowerManager.flowerRegistry.registerPlantableFlower(plantBlock, 0, 0.75, special.getValue());
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(specialStack, plantBlock, 4));
if (PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(specialStack, plantBlock, 4));
}
}
}
@@ -440,7 +449,7 @@ public class PluginPlantMegaPack extends ForestryPlugin {
}
}
private static void addMetaFlower(ImmutableMap<String, Integer> flowerMap, String flowertype, boolean plantable) {
private static void addMetaFlower(ImmutableMap<String, Integer> flowerMap, boolean plantable, String... flowertype) {
for (Map.Entry<String, Integer> flower : flowerMap.entrySet()) {
Block flowerBlock = GameRegistry.findBlock(PlantMP, flower.getKey());
ItemStack flowerStack = GameRegistry.findItemStack(PlantMP, flower.getKey(), 1);
@@ -448,7 +457,7 @@ public class PluginPlantMegaPack extends ForestryPlugin {
if (plantable && flowerBlock != null) {
FlowerManager.flowerRegistry.registerPlantableFlower(flowerBlock, 0, 0.75, flowertype);
}
if (flowerStack != null && flowerBlock != null) {
if (PluginManager.Module.FARMING.isEnabled() && flowerStack != null && flowerBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(flowerStack, flowerBlock, flower.getValue()));
if (flower.getValue() < 5) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(flowerBlock, flower.getValue()));
@@ -0,0 +1,64 @@
/*******************************************************************************
* 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.plugins.compat;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.Farmables;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.utils.ModUtil;
import forestry.farming.logic.FarmableBasicFruit;
import forestry.farming.logic.FarmableGenericCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.Plugin;
import forestry.plugins.PluginManager;
@Plugin(pluginID = "RotaryCraft", name = "RotaryCraft", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.rotarycraft.description")
public class PluginRotaryCraft extends ForestryPlugin {
private static final String RC = "RotaryCraft";
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(RC);
}
@Override
public String getFailMessage() {
return "RotaryCraft not found";
}
@Override
protected void registerRecipes() {
ItemStack canolaSeed = GameRegistry.findItemStack(RC, "rotarycraft_item_canola", 1);
Block canolaCrop = GameRegistry.findBlock(RC, "rotarycraft_block_canola");
int seedAmount = (ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed") / 16);
seedAmount = Math.max(seedAmount, 1); // Produce at least 1 mb.
if (canolaSeed != null && canolaCrop != null) {
if(PluginManager.Module.FACTORY.isEnabled()) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{canolaSeed}, Fluids.SEEDOIL.getFluid(seedAmount));
}
if(PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(canolaSeed, canolaCrop, 9));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(canolaCrop, 9));
}
}
}
}
@@ -84,7 +84,7 @@ public class PluginWitchery extends ForestryPlugin {
for (String flowerAcceptName : flowersAccept) {
Block flowerBlock = GameRegistry.findBlock(Witch, flowerAcceptName);
if (flowerBlock != null) {
FlowerManager.flowerRegistry.registerAcceptableFlower(flowerBlock, FlowerManager.FlowerTypeVanilla);
FlowerManager.flowerRegistry.registerAcceptableFlower(flowerBlock, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
}
}
for (String cropDirectName : cropDirect) {