Compare commits

...
20 Commits
Author SHA1 Message Date
mezz 05c6f4effa Backport some fixes for BTM 2016-07-19 16:11:33 -07:00
mezz b9c36df910 Fix Escritoire renderer leaking the world object by keeping a reference
Conflicts:
	gradle.properties
2016-07-19 16:10:49 -07:00
mezz d2fe7ac8a4 Fix butterfly items rendering too low 2016-07-19 16:10:30 -07:00
Nedelosk 2bdca1266a Update EntityButterfly.java 2016-07-19 16:10:24 -07:00
mezz dd3cc6aef9 Update icons that use cans or capsules 2016-07-19 16:10:12 -07:00
mezz 41c20ea97a Change portable alyzer icon to 16x 2016-07-19 16:10:05 -07:00
mezz 2dbc507486 Fix isOp permissions check 2016-07-19 16:09:29 -07:00
mezz a56200228f Fix #1340 Rare NPE from BeekeepingLogic.queenWorkTick
Conflicts:
	gradle.properties
2016-07-19 16:09:07 -07:00
mezz 951d38abfa Fix doors not showing correctly in TheOneProbe 2016-07-19 16:08:30 -07:00
mezz 542cbab826 Improve escritoire responsiveness on slow networks or laggy servers 2016-07-19 16:07:59 -07:00
mezz 17237e41f8 Fix bee particles becoming active at night when hive is opened 2016-07-19 16:07:19 -07:00
mezz c7f268f200 Fix localization of latticed heath butterfly and ash pile
Conflicts:
	lang
2016-07-19 16:06:14 -07:00
mezz 645dba903d Improve the look of cherry tree leaf generation 2016-06-22 21:14:38 -07:00
mezz 1ac4acdb47 Fix ebony trees growing offcenter from their saplings 2016-06-22 21:13:52 -07:00
mezz 74aa33e80c Remove all the saplings when a large tree grows 2016-06-22 21:13:35 -07:00
mezz 6f6b45abcf Add EnderIO compat for ice coolant and ethanol fuel 2016-06-22 19:00:05 -07:00
mezz 7297a6a5d3 Add ExtraUtils2 EnderLily compat for the farm 2016-06-22 18:40:07 -07:00
mezz 5ef76cffca Fix invalid recipes warning when BoP plugin is enabled 2016-06-22 16:19:40 -07:00
mezz 9284f84645 Fix pipette filling bug 2016-06-22 16:18:55 -07:00
mezz 85ba33e1ff Add trapdoorWood oredict name 2016-06-20 23:11:44 -07:00
54 changed files with 370 additions and 183 deletions

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
mcversion=1.9.4
forgeversion=12.17.0.1957
forgeversion=12.17.0.1968
mcp_mappings=snapshot_20160525
jei_version=3.6.4.+
@@ -7,4 +7,4 @@ ic2_version=2.5.5-ex19
version_major=5
version_minor=0
version_patch=20
version_patch=24
+2 -2
View File
@@ -1,6 +1,6 @@
#Mon Sep 14 12:28:28 PDT 2015
#Tue Jun 21 15:23:47 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
+1 -1
Submodule lang updated: 9be86d3c99...a8bbc7bd1c.
+1 -1
View File
@@ -49,7 +49,7 @@ import forestry.plugins.PluginManager;
name = "Forestry",
version = Constants.VERSION,
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
dependencies = "required-after:Forge@[12.17.0.1949,);"
dependencies = "required-after:Forge@[12.17.0.1963,);"
+ "after:Buildcraft|Core@[7.2,);"
+ "after:BuildCraft|Energy@[7.2,);"
+ "after:ExtrabiomesXL;"
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nonnull;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
@@ -32,6 +34,7 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
*/
Iterable<IBeeListener> getBeeListeners();
@Nonnull
IBeeHousingInventory getBeeInventory();
IBeekeepingLogic getBeekeepingLogic();
@@ -84,7 +84,7 @@ public interface ITree extends IIndividual, ITreeGenData {
* @return Integer denoting the size of the tree trunk.
*/
@Override
int getGirth(World world, BlockPos pos);
int getGirth();
/**
* @return Growth conditions at the given position.
@@ -18,7 +18,7 @@ import forestry.api.arboriculture.ITreeGenome;
public interface ITreeGenData {
int getGirth(World world, BlockPos pos);
int getGirth();
float getHeightModifier();
@@ -11,6 +11,7 @@
package forestry.apiculture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -233,18 +234,20 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
if (beeType == EnumBeeType.PRINCESS) {
tickBreed();
} else if (beeType == EnumBeeType.QUEEN) {
queenWorkTick(queen);
queenWorkTick(queen, queenStack);
}
}
@Override
public void clearCachedValues() {
hasFlowersCache.clear();
queenCanWorkCache.clear();
canWork();
if (!housing.getWorldObj().isRemote) {
hasFlowersCache.clear();
queenCanWorkCache.clear();
canWork();
}
}
private void queenWorkTick(IBee queen) {
private void queenWorkTick(@Nullable IBee queen, @Nonnull ItemStack queenStack) {
if (queen == null) {
beeProgress = 0;
beeProgressMax = 0;
@@ -270,7 +273,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
// Write the changed queen back into the item stack.
NBTTagCompound nbttagcompound = new NBTTagCompound();
queen.writeToNBT(nbttagcompound);
housing.getBeeInventory().getQueen().setTagCompound(nbttagcompound);
queenStack.setTagCompound(nbttagcompound);
housing.getBeeInventory().setQueen(queenStack);
}
beeProgress = queen.getHealth();
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.entities;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -36,8 +37,11 @@ import forestry.core.config.Config;
import forestry.core.inventory.IInventoryAdapter;
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
@Nonnull
private static final IBeeModifier beeModifier = new ApiaryBeeModifier();
@Nonnull
private final IBeeListener beeListener = new ApiaryBeeListener(this);
@Nonnull
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
@SuppressWarnings("unused")
@@ -64,6 +68,7 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
return inventory;
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return inventory;
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.entities;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
@@ -72,6 +73,7 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
return Collections.singleton(beeListener);
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return beeInventory;
@@ -53,6 +53,7 @@ import forestry.core.utils.Translator;
public class AlvearyController extends RectangularMultiblockControllerBase implements IAlvearyControllerInternal, IClimateControlled {
@Nonnull
private final InventoryBeeHousing inventory;
private final IBeekeepingLogic beekeepingLogic;
@@ -77,6 +78,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
this.beeModifiers.add(new AlvearyBeeModifier());
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return inventory;
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.multiblock;
import javax.annotation.Nonnull;
import java.util.Collections;
import net.minecraft.util.math.BlockPos;
@@ -45,6 +46,7 @@ public class FakeAlvearyController extends FakeMultiblockController implements I
return Collections.emptyList();
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return FakeBeeHousingInventory.instance;
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.multiblock;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.List;
@@ -99,6 +100,7 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
return getMultiblockLogic().getController().getBeeListeners();
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return getMultiblockLogic().getController().getBeeInventory();
@@ -1,10 +1,13 @@
package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import forestry.api.apiculture.IBeeHousingInventory;
public class FakeBeeHousingInventory implements IBeeHousingInventory {
@Nonnull
public static final FakeBeeHousingInventory instance = new FakeBeeHousingInventory();
private FakeBeeHousingInventory() {
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -30,8 +31,11 @@ import forestry.apiculture.inventory.IApiaryInventory;
import forestry.apiculture.inventory.InventoryApiary;
public class TileApiary extends TileBeeHousingBase implements IApiary {
@Nonnull
private final IBeeModifier beeModifier = new ApiaryBeeModifier();
@Nonnull
private final IBeeListener beeListener = new ApiaryBeeListener(this);
@Nonnull
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
public TileApiary() {
@@ -39,6 +43,7 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
setInternalInventory(inventory);
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return inventory;
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import java.util.Collections;
import net.minecraft.entity.player.EntityPlayer;
@@ -24,9 +25,12 @@ import forestry.apiculture.gui.ContainerBeeHousing;
import forestry.apiculture.gui.GuiBeeHousing;
public class TileBeeHouse extends TileBeeHousingBase {
@Nonnull
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
@Nonnull
private final IBeeListener beeListener;
@Nonnull
private final InventoryBeeHousing beeInventory;
public TileBeeHouse() {
@@ -38,6 +42,7 @@ public class TileBeeHouse extends TileBeeHousingBase {
setInternalInventory(beeInventory);
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return beeInventory;
@@ -293,6 +293,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
return Collections.emptyList();
}
@Nonnull
@Override
public IBeeHousingInventory getBeeInventory() {
return inventory;
@@ -101,7 +101,6 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
return new ItemStack(getItem());
}
@@ -203,7 +203,7 @@ public class Tree extends Individual implements ITree, IPlantable {
}
@Override
public int getGirth(World world, BlockPos pos) {
public int getGirth() {
return genome.getGirth();
}
@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import forestry.arboriculture.blocks.BlockSapling;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -61,6 +62,7 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
}
if (genPos != null) {
clearSaplings(world, genPos);
List<BlockPos> branchEnds = new ArrayList<>(generateTrunk(world, rand, wood, genPos));
Collections.sort(branchEnds, TopDownBlockPosComparator.INSTANCE);
generateLeaves(world, rand, leaf, branchEnds, genPos);
@@ -96,6 +98,18 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
@Nullable
public abstract BlockPos getValidGrowthPos(World world, BlockPos pos);
public void clearSaplings(World world, BlockPos genPos) {
int treeGirth = tree.getGirth();
for (int x = 0; x < treeGirth; x++) {
for (int z = 0; z < treeGirth; z++) {
BlockPos saplingPos = genPos.add(x, 0, z);
if (world.getBlockState(saplingPos).getBlock() instanceof BlockSapling) {
world.setBlockToAir(saplingPos);
}
}
}
}
public boolean hasPods() {
return tree.allowsFruitBlocks();
}
@@ -47,12 +47,13 @@ public class WorldGenCherry extends WorldGenTree {
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
int leafSpawn = height + 1;
int leafSpawn = height + 2;
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn, 0), girth, (float) 1 + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn, 0), girth, 1 + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
for (BlockPos branchEnd : branchEnds) {
WorldGenHelper.generateCircle(world, rand, branchEnd, 4, 3, 2, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
WorldGenHelper.generateCircle(world, rand, branchEnd.up(), 3, 3, 1, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
WorldGenHelper.generateCircle(world, rand, branchEnd, 4, 3, 1, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
}
}
}
@@ -31,11 +31,10 @@ public class WorldGenEbony extends WorldGenTree {
@Nonnull
@Override
public Set<BlockPos> generateTrunk(World world, Random rand, TreeBlockTypeLog wood, BlockPos startPos) {
int offset = (girth - 1) / 2;
int trunksGenerated = 0;
for (int x = -offset; x < -offset + girth; x++) {
for (int z = -offset; z < -offset + girth; z++) {
for (int x = 0; x < girth; x++) {
for (int z = 0; z < girth; z++) {
if (rand.nextFloat() < 0.6f) {
for (int y = 0; y < height; y++) {
WorldGenHelper.addBlock(world, startPos.add(x, y, z), wood, WorldGenHelper.EnumReplaceMode.ALL);
@@ -68,8 +67,8 @@ public class WorldGenEbony extends WorldGenTree {
h = height / 2 + rand.nextInt(height / 2);
}
int x_off = -girth + rand.nextInt(2 * girth);
int y_off = -girth + rand.nextInt(2 * girth);
int x_off = rand.nextInt(girth);
int y_off = rand.nextInt(girth);
BlockPos center = startPos.add(x_off, h, y_off);
int radius = 1 + rand.nextInt(girth);
@@ -74,7 +74,7 @@ public abstract class WorldGenTree extends WorldGenArboriculture {
public final void preGenerate(World world, Random rand, BlockPos startPos) {
super.preGenerate(world, rand, startPos);
height = determineHeight(world, rand, baseHeight, heightVariation);
girth = tree.getGirth(world, startPos);
girth = tree.getGirth();
}
protected int modifyByHeight(World world, int val, int min, int max) {
@@ -69,5 +69,6 @@ public class BlockRegistryCore extends BlockRegistry {
// register some common oreDict names for our recipes
OreDictionary.registerOre(OreDictUtil.CRAFTING_TABLE_WOOD, Blocks.CRAFTING_TABLE);
OreDictionary.registerOre(OreDictUtil.TRAPDOOR_WOOD, Blocks.TRAPDOOR);
}
}
@@ -23,16 +23,11 @@ import forestry.core.tiles.EscritoireGame;
import forestry.core.tiles.TileEscritoire;
public class ContainerEscritoire extends ContainerTile<TileEscritoire> implements IGuiSelectable {
private final EntityPlayer player;
private long lastUpdate;
public ContainerEscritoire(EntityPlayer player, TileEscritoire tile) {
super(tile, player.inventory, 34, 153);
this.player = player;
// Analyze slot
addSlotToContainer(new SlotFiltered(this.tile, InventoryEscritoire.SLOT_ANALYZE, 97, 67).setPickupWatcher(this.tile).setStackLimit(1));
@@ -54,7 +49,7 @@ public class ContainerEscritoire extends ContainerTile<TileEscritoire> implement
long gameLastUpdate = tile.getGame().getLastUpdate();
if (lastUpdate != gameLastUpdate) {
lastUpdate = gameLastUpdate;
Proxies.net.sendToPlayer(new PacketGuiUpdate(tile), player);
sendPacketToListeners(new PacketGuiUpdate(tile));
}
}
@@ -91,6 +91,7 @@ public class GameTokenWidget extends Widget {
@Override
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
game.choose(index);
Proxies.net.sendToServer(new PacketGuiSelectRequest(index, 0));
}
}
@@ -59,7 +59,6 @@ public class ItemPipette extends ItemForestry implements IToolPipette, IFluidCon
}
contained = new PipetteContents(new FluidStack(liquid, filled));
filled = liquid.amount;
} else {
if (contained.getContents().amount >= limit) {
return 0;
@@ -141,7 +140,7 @@ public class ItemPipette extends ItemForestry implements IToolPipette, IFluidCon
contained.getContents().amount -= drained;
if (contained.getContents().amount <= 0) {
pipette.setTagCompound(null);
pipette.setTagCompound(new NBTTagCompound());
pipette.setItemDamage(0);
} else {
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -65,7 +65,7 @@ public class ProxyCommon {
public boolean isOp(EntityPlayer player) {
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
UserListOpsEntry userlistopsentry = server.getPlayerList().getOppedPlayers().getEntry(player.getGameProfile());
return userlistopsentry.getPermissionLevel() >= server.getOpPermissionLevel();
return userlistopsentry != null && userlistopsentry.getPermissionLevel() >= server.getOpPermissionLevel();
}
public double getBlockReachDistance(EntityPlayer entityplayer) {
@@ -6,8 +6,9 @@ import forestry.core.utils.Translator;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
public abstract class ForestryRecipeCategory extends BlankRecipeCategory {
public abstract class ForestryRecipeCategory<T extends IRecipeWrapper> extends BlankRecipeCategory<T> {
@Nonnull
private final IDrawable background;
@Nonnull
@@ -1,72 +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.core.recipes.jei;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.IFluidContainerItem;
public class JEIUtils {
public static List<ItemStack> getItemVariations(ItemStack base) {
List<ItemStack> variations = new ArrayList<>();
base.getItem().getSubItems(base.getItem(), null, variations);
Iterator<ItemStack> itr = variations.iterator();
ItemStack stack;
while (itr.hasNext()) {
stack = itr.next();
if (!base.isItemEqual(stack) || !stack.hasTagCompound()) {
itr.remove();
}
}
if (variations.isEmpty()) {
return Collections.singletonList(base);
}
return variations;
}
public static FluidStack getFluidStack(ItemStack stack) {
if (stack != null) {
FluidStack fluidStack = null;
if (stack.getItem() instanceof IFluidContainerItem) {
fluidStack = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
}
if (fluidStack == null) {
fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
}
if (fluidStack == null && Block.getBlockFromItem(stack.getItem()) instanceof IFluidBlock) {
Fluid fluid = ((IFluidBlock) Block.getBlockFromItem(stack.getItem())).getFluid();
if (fluid != null) {
fluidStack = new FluidStack(fluid, Fluid.BUCKET_VOLUME);
}
}
return fluidStack;
}
return null;
}
public static boolean areFluidsSameType(FluidStack fluidStack1, FluidStack fluidStack2) {
if (fluidStack1 == null || fluidStack2 == null) {
return false;
}
return fluidStack1.getFluid() == fluidStack2.getFluid();
}
}
@@ -104,6 +104,8 @@ public class RenderEscritoire extends TileEntitySpecialRenderer<TileEscritoire>
rendermanager.doRenderEntity(dummyEntityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, false);
}
GlStateManager.popMatrix();
dummyEntityItem.worldObj = null; // prevent leaking the world object
}
}
}
@@ -17,6 +17,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Random;
import forestry.api.genetics.IAllele;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -72,10 +73,10 @@ public class EscritoireGameBoard implements INbtWritable, IStreamable {
tokenCount = getTokenCount(genome);
for (int i = 0; i < tokenCount / 2; i++) {
IIndividual token = root.templateAsIndividual(root.getRandomTemplate(rand));
ItemStack pair = root.getMemberStack(token, root.getIconType());
gameTokens.add(new EscritoireGameToken(pair));
gameTokens.add(new EscritoireGameToken(pair));
IAllele[] randomTemplate = root.getRandomTemplate(rand);
String speciesUid = randomTemplate[root.getSpeciesChromosomeType().ordinal()].getUID();
gameTokens.add(new EscritoireGameToken(speciesUid));
gameTokens.add(new EscritoireGameToken(speciesUid));
}
Collections.shuffle(gameTokens);
return true;
@@ -14,17 +14,19 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.core.INbtWritable;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.IStreamable;
import forestry.core.utils.ColourUtil;
import forestry.core.utils.Translator;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class EscritoireGameToken implements INbtWritable, IStreamable {
@@ -41,6 +43,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
private static final String[] OVERLAY_FAILED = new String[]{"errors/errored"};
private static final String[] OVERLAY_SELECTED = new String[]{"errors/unknown"};
@Nullable
private IIndividual tokenIndividual;
@Nullable
private ItemStack tokenStack;
@Nonnull
@@ -51,8 +55,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
// required for IStreamable serialization
}
public EscritoireGameToken(@Nullable ItemStack tokenStack) {
this.tokenStack = tokenStack;
public EscritoireGameToken(@Nullable String speciesUid) {
setTokenSpecies(speciesUid);
}
public EscritoireGameToken(@Nonnull NBTTagCompound nbttagcompound) {
@@ -61,8 +65,29 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
state = State.values()[stateOrdinal];
}
// legacy
if (nbttagcompound.hasKey("tokenStack")) {
tokenStack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("tokenStack"));
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(tokenStack);
tokenIndividual = speciesRoot.getMember(tokenStack);
}
if (nbttagcompound.hasKey("tokenSpecies")) {
String speciesUid = nbttagcompound.getString("tokenSpecies");
setTokenSpecies(speciesUid);
}
}
private void setTokenSpecies(String speciesUid) {
IAllele allele = AlleleManager.alleleRegistry.getAllele(speciesUid);
if (allele instanceof IAlleleSpecies) {
IAlleleSpecies species = (IAlleleSpecies) allele;
ISpeciesRoot root = species.getRoot();
IAllele[] template = root.getTemplate(speciesUid);
if (template != null) {
this.tokenIndividual = root.templateAsIndividual(template);
this.tokenStack = root.getMemberStack(this.tokenIndividual, root.getIconType());
}
}
}
@@ -108,12 +133,11 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
}
public int getTokenColour() {
if (tokenStack == null || !isVisible()) {
if (tokenIndividual == null || !isVisible()) {
return 0xffffff;
}
IIndividual individual = AlleleManager.alleleRegistry.getIndividual(tokenStack);
int iconColor = individual.getGenome().getPrimary().getSpriteColour(0);
int iconColor = tokenIndividual.getGenome().getPrimary().getSpriteColour(0);
if (state == State.MATCHED) {
return ColourUtil.multiplyRGBComponents(iconColor, 0.7f);
@@ -146,10 +170,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("state", state.ordinal());
if (tokenStack != null) {
NBTTagCompound stackcompound = new NBTTagCompound();
tokenStack.writeToNBT(stackcompound);
nbttagcompound.setTag("tokenStack", stackcompound);
if (tokenIndividual != null) {
nbttagcompound.setString("tokenSpecies", tokenIndividual.getGenome().getPrimary().getUID());
}
return nbttagcompound;
}
@@ -158,12 +180,20 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
@Override
public void writeData(DataOutputStreamForestry data) throws IOException {
data.writeEnum(state, State.VALUES);
data.writeItemStack(tokenStack);
if (tokenIndividual != null) {
data.writeBoolean(true);
data.writeUTF(tokenIndividual.getGenome().getPrimary().getUID());
} else {
data.writeBoolean(false);
}
}
@Override
public void readData(DataInputStreamForestry data) throws IOException {
state = data.readEnum(State.VALUES);
tokenStack = data.readItemStack();
if (data.readBoolean()) {
String speciesUid = data.readUTF();
setTokenSpecies(speciesUid);
}
}
}
@@ -14,11 +14,17 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import cofh.api.energy.IEnergyConnection;
import cofh.api.energy.IEnergyReceiver;
import forestry.core.network.packets.PacketFXSignal;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileEngine;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.BlockOldLog;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockStaticLiquid;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
@@ -31,16 +37,8 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import forestry.core.network.packets.PacketFXSignal;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileEngine;
import cofh.api.energy.IEnergyConnection;
import cofh.api.energy.IEnergyReceiver;
public abstract class BlockUtil {
private static final int slabWoodId = OreDictionary.getOreID("slabWood");
@@ -343,4 +341,17 @@ public abstract class BlockUtil {
}
return false;
}
@Nullable
public static <T extends Comparable<T>> IProperty<T> getProperty(Block block, String propertyName, Class<T> valueClass) {
for (IProperty<?> property : block.getDefaultState().getPropertyNames()) {
if (property.getName().equals(propertyName)) {
if (property.getValueClass().isAssignableFrom(valueClass)) {
//noinspection unchecked
return (IProperty<T>) property;
}
}
}
return null;
}
}
@@ -34,6 +34,7 @@ public class OreDictUtil {
public static final String FENCE_GATE_WOOD = "fenceGateWood";
public static final String STAIR_WOOD = "stairWood";
public static final String DOOR_WOOD = "doorWood";
public static final String TRAPDOOR_WOOD = "trapdoorWood";
public static final String TREE_LEAVES = "treeLeaves";
public static final String EMPTIED_LETTER_ORE_DICT = "emptiedLetter";
@@ -29,6 +29,10 @@ public class FermenterRecipe implements IFermenterRecipe {
if (resource == null) {
throw new NullPointerException("Fermenter Resource cannot be null!");
}
if (resource.getItem() == null) {
throw new NullPointerException("Fermenter Resource item cannot be null!");
}
if (output == null) {
throw new NullPointerException("Fermenter Output cannot be null!");
@@ -92,7 +92,7 @@ public class FactoryJeiPlugin extends BlankModPlugin {
registry.addRecipes(CarpenterRecipeMaker.getCarpenterRecipes());
registry.addRecipes(CentrifugeRecipeMaker.getCentrifugeRecipe());
registry.addRecipes(FabricatorRecipeMaker.getFabricatorRecipes());
registry.addRecipes(FermenterRecipeMaker.getFermenterRecipes());
registry.addRecipes(FermenterRecipeMaker.getFermenterRecipes(jeiHelpers.getStackHelper()));
registry.addRecipes(MoistenerRecipeMaker.getMoistenerRecipes());
registry.addRecipes(RainmakerRecipeMaker.getRecipes());
registry.addRecipes(SqueezerRecipeMaker.getSqueezerRecipes());
@@ -23,7 +23,7 @@ import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
public class FermenterRecipeCategory extends ForestryRecipeCategory {
public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRecipeWrapper> {
private static final int resourceSlot = 0;
private static final int fuelSlot = 1;
@@ -62,7 +62,7 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermenterRecipeWrapper recipeWrapper) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
@@ -72,18 +72,15 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory {
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 3000, false, tankOverlay);
guiFluidStacks.init(outputTank, false, 91, 1, 16, 58, 3000, false, tankOverlay);
FermenterRecipeWrapper wrapper = (FermenterRecipeWrapper) recipeWrapper;
guiItemStacks.set(resourceSlot, wrapper.getFermentable());
guiItemStacks.set(resourceSlot, recipeWrapper.getFermentable());
List<ItemStack> fuels = new ArrayList<>();
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
fuels.add(fuel.item);
}
guiItemStacks.set(fuelSlot, fuels);
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
guiFluidStacks.set(outputTank, wrapper.getFluidOutputs());
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
guiFluidStacks.set(outputTank, recipeWrapper.getFluidOutputs());
}
}
@@ -8,22 +8,29 @@ import net.minecraft.item.ItemStack;
import forestry.api.recipes.IFermenterRecipe;
import forestry.api.recipes.IVariableFermentable;
import forestry.api.recipes.RecipeManagers;
import forestry.core.recipes.jei.JEIUtils;
import forestry.core.utils.Log;
import forestry.factory.recipes.jei.FactoryJeiPlugin;
import mezz.jei.api.recipe.IStackHelper;
public class FermenterRecipeMaker {
private FermenterRecipeMaker() {
}
public static List<FermenterRecipeWrapper> getFermenterRecipes() {
public static List<FermenterRecipeWrapper> getFermenterRecipes(IStackHelper stackHelper) {
List<FermenterRecipeWrapper> recipes = new ArrayList<>();
for (IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()) {
if (recipe.getResource() != null && recipe.getResource().getItem() instanceof IVariableFermentable) {
for (ItemStack stack : JEIUtils.getItemVariations(recipe.getResource())) {
recipes.add(new FermenterRecipeWrapper(recipe, stack));
if (recipe.getResource() != null) {
if (recipe.getResource().getItem() instanceof IVariableFermentable) {
for (ItemStack stack : stackHelper.getSubtypes(recipe.getResource())) {
recipes.add(new FermenterRecipeWrapper(recipe, stack));
}
} else {
recipes.add(new FermenterRecipeWrapper(recipe, recipe.getResource()));
}
} else {
recipes.add(new FermenterRecipeWrapper(recipe, recipe.getResource()));
Log.error("Null resource for recipe");
}
}
return recipes;
@@ -42,6 +42,7 @@ import forestry.core.circuits.CircuitLayout;
import forestry.core.config.Constants;
import forestry.core.items.EnumElectronTube;
import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.OreDictUtil;
import forestry.farming.blocks.BlockMushroom;
import forestry.farming.blocks.BlockRegistryFarming;
import forestry.farming.blocks.EnumFarmBlockType;
@@ -207,7 +208,7 @@ public class PluginFarming extends BlankForestryPlugin {
"TDT",
'#', basic,
'T', "gearTin",
'D', Blocks.TRAPDOOR);
'D', OreDictUtil.TRAPDOOR_WOOD);
RecipeUtil.addRecipe(valve,
" # ",
@@ -27,6 +27,7 @@ import forestry.core.fluids.Fluids;
import forestry.core.items.EnumElectronTube;
import forestry.core.network.IPacketRegistry;
import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.OreDictUtil;
import forestry.greenhouse.blocks.BlockGreenhouseType;
import forestry.greenhouse.blocks.BlockRegistryGreenhouse;
import forestry.greenhouse.logics.GreenhouseLogicGreenhouseDoor;
@@ -91,7 +92,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
"TXT",
"#H#",
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
'H', Blocks.TRAPDOOR,
'H', OreDictUtil.TRAPDOOR_WOOD,
'#', "gearTin",
'T', PluginCore.items.tubes.get(EnumElectronTube.BRONZE, 1));
@@ -100,7 +101,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
"#H#",
"TXT",
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
'H', Blocks.TRAPDOOR,
'H', OreDictUtil.TRAPDOOR_WOOD,
'#', "gearTin",
'T', PluginCore.items.tubes.get(EnumElectronTube.BRONZE, 1));
@@ -231,7 +231,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
BlockPos posBelow = pos.down();
IBlockState blockStateBelow = worldObj.getBlockState(posBelow);
Block blockBelow = blockState.getBlock();
Block blockBelow = blockStateBelow.getBlock();
if (blockBelow.isLeaves(blockStateBelow, worldObj, posBelow)) {
weight += 2.5f;
} else if (blockBelow instanceof BlockFence) {
@@ -33,7 +33,7 @@ import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
public enum MothDefinition implements IButterflyDefinition {
Brimstone(ButterflyBranchDefinition.Opisthograptis, "brimstone", "luteolata", new Color(0xffea40), true, 1.0f),
LatticedHeath(ButterflyBranchDefinition.Chiasmia, "latticeHeath", "clathrata", new Color(0xf2f0be), true, 0.5f) {
LatticedHeath(ButterflyBranchDefinition.Chiasmia, "latticedHeath", "clathrata", new Color(0xf2f0be), true, 0.5f) {
@Override
protected void setAlleles(IAllele[] alleles) {
AlleleHelper.instance.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALLEST);
@@ -51,7 +51,7 @@ public class ModelButterflyItem extends BlankItemModel {
ImmutableMap.Builder<String, String> textures = ImmutableMap.builder();
textures.put("butterfly", butterfly.getGenome().getSecondary().getItemTexture());
IModel retexturedModel = ModelProcessingHelper.retexture(modelButterfly, textures.build());
return new TRSRBakedModel(retexturedModel.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, textureGetter), -0.03125F, 0.0F, -0.03125F, butterfly.getSize() * 1.5F);
return new TRSRBakedModel(retexturedModel.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, textureGetter), -0.03125F, 0.5F, -0.03125F, butterfly.getSize() * 1.5F);
}
private class ButterflyItemOverrideList extends ItemOverrideList {
@@ -20,6 +20,8 @@ public class ForestryPluginUids {
public static final String BUILDCRAFT_STATEMENTS = "forestry.buildcraft.statements";
public static final String BUILDCRAFT_TRANSPORT = "forestry.buildcraft.transport";
public static final String CHISEL = "forestry.chisel";
public static final String ENDER_IO = "forestry.ender.io";
public static final String EXTRA_UTILITIES = "forestry.extra.utilities";
public static final String NATURA = "forestry.natura";
public static final String INDUSTRIALCRAFT2 = "forestry.industrialcraft2";
}
@@ -14,14 +14,18 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.Farmables;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.BackpackManager;
import forestry.core.PluginCore;
@@ -31,6 +35,8 @@ import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.farming.logic.FarmableBasicAgricraft;
import forestry.farming.logic.FarmableGE;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@@ -43,8 +49,6 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
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
@@ -61,12 +65,9 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
public void doInit() {
super.doInit();
saplings = GameRegistry.findBlock(BoP, "saplings");
colorizedSaplings = GameRegistry.findBlock(BoP, "colorizedSaplings");
food = GameRegistry.findItem(BoP, "food");
if (food != null) {
persimmon = new ItemStack(food, 1, 8);
}
saplings = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(BoP, "saplings"));
colorizedSaplings = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(BoP, "colorizedSaplings"));
food = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, "food"));
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
addFlowers();
@@ -98,21 +99,21 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
}
for (String key : saplingItemKeys) {
Item saplingItem = GameRegistry.findItem(BoP, key);
Item saplingItem = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, key));
String saplingName = ItemStackUtil.getItemNameFromRegistryAsString(saplingItem);
if (saplingName != null) {
FMLInterModComms.sendMessage(Constants.MOD_ID, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingName));
}
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && saplings != null && persimmon != null) {
//TODO BoP for 1.9: Add farmables
//TODO BoP for 1.9: Add farmables
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && saplings != null && persimmon != null) {
// Farmables.farmables.put("farmArboreal", new FarmableGenericSapling(saplings, 15, persimmon));
}
// }
Block boPTurnip = GameRegistry.findBlock(BoP, "turnip");
Block boPTurnip = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(BoP, "turnip"));
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && boPTurnip != null) {
Item boPTurnipSeeds = GameRegistry.findItem(BoP, "turnipSeeds");
Item boPTurnipSeeds = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, "turnipSeeds"));
ItemStack boPTurnipSeedStack = new ItemStack(boPTurnipSeeds, 1, 0);
if (boPTurnipSeeds != null) {
//TODO BoP for 1.9: Add farmable saplings
@@ -130,11 +131,11 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
private static void addFermenterRecipes() {
int saplingYield = ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling");
if (saplings != null) {
if (saplings != Blocks.AIR) {
RecipeUtil.addFermenterRecipes(new ItemStack(saplings, 1, OreDictionary.WILDCARD_VALUE), saplingYield, Fluids.BIOMASS);
}
if (colorizedSaplings != null) {
if (colorizedSaplings != Blocks.AIR) {
RecipeUtil.addFermenterRecipes(new ItemStack(colorizedSaplings, 1, OreDictionary.WILDCARD_VALUE), saplingYield, Fluids.BIOMASS);
}
}
@@ -142,20 +143,18 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
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.SEED_OIL.getFluid(3 * amount));
}
Item pinecone = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, "pinecone"));
if (pinecone != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(pinecone)}, Fluids.SEED_OIL.getFluid(3 * amount));
}
if (food != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(food)}, Fluids.JUICE.getFluid(50), mulch, 5);
}
Item persimmon = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, "persimmon"));
if (persimmon != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{persimmon}, Fluids.JUICE.getFluid(200), mulch, 20);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(persimmon)}, Fluids.JUICE.getFluid(200), mulch, 20);
}
}
@@ -234,7 +233,7 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
private static void addBlocksToBackpack(String backpackUid, String... blockNames) {
for (String blockName : blockNames) {
Block block = GameRegistry.findBlock(BoP, blockName);
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(BoP, blockName));
if (block != null) {
ItemStack blockStack = new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE);
BackpackManager.backpackInterface.getBackpack(backpackUid).addValidItem(blockStack);
@@ -0,0 +1,70 @@
package forestry.plugins.compat;
import forestry.api.core.ForestryAPI;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.utils.ModUtil;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fml.common.event.FMLInterModComms;
@ForestryPlugin(pluginID = ForestryPluginUids.ENDER_IO, name = "EnderIO", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.enderIO.description")
public class PluginEnderIO extends BlankForestryPlugin {
private static final String EnderIO = "EnderIO";
private static final String FLUID_FUEL_ADD = "fluidFuel:add";
private static final String FLUID_COOLANT_ADD = "fluidCoolant:add";
private static final String KEY_FLUID_NAME = "fluidName";
private static final String KEY_POWER_PER_CYCLE = "powerPerCycle";
private static final String KEY_TOTAL_BURN_TIME = "totalBurnTime";
private static final String KEY_COOLING_PER_MB = "coolingPerMb";
private static final float WATER_COOLING_PER_MB = 0.0023f;
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(EnderIO);
}
@Override
public String getFailMessage() {
return "EnderIO not found";
}
@Override
public void doInit() {
Fluid ethanol = Fluids.BIO_ETHANOL.getFluid();
if (ethanol != null) {
int ethanolBurnTime = Math.round(Constants.ENGINE_CYCLE_DURATION_ETHANOL * ForestryAPI.activeMode.getFloatSetting("fuel.ethanol.combustion"));
addFuel(ethanol, 40, ethanolBurnTime);
}
Fluid crushedIce = Fluids.ICE.getFluid();
if (crushedIce != null) {
addCoolant(crushedIce, Constants.ICE_COOLING_MULTIPLIER);
}
}
private static void addFuel(Fluid fluid, int powerPerCycle, int totalBurnTime) {
NBTTagCompound fuelTag = new NBTTagCompound();
fuelTag.setString(KEY_FLUID_NAME, fluid.getName());
fuelTag.setInteger(KEY_POWER_PER_CYCLE, powerPerCycle);
fuelTag.setInteger(KEY_TOTAL_BURN_TIME, totalBurnTime);
FMLInterModComms.sendMessage(EnderIO, FLUID_FUEL_ADD, fuelTag);
}
private static void addCoolant(Fluid fluid, float coolingMultiplier) {
float coolingPerMb = coolingMultiplier * WATER_COOLING_PER_MB;
NBTTagCompound coolantTag = new NBTTagCompound();
coolantTag.setString(KEY_FLUID_NAME, fluid.getName());
coolantTag.setFloat(KEY_COOLING_PER_MB, coolingPerMb);
FMLInterModComms.sendMessage(EnderIO, FLUID_COOLANT_ADD, coolantTag);
}
}
@@ -0,0 +1,89 @@
/*******************************************************************************
* 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 java.util.Collections;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.Farmables;
import forestry.core.PluginCore;
import forestry.core.circuits.Circuit;
import forestry.core.config.Config;
import forestry.core.config.Constants;
import forestry.core.items.EnumElectronTube;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicEnder;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
@ForestryPlugin(pluginID = ForestryPluginUids.EXTRA_UTILITIES, name = "ExtraUtilities", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.extrautilities.description")
public class PluginExtraUtilities extends BlankForestryPlugin {
private static final String ExU = "ExtraUtils2";
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(ExU);
}
@Override
public String getFailMessage() {
return "ExtraUtilities not found";
}
@Override
public void doInit() {
super.doInit();
if (Config.isExUtilEnderLilyEnabled()) {
Block enderLillyBlock = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("extrautils2", "EnderLilly"));
Item enderLillyItem = Item.getItemFromBlock(enderLillyBlock);
if (enderLillyBlock == Blocks.AIR) {
Log.error("Could not find ender lilly block.");
} else if (enderLillyItem == null) {
Log.error("Could not find ender lilly item.");
} else {
IProperty<Integer> growthProperty = BlockUtil.getProperty(enderLillyBlock, "growth", Integer.class);
if (growthProperty == null) {
Log.error("Could not find the growth property of ender lily.");
} else {
int harvestAge = Collections.max(growthProperty.getAllowedValues());
int replantAge = enderLillyBlock.getDefaultState().getValue(growthProperty);
Farmables.farmables.put("farmEnder", new FarmableAgingCrop(new ItemStack(enderLillyItem), enderLillyBlock, growthProperty, harvestAge, replantAge));
Circuit.farmEnderManaged = new CircuitFarmLogic("managedEnder", new FarmLogicEnder());
}
}
}
}
@Override
public void registerRecipes() {
super.registerRecipes();
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && Circuit.farmEnderManaged != null) {
ICircuitLayout layoutManaged = ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed");
ChipsetManager.solderManager.addRecipe(layoutManaged, PluginCore.items.tubes.get(EnumElectronTube.ENDER, 1), Circuit.farmEnderManaged);
}
}
}
@@ -219,11 +219,12 @@ public class PluginStorage extends BlankForestryPlugin {
"stainedGlass[A-Z].*",
"stone",
"sandstone",
"plankWood",
"stairWood",
"slabWood",
OreDictUtil.PLANK_WOOD,
OreDictUtil.STAIR_WOOD,
OreDictUtil.SLAB_WOOD,
OreDictUtil.FENCE_WOOD,
OreDictUtil.FENCE_GATE_WOOD,
OreDictUtil.TRAPDOOR_WOOD,
"glass",
"paneGlass",
"torch",
@@ -350,7 +351,6 @@ public class PluginStorage extends BlankForestryPlugin {
new ItemStack(Blocks.PURPUR_SLAB),
new ItemStack(Blocks.END_BRICKS),
new ItemStack(Blocks.CARPET, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.TRAPDOOR),
new ItemStack(Blocks.IRON_TRAPDOOR),
new ItemStack(Blocks.STONE_PRESSURE_PLATE),
new ItemStack(Blocks.WOODEN_PRESSURE_PLATE),
Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 236 B