mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 03:39:09 +00:00
Merge branch 'dev' into inventory-cleanup
Conflicts: src/main/java/forestry/apiculture/gadgets/TileAlvearyHygroregulator.java src/main/java/forestry/core/circuits/ItemSolderingIron.java src/main/java/forestry/core/gadgets/TileAnalyzer.java src/main/java/forestry/energy/gadgets/EngineBronze.java src/main/java/forestry/energy/gadgets/MachineGenerator.java src/main/java/forestry/factory/gadgets/MachineBottler.java src/main/java/forestry/factory/gadgets/MachineCarpenter.java src/main/java/forestry/factory/gadgets/MachineFabricator.java src/main/java/forestry/factory/gadgets/MachineMoistener.java src/main/java/forestry/factory/gadgets/MachineRaintank.java src/main/java/forestry/factory/gadgets/MachineSqueezer.java src/main/java/forestry/factory/gadgets/MachineStill.java src/main/java/forestry/mail/gadgets/MachineTrader.java
This commit is contained in:
commit
db93c6e930
107 files changed
+1673
-1763
No files matched your search
@@ -23,10 +23,12 @@ import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.proxy.ProxyLog;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
@@ -261,7 +263,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
try {
|
||||
boolean canWork = true;
|
||||
// Not while raining, at night or without light
|
||||
EnumErrorCode state = queen.canWork(housing);
|
||||
IErrorState state = queen.canWork(housing);
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state);
|
||||
canWork = false;
|
||||
@@ -270,6 +272,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
return canWork;
|
||||
} catch (Error e) {
|
||||
Proxies.log.logErrorAPI("Forestry", e, IBee.class);
|
||||
return queenCanWorkDeprecated();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.core.commands.ICommandModeHelper;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BeeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String[] getModeNames() {
|
||||
ArrayList<IBeekeepingMode> beekeepingModes = PluginApiculture.beeInterface.getBeekeepingModes();
|
||||
int modeStringCount = beekeepingModes.size();
|
||||
List<String> modeStrings = new ArrayList<String>(modeStringCount);
|
||||
for (IBeekeepingMode mode : beekeepingModes)
|
||||
modeStrings.add(mode.getName());
|
||||
|
||||
return modeStrings.toArray(new String[modeStringCount]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeNameMatching(String desired) {
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(desired);
|
||||
if (mode == null)
|
||||
return null;
|
||||
return mode.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeName(World world) {
|
||||
return PluginApiculture.beeInterface.getBeekeepingMode(world).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMode(World world, String modeName) {
|
||||
PluginApiculture.beeInterface.setBeekeepingMode(world, modeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getDescription(String modeName) {
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(modeName);
|
||||
return mode.getDescription();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.core.commands.IStatsSaveHelper;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public class BeeStatsSaveHelper implements IStatsSaveHelper {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedSaveStatsString() {
|
||||
return "for.chat.command.forestry.bee.save.stats";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraInfo(Collection<String> statistics, IBreedingTracker breedingTracker) {
|
||||
IApiaristTracker tracker = (IApiaristTracker)breedingTracker;
|
||||
String discoveredLine = StatCollector.translateToLocal("for.chat.command.forestry.stats.save.key.discovered") + ":";
|
||||
statistics.add(discoveredLine);
|
||||
statistics.add(StringUtil.line(discoveredLine.length()));
|
||||
|
||||
String queen = StatCollector.translateToLocal("for.bees.grammar.queen.type");
|
||||
String princess = StatCollector.translateToLocal("for.bees.grammar.princess.type");
|
||||
String drone = StatCollector.translateToLocal("for.bees.grammar.drone.type");
|
||||
statistics.add(queen + ":\t\t" + tracker.getQueenCount());
|
||||
statistics.add(princess + ":\t" + tracker.getPrincessCount());
|
||||
statistics.add(drone + ":\t\t" + tracker.getDroneCount());
|
||||
statistics.add("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IAlleleSpecies> getSpecies() {
|
||||
Collection<IAlleleSpecies> species = new ArrayList<IAlleleSpecies>();
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values())
|
||||
if (allele instanceof IAlleleBeeSpecies)
|
||||
species.add((IAlleleBeeSpecies) allele);
|
||||
return species;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileSuffix() {
|
||||
return "bees";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBreedingTracker getBreedingTracker(World world, GameProfile gameProfile) {
|
||||
return PluginApiculture.beeInterface.getBreedingTracker(world, gameProfile);
|
||||
}
|
||||
|
||||
}
|
||||
+15
-7
@@ -10,15 +10,23 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
|
||||
import forestry.core.commands.CommandMode;
|
||||
import forestry.core.commands.CommandSaveStats;
|
||||
import forestry.core.commands.ICommandModeHelper;
|
||||
import forestry.core.commands.IStatsSaveHelper;
|
||||
import forestry.core.commands.SubCommand;
|
||||
|
||||
public class CommandBeekeeping extends SubCommand {
|
||||
public class CommandBee extends SubCommand {
|
||||
|
||||
public CommandBeekeeping() {
|
||||
super("beekeeping");
|
||||
addAlias("bee");
|
||||
addChildCommand(new CommandBeekeepingMode());
|
||||
addChildCommand(new CommandBeekeepingSave());
|
||||
addChildCommand(new CommandBeekeepingGiveBee());
|
||||
public CommandBee() {
|
||||
super("bee");
|
||||
addAlias("beekeeping");
|
||||
|
||||
IStatsSaveHelper saveHelper = new BeeStatsSaveHelper();
|
||||
ICommandModeHelper modeHelper = new BeeModeHelper();
|
||||
|
||||
addChildCommand(new CommandMode(modeHelper));
|
||||
addChildCommand(new CommandSaveStats(saveHelper, modeHelper));
|
||||
addChildCommand(new CommandBeeGive());
|
||||
}
|
||||
}
|
||||
+13
-12
@@ -10,31 +10,32 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.apiculture.SpeciesNotFoundException;
|
||||
import forestry.apiculture.TemplateNotFoundException;
|
||||
import forestry.core.commands.CommandHelpers;
|
||||
import forestry.core.commands.SpeciesNotFoundException;
|
||||
import forestry.core.commands.SubCommand;
|
||||
import forestry.core.commands.TemplateNotFoundException;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandBeekeepingGiveBee extends SubCommand {
|
||||
public class CommandBeeGive extends SubCommand {
|
||||
|
||||
private final String beeTypeHelpString;
|
||||
private final String[] beeTypeArr;
|
||||
|
||||
public CommandBeekeepingGiveBee() {
|
||||
public CommandBeeGive() {
|
||||
super("give");
|
||||
setPermLevel(PermLevel.ADMIN);
|
||||
|
||||
@@ -92,7 +93,7 @@ public class CommandBeekeepingGiveBee extends SubCommand {
|
||||
ItemStack beeStack = PluginApiculture.beeInterface.getMemberStack(bee, beeType.ordinal());
|
||||
player.dropPlayerItemWithRandomChoice(beeStack, true);
|
||||
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.give.given", player.getCommandSenderName(), bee.getGenome().getPrimary().getName(), beeType.getName());
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.bee.give.given", player.getCommandSenderName(), bee.getGenome().getPrimary().getName(), beeType.getName());
|
||||
}
|
||||
|
||||
private static IBeeGenome getBeeGenome(String speciesName) {
|
||||
@@ -19,8 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
@@ -32,11 +30,9 @@ import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankContainer {
|
||||
|
||||
@@ -18,10 +18,11 @@ import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
import forestry.api.core.ITileStructure;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
@@ -423,7 +424,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return getErrorState().ordinal();
|
||||
return getErrorState().getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -773,7 +774,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
/* IERRORSOURCE */
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
public IErrorState getErrorState() {
|
||||
if (hasMaster()) {
|
||||
ITileStructure tile = this.getCentralTE();
|
||||
if (tile != null)
|
||||
|
||||
@@ -15,7 +15,7 @@ import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
@@ -426,7 +426,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised,
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return getErrorState().ordinal();
|
||||
return getErrorState().getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,21 +51,21 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
|
||||
int duration = this.duration;
|
||||
int dur = this.duration;
|
||||
if (isBadEffect) {
|
||||
// Players are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = ItemArmorApiarist.wearsItems((EntityPlayer) entity, getUID(), true);
|
||||
if (count >= 4)
|
||||
continue; // Full set, no damage/effect
|
||||
else if (count == 3)
|
||||
duration = this.duration / 4;
|
||||
dur = this.duration / 4;
|
||||
else if (count == 2)
|
||||
duration = this.duration / 2;
|
||||
dur = this.duration / 2;
|
||||
else if (count == 1)
|
||||
duration = this.duration * 3 / 4;
|
||||
dur = this.duration * 3 / 4;
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(potion.getId(), duration, 0));
|
||||
player.addPotionEffect(new PotionEffect(potion.getId(), dur, 0));
|
||||
}
|
||||
|
||||
return storedData;
|
||||
@@ -74,7 +74,7 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
//FIXME: remove when Potion.isBadEffect() is available server-side
|
||||
private static boolean isBadEffect(Potion potion) {
|
||||
try {
|
||||
return ReflectionHelper.getPrivateValue(Potion.class, potion, "field_76418_K", "isBadEffect");
|
||||
return (Boolean) ReflectionHelper.getPrivateValue(Potion.class, potion, "field_76418_K", "isBadEffect");
|
||||
} catch (ReflectionHelper.UnableToFindFieldException e) {
|
||||
Proxies.log.severe("Could not access potion field isBadEffect.");
|
||||
return false;
|
||||
|
||||
@@ -16,7 +16,7 @@ import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.EffectData;
|
||||
import forestry.core.utils.Vect;
|
||||
@@ -55,14 +55,14 @@ public abstract class AlleleEffectThrottled extends Allele implements IAlleleBee
|
||||
|
||||
public boolean isHalted(IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
if (requiresWorkingQueen && housing.getErrorOrdinal() != EnumErrorCode.OK.ordinal())
|
||||
if (requiresWorkingQueen && housing.getErrorState() != EnumErrorCode.OK)
|
||||
return true;
|
||||
|
||||
int throttle = storedData.getInteger(0);
|
||||
throttle++;
|
||||
storedData.setInteger(0, throttle);
|
||||
int throt = storedData.getInteger(0);
|
||||
throt++;
|
||||
storedData.setInteger(0, throt);
|
||||
|
||||
if (throttle < getThrottle())
|
||||
if (throt < getThrottle())
|
||||
return true;
|
||||
|
||||
// Reset since we are done throttling.
|
||||
|
||||
@@ -20,7 +20,7 @@ import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
|
||||
@@ -30,7 +30,7 @@ import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.render.TextureBiomefinder;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.apiculture.trigger;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.apiculture.trigger;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -1,49 +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.arboriculture;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import forestry.arboriculture.genetics.TreeTemplates;
|
||||
import forestry.arboriculture.worldgen.WorldGenBalsa;
|
||||
import forestry.core.utils.CommandMC;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class CommandSpawnForest extends CommandMC {
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "spawnforest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return "/" + getCommandName() + " <player-name> <species-name>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] arguments) {
|
||||
EntityPlayer player = getCommandSenderAsPlayer(sender);
|
||||
|
||||
int x = (int) player.posX - 16;
|
||||
int y = (int) (player.posY);
|
||||
int z = (int) player.posZ - 16;
|
||||
|
||||
WorldGenerator gen = new WorldGenBalsa((ITreeGenData) PluginArboriculture.treeInterface.getTree(player.worldObj,
|
||||
TreeTemplates.templateAsGenome(PluginArboriculture.treeInterface.getTemplate("treeBalsa"))));
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
gen.generate(player.worldObj, player.worldObj.rand, x + player.worldObj.rand.nextInt(32), y, z + player.worldObj.rand.nextInt(32));
|
||||
}
|
||||
}
|
||||
@@ -1,52 +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.arboriculture;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import forestry.arboriculture.genetics.TreeTemplates;
|
||||
import forestry.arboriculture.worldgen.WorldGenBalsa;
|
||||
import forestry.core.utils.CommandMC;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class CommandSpawnTree extends CommandMC {
|
||||
|
||||
public CommandSpawnTree() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "spawntree";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return "/" + getCommandName() + " <player-name> <species-name>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] arguments) {
|
||||
EntityPlayer player = getCommandSenderAsPlayer(sender);
|
||||
|
||||
int x = (int) player.posX;
|
||||
int y = (int) (player.posY);
|
||||
int z = (int) player.posZ;
|
||||
|
||||
WorldGenerator gen = new WorldGenBalsa((ITreeGenData) PluginArboriculture.treeInterface.getTree(player.worldObj,
|
||||
TreeTemplates.templateAsGenome(PluginArboriculture.treeInterface.getTemplate("treeBalsa"))));
|
||||
|
||||
gen.generate(player.worldObj, player.worldObj.rand, x, y, z);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,247 +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.arboriculture;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.IArboristTracker;
|
||||
import forestry.api.arboriculture.ITreekeepingMode;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.Version;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.CommandMC;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class CommandTreekeepingMode extends CommandMC {
|
||||
|
||||
private final String[] modeStrings;
|
||||
|
||||
public CommandTreekeepingMode() {
|
||||
modeStrings = new String[PluginArboriculture.treeInterface.getTreekeepingModes().size()];
|
||||
for (int i = 0; i < PluginArboriculture.treeInterface.getTreekeepingModes().size(); i++)
|
||||
modeStrings[i] = PluginArboriculture.treeInterface.getTreekeepingModes().get(i).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object arg0) {
|
||||
return this.getCommandName().compareTo(((ICommand) arg0).getCommandName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "treekeeping";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender var1) {
|
||||
return "/" + this.getCommandName() + " help";
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public List getCommandAliases() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] arguments) {
|
||||
|
||||
if (arguments.length <= 0)
|
||||
throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help", this.getCommandUsage(sender)));
|
||||
|
||||
if (arguments[0].matches("list"))
|
||||
listModes(sender, arguments);
|
||||
else if (arguments[0].matches("info"))
|
||||
listModeInfo(sender, arguments);
|
||||
else if (arguments[0].matches("set")) {
|
||||
if (arguments.length <= 1)
|
||||
throw new WrongUsageException("/" + this.getCommandName() + " set [<world-#>] <mode-name>");
|
||||
|
||||
World world = getWorld(sender, arguments);
|
||||
String desired = arguments[arguments.length - 1];
|
||||
|
||||
ITreekeepingMode mode = PluginArboriculture.treeInterface.getTreekeepingMode(desired);
|
||||
if (mode == null)
|
||||
throw new CommandException(StringUtil.localize("chat.trees.command.treekeeping.error"), desired);
|
||||
|
||||
PluginArboriculture.treeInterface.setTreekeepingMode(world, mode.getName());
|
||||
func_152373_a(sender, this, StringUtil.localize("chat.trees.command.treekeeping.set"), mode.getName());
|
||||
|
||||
} else if (arguments[0].matches("save")) {
|
||||
if (arguments.length <= 1)
|
||||
throw new WrongUsageException("/" + this.getCommandName() + " save <player-name>");
|
||||
|
||||
saveStatistics(sender, arguments);
|
||||
} else if (arguments[0].matches("help")) {
|
||||
sendChatMessage(sender, StringUtil.localizeAndFormat("chat.trees.command.help.0", this.getCommandName()));
|
||||
sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.1"));
|
||||
sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.2"));
|
||||
sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.3"));
|
||||
sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.4"));
|
||||
sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.5"));
|
||||
}
|
||||
}
|
||||
|
||||
private void saveStatistics(ICommandSender sender, String[] arguments) {
|
||||
|
||||
String newLine = System.getProperty("line.separator");
|
||||
World world = getWorld(sender, arguments);
|
||||
|
||||
String player = arguments[1];
|
||||
Collection<String> statistics = new ArrayList<String>();
|
||||
|
||||
statistics.add(String.format("Treekeeping statistics for %s on %s:", player, DateFormat.getInstance().format(new Date())));
|
||||
statistics.add("");
|
||||
statistics.add("MODE: " + PluginArboriculture.treeInterface.getTreekeepingMode(world).getName());
|
||||
statistics.add("");
|
||||
|
||||
GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152655_a(player);
|
||||
IArboristTracker tracker = PluginArboriculture.treeInterface.getBreedingTracker(world, profile);
|
||||
if (tracker == null)
|
||||
statistics.add("No statistics found.");
|
||||
else {
|
||||
statistics.add("BRED:");
|
||||
statistics.add("-----");
|
||||
statistics.add("");
|
||||
|
||||
Collection<IAlleleTreeSpecies> species = new ArrayList<IAlleleTreeSpecies>();
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values())
|
||||
if (allele instanceof IAlleleTreeSpecies)
|
||||
species.add((IAlleleTreeSpecies) allele);
|
||||
|
||||
statistics.add(String.format("SPECIES (%s):", species.size()));
|
||||
statistics.add("-------------");
|
||||
statistics.add("");
|
||||
|
||||
for (IAlleleTreeSpecies allele : species)
|
||||
statistics.add(generateSpeciesListEntry(allele, tracker));
|
||||
}
|
||||
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Defaults.MOD.toLowerCase(Locale.ENGLISH) + "/stats/" + player + ".log");
|
||||
try {
|
||||
|
||||
if (file.getParentFile() != null)
|
||||
file.getParentFile().mkdirs();
|
||||
|
||||
if (!file.exists() && !file.createNewFile()) {
|
||||
sendChatMessage(sender, "Log file could not be created. Failed to save statistics.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!file.canWrite()) {
|
||||
sendChatMessage(sender, "Cannot write to log file. Failed to save statistics.");
|
||||
return;
|
||||
}
|
||||
|
||||
FileOutputStream fileout = new FileOutputStream(file);
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fileout, "UTF-8"));
|
||||
|
||||
writer.write("# " + Defaults.MOD + newLine + "# " + Version.getVersion() + newLine);
|
||||
|
||||
for (String line : statistics)
|
||||
writer.write(line + newLine);
|
||||
|
||||
writer.close();
|
||||
|
||||
} catch (Exception ex) {
|
||||
sendChatMessage(sender, "Write operation threw an exception. Failed to save statistics.");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
sendChatMessage(sender, "Saved statistics for player " + player);
|
||||
}
|
||||
|
||||
private String generateSpeciesListEntry(IAlleleTreeSpecies species, IArboristTracker tracker) {
|
||||
String discovered = "[ ]";
|
||||
if (tracker.isDiscovered(species))
|
||||
discovered = "[ X ]";
|
||||
String blacklisted = "[ ]";
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(species.getUID()))
|
||||
blacklisted = "[ BL ]";
|
||||
String notcounted = "[ ]";
|
||||
if (!species.isCounted())
|
||||
notcounted = "[ NC ]";
|
||||
|
||||
return String.format("%s %s %s\t%-40s %-20s %-20s", discovered, blacklisted, notcounted, species.getUID(), species.getName(), species.getAuthority());
|
||||
}
|
||||
|
||||
private void listModes(ICommandSender sender, String[] arguments) {
|
||||
World world = getWorld(sender, arguments);
|
||||
|
||||
sendChatMessage(sender, "Current: " + PluginArboriculture.treeInterface.getTreekeepingMode(world).getName() + " (#" + world.getWorldInfo().getSaveVersion()
|
||||
+ ")");
|
||||
|
||||
String help = "";
|
||||
for (ITreekeepingMode mode : PluginArboriculture.treeInterface.getTreekeepingModes()) {
|
||||
if (!help.isEmpty())
|
||||
help += ", ";
|
||||
help += mode.getName();
|
||||
}
|
||||
sendChatMessage(sender, "Available modes: " + help);
|
||||
}
|
||||
|
||||
private void listModeInfo(ICommandSender sender, String[] arguments) {
|
||||
if (arguments.length <= 1)
|
||||
throw new WrongUsageException("/" + this.getCommandName() + " info <mode-name>");
|
||||
|
||||
ITreekeepingMode found = null;
|
||||
for (ITreekeepingMode mode : PluginArboriculture.treeInterface.getTreekeepingModes())
|
||||
if (mode.getName().equalsIgnoreCase(arguments[1])) {
|
||||
found = mode;
|
||||
break;
|
||||
}
|
||||
|
||||
if (found == null)
|
||||
throw new CommandException("No treekeeping mode called '%s' is available.", arguments[1]);
|
||||
|
||||
sendChatMessage(sender, "\u00A7aMode: " + found.getName());
|
||||
for (String desc : found.getDescription())
|
||||
sendChatMessage(sender, StringUtil.localize(desc));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
if (sender instanceof EntityPlayer)
|
||||
return Proxies.common.isOp((EntityPlayer) sender);
|
||||
else
|
||||
return sender.canCommandSenderUseCommand(4, getCommandName());
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender sender, String[] incomplete) {
|
||||
return getListOfStringsMatchingLastWord(incomplete, modeStrings);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import forestry.core.commands.CommandMode;
|
||||
import forestry.core.commands.CommandSaveStats;
|
||||
import forestry.core.commands.ICommandModeHelper;
|
||||
import forestry.core.commands.IStatsSaveHelper;
|
||||
import forestry.core.commands.SubCommand;
|
||||
|
||||
public class CommandTree extends SubCommand {
|
||||
|
||||
public CommandTree() {
|
||||
super("tree");
|
||||
|
||||
IStatsSaveHelper saveHelper = new TreeStatsSaveHelper();
|
||||
ICommandModeHelper modeHelper = new TreeModeHelper();
|
||||
|
||||
addChildCommand(new CommandTreeSpawn("spawnTree", new TreeSpawner()));
|
||||
addChildCommand(new CommandTreeSpawn("spawnForest", new ForestSpawner()));
|
||||
addChildCommand(new CommandMode(modeHelper));
|
||||
addChildCommand(new CommandSaveStats(saveHelper, modeHelper));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.commands.CommandHelpers;
|
||||
import forestry.core.commands.SubCommand;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public final class CommandTreeSpawn extends SubCommand {
|
||||
|
||||
private final ITreeSpawner treeSpawner;
|
||||
|
||||
public CommandTreeSpawn(String name, ITreeSpawner treeSpawner) {
|
||||
super(name);
|
||||
setPermLevel(PermLevel.ADMIN);
|
||||
this.treeSpawner = treeSpawner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void processSubCommand(ICommandSender sender, String[] arguments) {
|
||||
if (arguments.length < 1 || arguments.length > 2) {
|
||||
printHelp(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player;
|
||||
String treeName;
|
||||
try {
|
||||
player = CommandHelpers.getPlayer(sender, arguments[arguments.length - 1]);
|
||||
String[] argumentsWithoutPlayer = new String[arguments.length - 1];
|
||||
System.arraycopy(arguments, 0, argumentsWithoutPlayer, 0, arguments.length - 1);
|
||||
treeName = StringUtils.join(argumentsWithoutPlayer, " ");
|
||||
} catch (PlayerNotFoundException e) {
|
||||
player = CommandHelpers.getPlayer(sender, sender.getCommandSenderName());
|
||||
treeName = StringUtils.join(arguments, " ");
|
||||
}
|
||||
|
||||
boolean success = treeSpawner.spawn(sender, treeName, player);
|
||||
if (!success)
|
||||
printHelp(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> addTabCompletionOptions(ICommandSender sender, String[] parameters) {
|
||||
if (parameters.length == 1) {
|
||||
List<String> tabCompletion = CommandHelpers.getListOfStringsMatchingLastWord(parameters, getSpecies());
|
||||
tabCompletion.add("help");
|
||||
return tabCompletion;
|
||||
} else if (parameters.length == 2) {
|
||||
return CommandHelpers.getListOfStringsMatchingLastWord(parameters, CommandHelpers.getPlayers());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String[] getSpecies() {
|
||||
List<String> species = new ArrayList<String>();
|
||||
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values())
|
||||
if (allele instanceof IAlleleTreeSpecies)
|
||||
species.add(allele.getName().replaceAll("\\s", ""));
|
||||
|
||||
return species.toArray(new String[species.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
public class ForestSpawner implements ITreeSpawner {
|
||||
|
||||
public boolean spawn(ICommandSender sender, String treeName, EntityPlayer player) {
|
||||
Vec3 look = player.getLookVec();
|
||||
|
||||
int x = (int)Math.round(player.posX + (16 * look.xCoord));
|
||||
int y = (int)Math.round(player.posY);
|
||||
int z = (int)Math.round(player.posZ + (16 * look.zCoord));
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
int spawnX = x + player.worldObj.rand.nextInt(32) - 16;
|
||||
int spawnZ = z + player.worldObj.rand.nextInt(32) - 16;
|
||||
|
||||
WorldGenerator gen = TreeGenHelper.getWorldGen(treeName, player, spawnX, y, spawnZ);
|
||||
if (gen == null) {
|
||||
return false;
|
||||
}
|
||||
TreeGenHelper.generateTree(gen, player, spawnX, y, spawnZ);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+9
-3
@@ -4,11 +4,17 @@
|
||||
* 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.circuits;
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public interface ITreeSpawner {
|
||||
|
||||
boolean spawn(ICommandSender sender, String treeName, EntityPlayer player);
|
||||
|
||||
public class CircuitBoardManager {
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.commands.SpeciesNotFoundException;
|
||||
import forestry.core.commands.TemplateNotFoundException;
|
||||
import forestry.core.worldgen.WorldGenBase;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public final class TreeGenHelper {
|
||||
|
||||
public static WorldGenerator getWorldGen(String treeName, EntityPlayer player, int x, int y, int z) {
|
||||
ITreeGenome treeGenome = getTreeGenome(treeName);
|
||||
if (treeGenome == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ITree tree = PluginArboriculture.treeInterface.getTree(player.worldObj, treeGenome);
|
||||
return tree.getTreeGenerator(player.worldObj, x, y, z, true);
|
||||
}
|
||||
|
||||
public static void generateTree(WorldGenerator gen, EntityPlayer player, int x, int y, int z) {
|
||||
if (gen instanceof WorldGenBase) {
|
||||
((WorldGenBase) gen).generate(player.worldObj, player.worldObj.rand, x, y, z, true);
|
||||
} else {
|
||||
gen.generate(player.worldObj, player.worldObj.rand, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
private static ITreeGenome getTreeGenome(String speciesName) {
|
||||
IAlleleTreeSpecies species = null;
|
||||
|
||||
for (String uid : AlleleManager.alleleRegistry.getRegisteredAlleles().keySet()) {
|
||||
|
||||
if (!uid.equals(speciesName))
|
||||
continue;
|
||||
|
||||
IAllele allele = AlleleManager.alleleRegistry.getAllele(uid);
|
||||
if (allele instanceof IAlleleTreeSpecies) {
|
||||
species = (IAlleleTreeSpecies) allele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (species == null) {
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleTreeSpecies && allele.getName().replaceAll("\\s", "").equals(speciesName)) {
|
||||
species = (IAlleleTreeSpecies) allele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (species == null)
|
||||
throw new SpeciesNotFoundException(speciesName);
|
||||
|
||||
IAllele[] template = PluginArboriculture.treeInterface.getTemplate(species.getUID());
|
||||
|
||||
if (template == null)
|
||||
throw new TemplateNotFoundException(species);
|
||||
|
||||
return PluginArboriculture.treeInterface.templateAsGenome(template);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITreekeepingMode;
|
||||
import forestry.core.commands.ICommandModeHelper;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class TreeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String[] getModeNames() {
|
||||
ArrayList<ITreekeepingMode> treekeepingModes = PluginArboriculture.treeInterface.getTreekeepingModes();
|
||||
int modeStringCount = treekeepingModes.size();
|
||||
List<String> modeStrings = new ArrayList<String>(modeStringCount);
|
||||
for (ITreekeepingMode mode : treekeepingModes)
|
||||
modeStrings.add(mode.getName());
|
||||
|
||||
return modeStrings.toArray(new String[modeStringCount]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeNameMatching(String desired) {
|
||||
ITreekeepingMode mode = PluginArboriculture.treeInterface.getTreekeepingMode(desired);
|
||||
if (mode == null)
|
||||
return null;
|
||||
return mode.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeName(World world) {
|
||||
return PluginArboriculture.treeInterface.getTreekeepingMode(world).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMode(World world, String modeName) {
|
||||
PluginArboriculture.treeInterface.setTreekeepingMode(world, modeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getDescription(String modeName) {
|
||||
ITreekeepingMode mode = PluginArboriculture.treeInterface.getTreekeepingMode(modeName);
|
||||
return mode.getDescription();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
public class TreeSpawner implements ITreeSpawner {
|
||||
|
||||
@Override
|
||||
public boolean spawn(ICommandSender sender, String treeName, EntityPlayer player) {
|
||||
Vec3 look = player.getLookVec();
|
||||
|
||||
int x = (int)Math.round(player.posX + (3 * look.xCoord));
|
||||
int y = (int)Math.round(player.posY);
|
||||
int z = (int)Math.round(player.posZ + (3 * look.zCoord));
|
||||
|
||||
WorldGenerator gen = TreeGenHelper.getWorldGen(treeName, player, x, y, z);
|
||||
if (gen == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TreeGenHelper.generateTree(gen, player, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.core.commands.IStatsSaveHelper;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public class TreeStatsSaveHelper implements IStatsSaveHelper {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedSaveStatsString() {
|
||||
return "for.chat.command.forestry.tree.save.stats";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraInfo(Collection<String> statistics, IBreedingTracker breedingTracker) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IAlleleSpecies> getSpecies() {
|
||||
Collection<IAlleleSpecies> species = new ArrayList<IAlleleSpecies>();
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values())
|
||||
if (allele instanceof IAlleleTreeSpecies)
|
||||
species.add((IAlleleTreeSpecies) allele);
|
||||
return species;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileSuffix() {
|
||||
return "trees";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBreedingTracker getBreedingTracker(World world, GameProfile gameProfile) {
|
||||
return PluginArboriculture.treeInterface.getBreedingTracker(world, gameProfile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,9 +17,10 @@ import forestry.api.arboriculture.IAlleleFruit;
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.ILeafTickHandler;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IFruitBearer;
|
||||
@@ -442,7 +443,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
@Override public void setErrorState(int state) {}
|
||||
|
||||
@Override
|
||||
public void setErrorState(EnumErrorCode state) {
|
||||
public void setErrorState(IErrorState state) {
|
||||
}
|
||||
|
||||
@Override public int getErrorOrdinal() { return 0; }
|
||||
|
||||
@@ -19,7 +19,7 @@ import forestry.core.inventory.AlyzerInventory;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean subGenerate(int x, int y, int z) {
|
||||
public boolean subGenerate(int x, int y, int z, boolean forced) {
|
||||
this.startX = x;
|
||||
this.startY = y;
|
||||
this.startZ = z;
|
||||
@@ -53,9 +53,9 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
|
||||
this.wood = getWood();
|
||||
|
||||
preGenerate();
|
||||
if (!canGrow())
|
||||
if (!forced && !canGrow()) {
|
||||
return false;
|
||||
else {
|
||||
} else {
|
||||
generate();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.ErrorStateRegistry;
|
||||
import forestry.api.core.IErrorState;
|
||||
|
||||
public enum EnumErrorCode implements IErrorState {
|
||||
|
||||
UNKNOWN("unknown"),
|
||||
OK("ok"),
|
||||
INVALIDBIOME("invalidBiome"),
|
||||
ISRAINING("isRaining"),
|
||||
NOTRAINING("notRaining"),
|
||||
NOFUEL("noFuel"), // Biogas & Peat-fired
|
||||
NOHEAT("noHeat"), // Biogas engine
|
||||
NODISPOSAL("noDisposal"),
|
||||
NORESOURCE("noResource"),
|
||||
NOTGLOOMY("notGloomy"),
|
||||
NOTLUCID("notLucid"),
|
||||
NOTDAY("notDay"),
|
||||
NOTNIGHT("notNight"),
|
||||
NOFLOWER("noFlower"),
|
||||
NOQUEEN("noQueen"),
|
||||
NODRONE("noDrone"),
|
||||
NOSKY("noSky"),
|
||||
NOSPACE("noSpace"),
|
||||
NORECIPE("noRecipe"),
|
||||
NOENERGYNET("noEnergyNet"),
|
||||
NOTHINGANALYZE("noSpecimen"),
|
||||
FORCEDCOOLDOWN("forcedCooldown"),
|
||||
NOHONEY("noHoney"),
|
||||
NOTPOSTPAID("notPostpaid", "noStamps"),
|
||||
NORECIPIENT("noRecipient"),
|
||||
NOTALPHANUMERIC("notAlphaNumeric"),
|
||||
NOTUNIQUE("notUnique"),
|
||||
NOSTAMPS("noStamps"),
|
||||
NOCIRCUITBOARD("noCircuitBoard"),
|
||||
NOCIRCUITLAYOUT("noCircuitLayout"),
|
||||
WRONGSTACKSIZE("wrongStacksize"),
|
||||
NOFERTILIZER("noFertilizer"),
|
||||
NOFARMLAND("noFarmland"),
|
||||
CIRCUITMISMATCH("circuitMismatch"),
|
||||
NOLIQUID("noLiquid"),
|
||||
NOPAPER("noPaper"),
|
||||
NOSTAMPSNOPAPER("noStampsNoPaper", "noStamps"),
|
||||
NOSUPPLIES("noSupplies", "noResource"),
|
||||
NOTRADE("noTrade", "noResource"),
|
||||
NOPOWER("noPower");
|
||||
|
||||
private String name;
|
||||
private String iconName;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon icon;
|
||||
|
||||
private EnumErrorCode(String name) {
|
||||
this(name, name);
|
||||
}
|
||||
|
||||
private EnumErrorCode(String name, String iconName) {
|
||||
this.name = name;
|
||||
this.iconName = iconName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "errors." + name + ".desc";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "errors." + name + ".help";
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icon = register.registerIcon("forestry:errors/" + iconName);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getID() {
|
||||
return (short) ordinal();
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
for (IErrorState code : values()) {
|
||||
ErrorStateRegistry.registerErrorState(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,23 +10,26 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.IPickupHandler;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.plugins.PluginManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.ErrorStateRegistry;
|
||||
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.IPickupHandler;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class EventHandlerCore {
|
||||
|
||||
public EventHandlerCore() {
|
||||
@@ -84,10 +87,10 @@ public class EventHandlerCore {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleTextureRemap(TextureStitchEvent.Pre event) {
|
||||
if(event.map.getTextureType() == 1) {
|
||||
EnumErrorCode.initIcons(event.map);
|
||||
ErrorStateRegistry.initIcons(event.map);
|
||||
TextureManager.getInstance().initDefaultIcons(event.map);
|
||||
} else if(event.map.getTextureType() == 0)
|
||||
LiquidHelper.resetLiquidIcons(event.map);
|
||||
Fluids.resetFluidIcons(event.map);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -20,7 +20,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
@@ -39,6 +38,7 @@ import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.Version;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.TileEngine;
|
||||
import forestry.core.gadgets.TileMachine;
|
||||
import forestry.core.gadgets.TileMill;
|
||||
@@ -58,6 +58,8 @@ public class ForestryCore {
|
||||
Config.load();
|
||||
if (!Config.disableVersionCheck)
|
||||
Version.versionCheck();
|
||||
|
||||
EnumErrorCode.init();
|
||||
|
||||
PluginManager.runPreInit();
|
||||
}
|
||||
@@ -90,17 +92,18 @@ public class ForestryCore {
|
||||
Defaults.ENGINE_COPPER_FUEL_VALUE_PEAT, Defaults.ENGINE_COPPER_CYCLE_DURATION_PEAT));
|
||||
FuelManager.copperEngineFuel.put(ForestryItem.bituminousPeat.getItemStack(), new EngineCopperFuel(ForestryItem.bituminousPeat.getItemStack(),
|
||||
Defaults.ENGINE_COPPER_FUEL_VALUE_BITUMINOUS_PEAT, Defaults.ENGINE_COPPER_CYCLE_DURATION_BITUMINOUS_PEAT));
|
||||
FuelManager.bronzeEngineFuel.put(FluidRegistry.getFluid(Defaults.LIQUID_BIOMASS), new EngineBronzeFuel(FluidRegistry.getFluid(Defaults.LIQUID_BIOMASS),
|
||||
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.BIOMASS.get(), new EngineBronzeFuel(Fluids.BIOMASS.get(),
|
||||
Defaults.ENGINE_FUEL_VALUE_BIOMASS, (int) (Defaults.ENGINE_CYCLE_DURATION_BIOMASS * GameMode.getGameMode().getFloatSetting("fuel.biomass.biogas")), 1));
|
||||
FuelManager.bronzeEngineFuel.put(FluidRegistry.getFluid(Defaults.LIQUID_WATER), new EngineBronzeFuel(FluidRegistry.getFluid(Defaults.LIQUID_WATER),
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.WATER.get(), new EngineBronzeFuel(Fluids.WATER.get(),
|
||||
Defaults.ENGINE_FUEL_VALUE_WATER, Defaults.ENGINE_CYCLE_DURATION_WATER, 3));
|
||||
FuelManager.bronzeEngineFuel.put(FluidRegistry.getFluid(Defaults.LIQUID_MILK), new EngineBronzeFuel(FluidRegistry.getFluid(Defaults.LIQUID_MILK),
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.MILK.get(), new EngineBronzeFuel(Fluids.MILK.get(),
|
||||
Defaults.ENGINE_FUEL_VALUE_MILK, Defaults.ENGINE_CYCLE_DURATION_MILK, 3));
|
||||
FuelManager.bronzeEngineFuel.put(FluidRegistry.getFluid(Defaults.LIQUID_SEEDOIL), new EngineBronzeFuel(FluidRegistry.getFluid(Defaults.LIQUID_SEEDOIL),
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.SEEDOIL.get(), new EngineBronzeFuel(Fluids.SEEDOIL.get(),
|
||||
Defaults.ENGINE_FUEL_VALUE_SEED_OIL, Defaults.ENGINE_CYCLE_DURATION_SEED_OIL, 1));
|
||||
FuelManager.bronzeEngineFuel.put(FluidRegistry.getFluid(Defaults.LIQUID_HONEY), new EngineBronzeFuel(FluidRegistry.getFluid(Defaults.LIQUID_HONEY),
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.HONEY.get(), new EngineBronzeFuel(Fluids.HONEY.get(),
|
||||
Defaults.ENGINE_FUEL_VALUE_HONEY, Defaults.ENGINE_CYCLE_DURATION_HONEY, 1));
|
||||
FuelManager.bronzeEngineFuel.put(FluidRegistry.getFluid(Defaults.LIQUID_JUICE), new EngineBronzeFuel(FluidRegistry.getFluid(Defaults.LIQUID_JUICE),
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.JUICE.get(), new EngineBronzeFuel(Fluids.JUICE.get(),
|
||||
Defaults.ENGINE_FUEL_VALUE_JUICE, Defaults.ENGINE_CYCLE_DURATION_JUICE, 1));
|
||||
|
||||
// Set rain substrates
|
||||
@@ -149,60 +152,58 @@ public class ForestryCore {
|
||||
private void registerLiquidContainers() {
|
||||
// Add lava and water buckets to the API in case this has not been done yet.
|
||||
if (LiquidHelper.isEmptyLiquidData()) {
|
||||
LiquidHelper.injectLiquidContainer(Defaults.LIQUID_LAVA, Defaults.BUCKET_VOLUME, new ItemStack(Items.lava_bucket), new ItemStack(Items.bucket));
|
||||
LiquidHelper.injectLiquidContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, new ItemStack(Items.water_bucket), new ItemStack(Items.bucket));
|
||||
LiquidHelper.injectLiquidContainer(Fluids.LAVA, Defaults.BUCKET_VOLUME, new ItemStack(Items.lava_bucket), new ItemStack(Items.bucket));
|
||||
LiquidHelper.injectLiquidContainer(Fluids.WATER, Defaults.BUCKET_VOLUME, new ItemStack(Items.water_bucket), new ItemStack(Items.bucket));
|
||||
}
|
||||
|
||||
// Glass
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_GLASS);
|
||||
Fluids.GLASS.register();
|
||||
|
||||
// Set default lava, water and biofuel buckets
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_MILK);
|
||||
LiquidHelper.injectLiquidContainer(Defaults.LIQUID_MILK, Defaults.BUCKET_VOLUME, new ItemStack(Items.milk_bucket), new ItemStack(Items.bucket));
|
||||
Fluids.MILK.register();
|
||||
LiquidHelper.injectLiquidContainer(Fluids.MILK, Defaults.BUCKET_VOLUME, new ItemStack(Items.milk_bucket), new ItemStack(Items.bucket));
|
||||
|
||||
// Lava
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_LAVA, Defaults.BUCKET_VOLUME, ForestryItem.canLava.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_LAVA, Defaults.BUCKET_VOLUME, ForestryItem.refractoryLava.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
LiquidHelper.injectTinContainer(Fluids.LAVA, Defaults.BUCKET_VOLUME, ForestryItem.canLava.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.LAVA, Defaults.BUCKET_VOLUME, ForestryItem.refractoryLava.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
|
||||
// Water
|
||||
LiquidHelper.injectLiquidContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, new ItemStack(Items.potionitem, 1, 0),
|
||||
new ItemStack(Items.glass_bottle));
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, ForestryItem.canWater.getItemStack(),
|
||||
ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleWater.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, ForestryItem.refractoryWater.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
LiquidHelper.injectLiquidContainer(Fluids.WATER, Defaults.BUCKET_VOLUME, new ItemStack(Items.potionitem, 1, 0), new ItemStack(Items.glass_bottle));
|
||||
LiquidHelper.injectTinContainer(Fluids.WATER, Defaults.BUCKET_VOLUME, ForestryItem.canWater.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.WATER, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleWater.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.WATER, Defaults.BUCKET_VOLUME, ForestryItem.refractoryWater.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_BIOMASS);
|
||||
LiquidHelper.injectLiquidContainer(Defaults.LIQUID_BIOMASS, Defaults.BUCKET_VOLUME, ForestryItem.bucketBiomass.getItemStack(), new ItemStack(Items.bucket));
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_BIOMASS, Defaults.BUCKET_VOLUME, ForestryItem.canBiomass.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_BIOMASS, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleBiomass.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_BIOMASS, Defaults.BUCKET_VOLUME, ForestryItem.refractoryBiomass.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
Fluids.BIOMASS.register();
|
||||
LiquidHelper.injectLiquidContainer(Fluids.BIOMASS, Defaults.BUCKET_VOLUME, ForestryItem.bucketBiomass.getItemStack(), new ItemStack(Items.bucket));
|
||||
LiquidHelper.injectTinContainer(Fluids.BIOMASS, Defaults.BUCKET_VOLUME, ForestryItem.canBiomass.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.BIOMASS, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleBiomass.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.BIOMASS, Defaults.BUCKET_VOLUME, ForestryItem.refractoryBiomass.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_ETHANOL);
|
||||
LiquidHelper.injectLiquidContainer(Defaults.LIQUID_ETHANOL, Defaults.BUCKET_VOLUME, ForestryItem.bucketBiofuel.getItemStack(), new ItemStack(Items.bucket));
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_ETHANOL, Defaults.BUCKET_VOLUME, ForestryItem.canBiofuel.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_ETHANOL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleBiofuel.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_ETHANOL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryBiofuel.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
Fluids.BIOETHANOL.register();
|
||||
LiquidHelper.injectLiquidContainer(Fluids.BIOETHANOL, Defaults.BUCKET_VOLUME, ForestryItem.bucketBiofuel.getItemStack(), new ItemStack(Items.bucket));
|
||||
LiquidHelper.injectTinContainer(Fluids.BIOETHANOL, Defaults.BUCKET_VOLUME, ForestryItem.canBiofuel.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.BIOETHANOL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleBiofuel.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.BIOETHANOL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryBiofuel.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_SEEDOIL);
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_SEEDOIL, Defaults.BUCKET_VOLUME, ForestryItem.canSeedOil.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_SEEDOIL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleSeedOil.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_SEEDOIL, Defaults.BUCKET_VOLUME, ForestryItem.refractorySeedOil.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
Fluids.SEEDOIL.register();
|
||||
LiquidHelper.injectTinContainer(Fluids.SEEDOIL, Defaults.BUCKET_VOLUME, ForestryItem.canSeedOil.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.SEEDOIL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleSeedOil.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.SEEDOIL, Defaults.BUCKET_VOLUME, ForestryItem.refractorySeedOil.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_HONEY);
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_HONEY, Defaults.BUCKET_VOLUME, ForestryItem.canHoney.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_HONEY, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleHoney.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_HONEY, Defaults.BUCKET_VOLUME, ForestryItem.refractoryHoney.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
Fluids.HONEY.register();
|
||||
LiquidHelper.injectTinContainer(Fluids.HONEY, Defaults.BUCKET_VOLUME, ForestryItem.canHoney.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.HONEY, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleHoney.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.HONEY, Defaults.BUCKET_VOLUME, ForestryItem.refractoryHoney.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_JUICE);
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_JUICE, Defaults.BUCKET_VOLUME, ForestryItem.canJuice.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_JUICE, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleJuice.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_JUICE, Defaults.BUCKET_VOLUME, ForestryItem.refractoryJuice.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
Fluids.JUICE.register();
|
||||
LiquidHelper.injectTinContainer(Fluids.JUICE, Defaults.BUCKET_VOLUME, ForestryItem.canJuice.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.JUICE, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleJuice.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.JUICE, Defaults.BUCKET_VOLUME, ForestryItem.refractoryJuice.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_ICE);
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_ICE, Defaults.BUCKET_VOLUME, ForestryItem.canIce.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_ICE, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleIce.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_ICE, Defaults.BUCKET_VOLUME, ForestryItem.refractoryIce.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
Fluids.ICE.register();
|
||||
LiquidHelper.injectTinContainer(Fluids.ICE, Defaults.BUCKET_VOLUME, ForestryItem.canIce.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.ICE, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleIce.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.ICE, Defaults.BUCKET_VOLUME, ForestryItem.refractoryIce.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,11 +28,11 @@ public class CircuitLayout implements ICircuitLayout {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringUtil.localize("layout." + this.uid);
|
||||
return StringUtil.localize("circuit.layout." + this.uid + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return StringUtil.localize("usage." + this.uid);
|
||||
return StringUtil.localize("circuit.layout." + this.uid + ".usage");
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,19 @@ import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ICircuitLibrary;
|
||||
import forestry.api.circuits.ICircuitRegistry;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import java.util.Map;
|
||||
|
||||
public class CircuitRegistry implements ICircuitRegistry {
|
||||
|
||||
private final LinkedHashMap<String, ICircuitLayout> layoutMap = new LinkedHashMap<String, ICircuitLayout>();
|
||||
private final LinkedHashMap<String, ICircuit> circuitMap = new LinkedHashMap<String, ICircuit>();
|
||||
private final HashMap<Integer, String> legacyMap = new HashMap<Integer, String>();
|
||||
public static final ICircuitLayout DUMMY_LAYOUT = new CircuitLayout("dummy");
|
||||
public static final Map<String, ICircuitLayout> DUMMY_MAP = new LinkedHashMap<String, ICircuitLayout>();
|
||||
private final Map<String, ICircuitLayout> layoutMap = new LinkedHashMap<String, ICircuitLayout>();
|
||||
private final Map<String, ICircuit> circuitMap = new LinkedHashMap<String, ICircuit>();
|
||||
private final Map<Integer, String> legacyMap = new HashMap<Integer, String>();
|
||||
|
||||
static {
|
||||
DUMMY_MAP.put("dummy", DUMMY_LAYOUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitLibrary getCircuitLibrary(World world, String playername) {
|
||||
@@ -47,12 +54,16 @@ public class CircuitRegistry implements ICircuitRegistry {
|
||||
public ICircuitLayout getDefaultLayout() {
|
||||
if (layoutMap.containsKey("forestry.engine.tin"))
|
||||
return layoutMap.get("forestry.engine.tin");
|
||||
else
|
||||
else if (!layoutMap.isEmpty())
|
||||
return layoutMap.values().iterator().next();
|
||||
else
|
||||
return DUMMY_LAYOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashMap<String, ICircuitLayout> getRegisteredLayouts() {
|
||||
public Map<String, ICircuitLayout> getRegisteredLayouts() {
|
||||
if (layoutMap.isEmpty())
|
||||
return DUMMY_MAP;
|
||||
return layoutMap;
|
||||
}
|
||||
|
||||
@@ -71,7 +82,7 @@ public class CircuitRegistry implements ICircuitRegistry {
|
||||
|
||||
/* CIRCUITS */
|
||||
@Override
|
||||
public HashMap<String, ICircuit> getRegisteredCircuits() {
|
||||
public Map<String, ICircuit> getRegisteredCircuits() {
|
||||
return circuitMap;
|
||||
}
|
||||
|
||||
@@ -100,14 +111,12 @@ public class CircuitRegistry implements ICircuitRegistry {
|
||||
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isChipset(ItemStack itemstack) {
|
||||
return ForestryItem.circuitboards.isItemEqual(itemstack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ICircuitBoard getCircuitboard(ItemStack itemstack) {
|
||||
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
|
||||
|
||||
@@ -12,8 +12,6 @@ package forestry.core.circuits;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,16 +23,19 @@ import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ISolderManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.core.utils.RevolvingList;
|
||||
|
||||
public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
|
||||
public static class CircuitRecipe {
|
||||
|
||||
private final ICircuitLayout layout;
|
||||
private final ItemStack resource;
|
||||
public final ICircuit circuit;
|
||||
@@ -54,6 +55,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
}
|
||||
|
||||
public static class SolderManager implements ISolderManager {
|
||||
|
||||
public static final ArrayList<CircuitRecipe> recipes = new ArrayList<CircuitRecipe>();
|
||||
|
||||
@Override
|
||||
@@ -71,9 +73,10 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
if (layout == null || resource == null)
|
||||
return null;
|
||||
|
||||
for (CircuitRecipe recipe : recipes)
|
||||
for (CircuitRecipe recipe : recipes) {
|
||||
if (recipe.matches(layout, resource))
|
||||
return recipe;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -82,7 +85,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
// / INVENTORY MANAGMENT
|
||||
public static class SolderingInventory extends ItemInventory implements IErrorSource {
|
||||
|
||||
private ICircuitLayout layout;
|
||||
private final RevolvingList<ICircuitLayout> layouts = new RevolvingList<ICircuitLayout>(ChipsetManager.circuitRegistry.getRegisteredLayouts().values());
|
||||
private EnumErrorCode errorState;
|
||||
|
||||
private final short blankSlot = 0;
|
||||
@@ -91,57 +94,32 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
|
||||
public SolderingInventory() {
|
||||
super(ItemSolderingIron.class, 6);
|
||||
layout = ChipsetManager.circuitRegistry.getDefaultLayout();
|
||||
init();
|
||||
}
|
||||
|
||||
public SolderingInventory(ItemStack itemstack) {
|
||||
super(ItemSolderingIron.class, 6, itemstack);
|
||||
layout = ChipsetManager.circuitRegistry.getDefaultLayout();
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
layouts.setCurrent(ChipsetManager.circuitRegistry.getDefaultLayout());
|
||||
}
|
||||
|
||||
public ICircuitLayout getLayout() {
|
||||
return this.layout;
|
||||
return layouts.getCurrent();
|
||||
}
|
||||
|
||||
public void setLayout(String uid) {
|
||||
this.layout = ChipsetManager.circuitRegistry.getLayout(uid);
|
||||
layouts.setCurrent(ChipsetManager.circuitRegistry.getLayout(uid));
|
||||
}
|
||||
|
||||
public void advanceLayout() {
|
||||
Iterator<Entry<String, ICircuitLayout>> it = ChipsetManager.circuitRegistry.getRegisteredLayouts().entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<String, ICircuitLayout> entry = it.next();
|
||||
if (entry.getKey().equals(layout.getUID())) {
|
||||
|
||||
if (it.hasNext())
|
||||
layout = it.next().getValue();
|
||||
else
|
||||
layout = ChipsetManager.circuitRegistry.getRegisteredLayouts().entrySet().iterator().next().getValue();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
layouts.rotateRight();
|
||||
}
|
||||
|
||||
public void regressLayout() {
|
||||
Iterator<Entry<String, ICircuitLayout>> it = ChipsetManager.circuitRegistry.getRegisteredLayouts().entrySet().iterator();
|
||||
|
||||
ICircuitLayout previous = null;
|
||||
while (it.hasNext()) {
|
||||
Entry<String, ICircuitLayout> entry = it.next();
|
||||
if (entry.getKey().equals(layout.getUID())) {
|
||||
|
||||
if (previous != null)
|
||||
layout = previous;
|
||||
else
|
||||
while (it.hasNext())
|
||||
layout = it.next().getValue();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
previous = entry.getValue();
|
||||
}
|
||||
layouts.rotateLeft();
|
||||
}
|
||||
|
||||
private Collection<ICircuit> getCircuits(EnumCircuitBoardType type, boolean doConsume) {
|
||||
@@ -153,7 +131,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
if (ingredient == null)
|
||||
continue;
|
||||
|
||||
CircuitRecipe recipe = SolderManager.getMatchingRecipe(layout, ingredient);
|
||||
CircuitRecipe recipe = SolderManager.getMatchingRecipe(layouts.getCurrent(), ingredient);
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
@@ -170,16 +148,18 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
}
|
||||
|
||||
public void trySolder() {
|
||||
|
||||
// Requires blank slot
|
||||
if (inventoryStacks[blankSlot] == null)
|
||||
if (layouts.getCurrent() == CircuitRegistry.DUMMY_LAYOUT)
|
||||
return;
|
||||
if (inventoryStacks[blankSlot].stackSize > 1)
|
||||
|
||||
ItemStack blank = inventoryStacks[blankSlot];
|
||||
// Requires blank slot
|
||||
if (blank == null)
|
||||
return;
|
||||
if (blank.stackSize > 1)
|
||||
return;
|
||||
if (inventoryStacks[finishedSlot] != null)
|
||||
return;
|
||||
|
||||
ItemStack blank = inventoryStacks[blankSlot];
|
||||
// Need a chipset item
|
||||
if (!ChipsetManager.circuitRegistry.isChipset(blank))
|
||||
return;
|
||||
@@ -199,15 +179,16 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
}
|
||||
|
||||
circuits = getCircuits(type, true);
|
||||
inventoryStacks[finishedSlot] = ItemCircuitBoard.createCircuitboard(type, layout, circuits.toArray(new ICircuit[circuits.size()]));
|
||||
inventoryStacks[finishedSlot] = ItemCircuitBoard.createCircuitboard(type, layouts.getCurrent(), circuits.toArray(new ICircuit[circuits.size()]));
|
||||
inventoryStacks[blankSlot] = null;
|
||||
}
|
||||
|
||||
public int getCount(ICircuit circuit, ArrayList<ICircuit> circuits) {
|
||||
int count = 0;
|
||||
for (ICircuit other : circuits)
|
||||
for (ICircuit other : circuits) {
|
||||
if (other.getUID().equals(circuit.getUID()))
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -231,7 +212,9 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
public IErrorState getErrorState() {
|
||||
if (layouts.getCurrent() == CircuitRegistry.DUMMY_LAYOUT)
|
||||
return EnumErrorCode.NOCIRCUITLAYOUT;
|
||||
if (inventoryStacks[blankSlot] == null)
|
||||
return EnumErrorCode.NOCIRCUITBOARD;
|
||||
if (inventoryStacks[blankSlot].stackSize > 1)
|
||||
|
||||
+6
-8
@@ -4,19 +4,17 @@
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
package forestry.core.commands;
|
||||
|
||||
import forestry.core.commands.SubCommand;
|
||||
public class CommandMode extends SubCommand {
|
||||
|
||||
public class CommandBeekeepingMode extends SubCommand {
|
||||
|
||||
public CommandBeekeepingMode() {
|
||||
public CommandMode(ICommandModeHelper modeHelper) {
|
||||
super("mode");
|
||||
addChildCommand(new CommandBeekeepingModeInfo());
|
||||
addChildCommand(new CommandBeekeepingModeSet());
|
||||
addChildCommand(new CommandModeInfo(modeHelper));
|
||||
addChildCommand(new CommandModeSet(modeHelper));
|
||||
}
|
||||
}
|
||||
+18
-44
@@ -8,45 +8,28 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
package forestry.core.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.core.commands.CommandHelpers;
|
||||
import forestry.core.commands.SubCommand;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandBeekeepingModeInfo extends SubCommand {
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class CommandModeInfo extends SubCommand {
|
||||
private final String[] modeStringArr;
|
||||
private final String helpString;
|
||||
private final ICommandModeHelper modeHelper;
|
||||
|
||||
public CommandBeekeepingModeInfo() {
|
||||
public CommandModeInfo(ICommandModeHelper modeHelper) {
|
||||
super("info");
|
||||
|
||||
List<String> modeStrings = new ArrayList<String>();
|
||||
for (IBeekeepingMode mode : PluginApiculture.beeInterface.getBeekeepingModes())
|
||||
modeStrings.add(mode.getName());
|
||||
|
||||
modeStringArr = modeStrings.toArray(new String[modeStrings.size()]);
|
||||
|
||||
StringBuilder help = new StringBuilder();
|
||||
String separator = ", ";
|
||||
|
||||
Iterator<String> iter = modeStrings.iterator();
|
||||
while (iter.hasNext()) {
|
||||
help.append(iter.next());
|
||||
if (iter.hasNext())
|
||||
help.append(separator);
|
||||
}
|
||||
helpString = help.toString();
|
||||
this.modeHelper = modeHelper;
|
||||
modeStringArr = modeHelper.getModeNames();
|
||||
helpString = StringUtils.join(modeStringArr, ", ");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,42 +39,33 @@ public class CommandBeekeepingModeInfo extends SubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
String modeName = args[0];
|
||||
String modeName = modeHelper.getModeNameMatching(args[0]);
|
||||
|
||||
IBeekeepingMode found = findModeWithName(modeName);
|
||||
if (found == null) {
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.mode.info.error", modeName);
|
||||
if (modeName == null) {
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.info.error", args[0]);
|
||||
printHelp(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
ChatStyle green = new ChatStyle();
|
||||
green.setColor(EnumChatFormatting.GREEN);
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, green, found.getName());
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, green, modeName);
|
||||
|
||||
for (String desc : found.getDescription())
|
||||
for (String desc : modeHelper.getDescription(modeName))
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for." + desc);
|
||||
}
|
||||
|
||||
private IBeekeepingMode findModeWithName(String name) {
|
||||
for (IBeekeepingMode mode : PluginApiculture.beeInterface.getBeekeepingModes()) {
|
||||
if (mode.getName().equalsIgnoreCase(name))
|
||||
return mode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHelp(ICommandSender sender) {
|
||||
super.printHelp(sender);
|
||||
|
||||
World world = CommandHelpers.getWorld(sender, this);
|
||||
|
||||
String modeName = PluginApiculture.beeInterface.getBeekeepingMode(world).getName();
|
||||
String modeName = modeHelper.getModeName(world);
|
||||
String worldName = String.valueOf(world.getWorldInfo().getSaveVersion());
|
||||
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.mode.info.current", modeName, worldName);
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.mode.info.available", helpString);
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.info.current", modeName, worldName);
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.info.available", helpString);
|
||||
}
|
||||
|
||||
@Override
|
||||
+14
-20
@@ -8,30 +8,24 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
package forestry.core.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.core.commands.CommandHelpers;
|
||||
import forestry.core.commands.SubCommand;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandBeekeepingModeSet extends SubCommand {
|
||||
public final class CommandModeSet extends SubCommand {
|
||||
private final String[] modeStringArr;
|
||||
private final ICommandModeHelper modeSetter;
|
||||
|
||||
public CommandBeekeepingModeSet() {
|
||||
public CommandModeSet(ICommandModeHelper modeSetter) {
|
||||
super("set");
|
||||
setPermLevel(PermLevel.ADMIN);
|
||||
int modeStringCount = PluginApiculture.beeInterface.getBeekeepingModes().size();
|
||||
List<String> modeStrings = new ArrayList<String>(modeStringCount);
|
||||
for (IBeekeepingMode mode : PluginApiculture.beeInterface.getBeekeepingModes())
|
||||
modeStrings.add(mode.getName());
|
||||
|
||||
modeStringArr = modeStrings.toArray(new String[modeStringCount]);
|
||||
this.modeSetter = modeSetter;
|
||||
modeStringArr = modeSetter.getModeNames();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,15 +43,15 @@ public class CommandBeekeepingModeSet extends SubCommand {
|
||||
|
||||
String desired = args[args.length - 1];
|
||||
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(desired);
|
||||
if (mode == null) {
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.mode.set.error", desired);
|
||||
String modeName = modeSetter.getModeNameMatching(desired);
|
||||
if (modeName == null) {
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.set.error", desired);
|
||||
printHelp(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
PluginApiculture.beeInterface.setBeekeepingMode(world, mode.getName());
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.mode.set.success", mode.getName());
|
||||
modeSetter.setMode(world, modeName);
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.set.success", modeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
+55
-69
@@ -8,23 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.commands.CommandHelpers;
|
||||
import forestry.core.commands.SubCommand;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.Version;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
package forestry.core.commands;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
@@ -38,17 +22,37 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class CommandBeekeepingSave extends SubCommand {
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
private final String discoveredSymbol;
|
||||
private final String blacklistedSymbol;
|
||||
private final String notCountedSymbol;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.Version;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public CommandBeekeepingSave() {
|
||||
public final class CommandSaveStats extends SubCommand {
|
||||
|
||||
private static final String discoveredSymbol;
|
||||
private static final String blacklistedSymbol;
|
||||
private static final String notCountedSymbol;
|
||||
static {
|
||||
discoveredSymbol = StatCollector.translateToLocal("for.chat.command.forestry.stats.save.key.discovered.symbol");
|
||||
blacklistedSymbol = StatCollector.translateToLocal("for.chat.command.forestry.stats.save.key.blacklisted.symbol");
|
||||
notCountedSymbol = StatCollector.translateToLocal("for.chat.command.forestry.stats.save.key.notCounted.symbol");
|
||||
}
|
||||
|
||||
private final IStatsSaveHelper saveHelper;
|
||||
private final ICommandModeHelper modeHelper;
|
||||
|
||||
public CommandSaveStats(IStatsSaveHelper saveHelper, ICommandModeHelper modeHelper) {
|
||||
super("save");
|
||||
discoveredSymbol = StatCollector.translateToLocal("for.chat.command.forestry.beekeeping.save.key.discovered.symbol");
|
||||
blacklistedSymbol = StatCollector.translateToLocal("for.chat.command.forestry.beekeeping.save.key.blacklisted.symbol");
|
||||
notCountedSymbol = StatCollector.translateToLocal("for.chat.command.forestry.beekeeping.save.key.notCounted.symbol");
|
||||
this.saveHelper = saveHelper;
|
||||
this.modeHelper = modeHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,7 +62,7 @@ public class CommandBeekeepingSave extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void processSubCommand(ICommandSender sender, String[] args) {
|
||||
if (args.length != 1) {
|
||||
if (args.length > 1) {
|
||||
printHelp(sender);
|
||||
return;
|
||||
}
|
||||
@@ -66,76 +70,66 @@ public class CommandBeekeepingSave extends SubCommand {
|
||||
String newLine = System.getProperty("line.separator");
|
||||
World world = CommandHelpers.getWorld(sender, this);
|
||||
|
||||
String player = args[0];
|
||||
EntityPlayerMP player;
|
||||
if (args.length > 0)
|
||||
player = CommandHelpers.getPlayer(sender, args[0]);
|
||||
else
|
||||
player = CommandHelpers.getPlayer(sender, sender.getCommandSenderName());
|
||||
|
||||
Collection<String> statistics = new ArrayList<String>();
|
||||
|
||||
String date = DateFormat.getInstance().format(new Date());
|
||||
statistics.add(StatCollector.translateToLocalFormatted("for.chat.command.forestry.beekeeping.save.stats", player, date));
|
||||
statistics.add(StatCollector.translateToLocalFormatted(saveHelper.getUnlocalizedSaveStatsString(), player.getDisplayName(), date));
|
||||
statistics.add("");
|
||||
String modeName = PluginApiculture.beeInterface.getBeekeepingMode(world).getName();
|
||||
statistics.add(StatCollector.translateToLocalFormatted("for.chat.command.forestry.beekeeping.save.mode", modeName));
|
||||
statistics.add(StatCollector.translateToLocalFormatted("for.chat.command.forestry.stats.save.mode", modeHelper.getModeName(world)));
|
||||
statistics.add("");
|
||||
|
||||
GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152655_a(player);
|
||||
IApiaristTracker tracker = PluginApiculture.beeInterface.getBreedingTracker(world, profile);
|
||||
IBreedingTracker tracker = saveHelper.getBreedingTracker(world, player.getGameProfile());
|
||||
if (tracker == null)
|
||||
statistics.add(StatCollector.translateToLocal("for.chat.command.forestry.beekeeping.save.error4"));
|
||||
statistics.add(StatCollector.translateToLocal("for.chat.command.forestry.stats.save.error4"));
|
||||
else {
|
||||
String discoveredLine = StatCollector.translateToLocal("for.chat.command.forestry.beekeeping.save.key.discovered") + ":";
|
||||
statistics.add(discoveredLine);
|
||||
statistics.add(line(discoveredLine.length()));
|
||||
saveHelper.addExtraInfo(statistics, tracker);
|
||||
|
||||
String queen = StatCollector.translateToLocal("for.bees.grammar.queen.type");
|
||||
String princess = StatCollector.translateToLocal("for.bees.grammar.princess.type");
|
||||
String drone = StatCollector.translateToLocal("for.bees.grammar.drone.type");
|
||||
statistics.add(queen + ":\t\t" + tracker.getQueenCount());
|
||||
statistics.add(princess + ":\t" + tracker.getPrincessCount());
|
||||
statistics.add(drone + ":\t\t" + tracker.getDroneCount());
|
||||
statistics.add("");
|
||||
|
||||
Collection<IAlleleBeeSpecies> species = new ArrayList<IAlleleBeeSpecies>();
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values())
|
||||
if (allele instanceof IAlleleBeeSpecies)
|
||||
species.add((IAlleleBeeSpecies) allele);
|
||||
Collection<IAlleleSpecies> species = saveHelper.getSpecies();
|
||||
|
||||
String speciesCount = StatCollector.translateToLocal("for.gui.speciescount");
|
||||
String speciesCountLine = String.format("%s (%s):", speciesCount, species.size());
|
||||
statistics.add(speciesCountLine);
|
||||
statistics.add(line(speciesCountLine.length()));
|
||||
statistics.add(StringUtil.line(speciesCountLine.length()));
|
||||
|
||||
statistics.add(discoveredSymbol + ": " + StatCollector.translateToLocal("for.chat.command.forestry.beekeeping.save.key.discovered"));
|
||||
statistics.add(blacklistedSymbol + ": " + StatCollector.translateToLocal("for.chat.command.forestry.beekeeping.save.key.blacklisted"));
|
||||
statistics.add(notCountedSymbol + ": " + StatCollector.translateToLocal("for.chat.command.forestry.beekeeping.save.key.notCounted"));
|
||||
statistics.add(discoveredSymbol + ": " + StatCollector.translateToLocal("for.chat.command.forestry.stats.save.key.discovered"));
|
||||
statistics.add(blacklistedSymbol + ": " + StatCollector.translateToLocal("for.chat.command.forestry.stats.save.key.blacklisted"));
|
||||
statistics.add(notCountedSymbol + ": " + StatCollector.translateToLocal("for.chat.command.forestry.stats.save.key.notCounted"));
|
||||
statistics.add("");
|
||||
|
||||
String header = generateSpeciesListHeader();
|
||||
statistics.add(header);
|
||||
|
||||
statistics.add(line(header.length()));
|
||||
statistics.add(StringUtil.line(header.length()));
|
||||
statistics.add("");
|
||||
|
||||
for (IAlleleBeeSpecies allele : species)
|
||||
for (IAlleleSpecies allele : species)
|
||||
statistics.add(generateSpeciesListEntry(allele, tracker));
|
||||
}
|
||||
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Defaults.MOD.toLowerCase(Locale.ENGLISH) + "/stats/" + player + ".log");
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Defaults.MOD.toLowerCase(Locale.ENGLISH) + "/stats/" + player.getDisplayName() + "-" + saveHelper.getFileSuffix() + ".log");
|
||||
try {
|
||||
File folder = file.getParentFile();
|
||||
if (folder != null && !folder.exists()) {
|
||||
boolean success = file.getParentFile().mkdirs();
|
||||
if (!success) {
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.save.error1");
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.stats.save.error1");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!file.exists() && !file.createNewFile()) {
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.save.error1");
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.stats.save.error1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!file.canWrite()) {
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.save.error2");
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.stats.save.error2");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -151,20 +145,12 @@ public class CommandBeekeepingSave extends SubCommand {
|
||||
|
||||
}
|
||||
catch (IOException ex) {
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.save.error3");
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.stats.save.error3");
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.save.saved", player);
|
||||
}
|
||||
|
||||
private String line(int length) {
|
||||
StringBuilder line = new StringBuilder();
|
||||
for (int i = 0; i < length; i++)
|
||||
line.append("-");
|
||||
|
||||
return line.toString();
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.stats.save.saved", player.getDisplayName());
|
||||
}
|
||||
|
||||
private String generateSpeciesListHeader() {
|
||||
@@ -173,7 +159,7 @@ public class CommandBeekeepingSave extends SubCommand {
|
||||
return speciesListEntry(discoveredSymbol, blacklistedSymbol, notCountedSymbol, "UID", species, authority);
|
||||
}
|
||||
|
||||
private String generateSpeciesListEntry(IAlleleBeeSpecies species, IApiaristTracker tracker) {
|
||||
private String generateSpeciesListEntry(IAlleleSpecies species, IBreedingTracker tracker) {
|
||||
String discovered = "";
|
||||
if (tracker.isDiscovered(species))
|
||||
discovered = discoveredSymbol;
|
||||
Executable → Regular
+12
-11
@@ -4,20 +4,21 @@
|
||||
* 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.network;
|
||||
package forestry.core.commands;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Simple annotation to mark a field for synchronization in SMP.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface EntityNetData {
|
||||
// Needs to be set for arrays
|
||||
int staticSize() default -1;
|
||||
public interface ICommandModeHelper {
|
||||
String[] getModeNames();
|
||||
|
||||
String getModeNameMatching(String desired);
|
||||
|
||||
String getModeName(World world);
|
||||
void setMode(World world, String modeName);
|
||||
|
||||
Iterable<String> getDescription(String modeName);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public interface IStatsSaveHelper {
|
||||
|
||||
String getUnlocalizedSaveStatsString();
|
||||
|
||||
void addExtraInfo(Collection<String> statistics, IBreedingTracker breedingTracker);
|
||||
|
||||
Collection<IAlleleSpecies> getSpecies();
|
||||
|
||||
String getFileSuffix();
|
||||
|
||||
IBreedingTracker getBreedingTracker(World world, GameProfile gameProfile);
|
||||
}
|
||||
Executable → Regular
+2
-2
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
package forestry.core.commands;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class SpeciesNotFoundException extends CommandException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SpeciesNotFoundException(String title) {
|
||||
super("Could not find bee species with Name or UID %s", title);
|
||||
super("Could not find species with Name or UID %s", title);
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+1
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
package forestry.core.commands;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
|
||||
@@ -29,7 +29,6 @@ public class Defaults {
|
||||
|
||||
public static final int NET_MAX_UPDATE_DISTANCE = 50;
|
||||
|
||||
public static final String DEFAULT_POWER_FRAMEWORK = "forestry.energy.BioPowerFramework";
|
||||
public static final int BUCKET_VOLUME = 1000;
|
||||
public static final int FLUID_PER_HONEY_DROP = 100;
|
||||
|
||||
@@ -45,40 +44,18 @@ public class Defaults {
|
||||
public static final int[] FACING_WESTEAST = { FACING_WEST, FACING_EAST };
|
||||
public static final int[] FACINGS_NONE = new int[0];
|
||||
|
||||
public static final String LIQUID_WATER = "water";
|
||||
public static final String LIQUID_LAVA = "lava";
|
||||
public static final String LIQUID_MILK = "milk";
|
||||
public static final String LIQUID_BIOMASS = "biomass";
|
||||
public static final String LIQUID_ETHANOL = "bioethanol";
|
||||
public static final String LIQUID_SEEDOIL = "seedoil";
|
||||
public static final String LIQUID_HONEY = "honey";
|
||||
public static final String LIQUID_JUICE = "juice";
|
||||
public static final String LIQUID_ICE = "ice";
|
||||
public static final String LIQUID_MEAD = "short.mead";
|
||||
public static final String LIQUID_GLASS = "glass";
|
||||
public static final String LIQUID_OIL = "oil";
|
||||
public static final String LIQUID_FUEL = "fuel";
|
||||
|
||||
// Textures
|
||||
public static final String TEXTURE_PATH_GUI = "textures/gui";
|
||||
public static final String TEXTURE_PATH_BLOCKS = "textures/blocks";
|
||||
public static final String TEXTURE_PATH_ITEMS = "textures/items";
|
||||
public static final String TEXTURE_PATH_ENTITIES = "textures/entity";
|
||||
|
||||
public static final String TEXTURE_BLOCKS = TEXTURE_PATH_BLOCKS + "/blocks.png";
|
||||
public static final String TEXTURE_ARBORICULTURE = TEXTURE_PATH_BLOCKS + "/arboriculture.png";
|
||||
public static final String TEXTURE_PODS = TEXTURE_PATH_BLOCKS + "/pods.png";
|
||||
public static final String TEXTURE_FARM = TEXTURE_PATH_BLOCKS + "/farm.png";
|
||||
|
||||
public static final String TEXTURE_APIARIST_ARMOR_PRIMARY = TEXTURE_PATH_ITEMS + "/apiarist_armor_1.png";
|
||||
public static final String TEXTURE_APIARIST_ARMOR_SECONDARY = TEXTURE_PATH_ITEMS + "/apiarist_armor_2.png";
|
||||
public static final String TEXTURE_NATURALIST_ARMOR_PRIMARY = TEXTURE_PATH_ITEMS + "/naturalist_armor_1.png";
|
||||
public static final String TEXTURE_SKIN_BEEKPEEPER = TEXTURE_PATH_ENTITIES + "/beekeeper.png";
|
||||
public static final String TEXTURE_SKIN_LUMBERJACK = TEXTURE_PATH_ENTITIES + "/lumberjack.png";
|
||||
|
||||
public static final String TEXTURE_ICONS_MINECRAFT = "/gui/items.png";
|
||||
public static final String TEXTURE_BLOCKS_MINECRAFT = "/terrain.png";
|
||||
|
||||
// Villagers
|
||||
public static final int ID_VILLAGER_BEEKEEPER = 80;
|
||||
public static final int ID_VILLAGER_LUMBERJACK = 81;
|
||||
@@ -160,13 +137,6 @@ public class Defaults {
|
||||
public static final int FOOD_HONEY_HEAL = 2;
|
||||
public static final float FOOD_HONEY_SATURATION = 0.2f;
|
||||
|
||||
// IndustrialCraft 2
|
||||
public static final int ID_IC2_FUELCAN_DAMAGE = 6480;
|
||||
|
||||
// BuildCraft
|
||||
public static final int BUILDCRAFT_BLOCKID_ENGINE = 161;
|
||||
public static final int BUILDCRAFT_BLOCKID_PIPE = 166;
|
||||
|
||||
public static final int APIARY_MIN_LEVEL_LIGHT = 11;
|
||||
public static final int APIARY_BREEDING_TIME = 100;
|
||||
|
||||
@@ -233,32 +203,4 @@ public class Defaults {
|
||||
public static final int CARPENTER_CRATING_CYCLES = 5;
|
||||
public static final int CARPENTER_UNCRATING_CYCLES = 5;
|
||||
public static final int CARPENTER_CRATING_LIQUID_QUANTITY = 100;
|
||||
|
||||
// SMP gui ids
|
||||
public static final int ID_GUI_ARBORETUM = 90;
|
||||
public static final int ID_GUI_BOTTLER = 91;
|
||||
public static final int ID_GUI_ENGINE_BRONZE = 92;
|
||||
public static final int ID_GUI_FARM = 93;
|
||||
public static final int ID_GUI_FERMENTER = 94;
|
||||
public static final int ID_GUI_FORESTER = 95;
|
||||
public static final int ID_GUI_PLANTATION = 96;
|
||||
public static final int ID_GUI_PUMPKIN_FARM = 97;
|
||||
public static final int ID_GUI_PEAT_BOG = 98;
|
||||
public static final int ID_GUI_STILL = 99;
|
||||
public static final int ID_GUI_ENGINE_COPPER = 89;
|
||||
public static final int ID_GUI_RAINTANK = 88;
|
||||
public static final int ID_GUI_GENERATOR = 87;
|
||||
public static final int ID_GUI_CARPENTER = 86;
|
||||
public static final int ID_GUI_MOISTENER = 85;
|
||||
public static final int ID_GUI_MUSHROOM_FARM = 84;
|
||||
public static final int ID_GUI_APIARY = 83;
|
||||
public static final int ID_GUI_CENTRIFUGE = 82;
|
||||
public static final int ID_GUI_APIARIST_INVENTORY = 81;
|
||||
public static final int ID_GUI_BACKPACK = 80;
|
||||
public static final int ID_GUI_SQUEEZER = 79;
|
||||
public static final int ID_GUI_NETHER_FARM = 78;
|
||||
public static final int ID_GUI_BEEALYZER = 100;
|
||||
public static final int ID_GUI_BACKPACK_T2 = 101;
|
||||
public static final int ID_GUI_BIOME_FINDER = 102;
|
||||
// ID 100 used by bucket filler.
|
||||
}
|
||||
@@ -43,8 +43,6 @@ public enum ForestryItem {
|
||||
wrench,
|
||||
pipette,
|
||||
bucketBiomass,
|
||||
vialEmpty,
|
||||
vialCatalyst,
|
||||
bucketBiofuel,
|
||||
// Crafting
|
||||
impregnatedCasing,
|
||||
|
||||
@@ -166,23 +166,32 @@ public final class FluidHelper {
|
||||
if (used < fluidInContainer.amount)
|
||||
return false;
|
||||
|
||||
fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
|
||||
ItemStack emptyItem = getEmptyContainer(input);
|
||||
|
||||
// unstackable containers like buckets are not consumed
|
||||
if (outputSlot == inputSlot && input.getMaxStackSize() == 1) {
|
||||
inv.setInventorySlotContents(outputSlot, emptyItem);
|
||||
return true;
|
||||
if (output != null && emptyItem != null) {
|
||||
if (outputSlot == inputSlot) {
|
||||
if (input.stackSize > 1)
|
||||
return false;
|
||||
} else if (!StackUtils.isIdenticalItem(output, emptyItem)) {
|
||||
return false;
|
||||
} else if (output.stackSize + emptyItem.stackSize > output.getMaxStackSize()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
|
||||
if (emptyItem != null) {
|
||||
if (outputSlot == inputSlot) {
|
||||
inv.setInventorySlotContents(outputSlot, emptyItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (output == null) {
|
||||
inv.setInventorySlotContents(outputSlot, emptyItem);
|
||||
} else if (StackUtils.isIdenticalItem(output, emptyItem) && (output.stackSize < output.getMaxStackSize())) {
|
||||
} else {
|
||||
output.stackSize++;
|
||||
}
|
||||
// else output item is consumed
|
||||
}
|
||||
inv.decrStackSize(inputSlot, 1);
|
||||
return true;
|
||||
@@ -239,17 +248,11 @@ public final class FluidHelper {
|
||||
}
|
||||
|
||||
public static ItemStack getEmptyContainer(ItemStack container) {
|
||||
|
||||
Item item = container.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
ItemStack empty = container.copy();
|
||||
empty.stackSize = 1;
|
||||
IFluidContainerItem containerItem = (IFluidContainerItem) item;
|
||||
containerItem.drain(empty, Integer.MAX_VALUE, true);
|
||||
return empty;
|
||||
}
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
return FluidContainerRegistry.drainFluidContainer(container);
|
||||
return item.getContainerItem(container);
|
||||
}
|
||||
|
||||
public static ItemStack getFullyDrainedContainer(ItemStack container) {
|
||||
|
||||
@@ -10,14 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.fluids;
|
||||
|
||||
import forestry.core.config.Defaults;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
@@ -25,7 +31,10 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
public enum Fluids {
|
||||
|
||||
WATER, LAVA, FUEL, BIOMASS, BIOFUEL, CREOSOTE, STEAM, BIOETHANOL,
|
||||
COAL, PYROTHEUM, HONEY, MILK, JUICE, ICE, GLASS, OIL, SEEDOIL, SHORT_MEAD(Defaults.LIQUID_MEAD);
|
||||
COAL, PYROTHEUM, HONEY, MILK, JUICE, ICE, GLASS, OIL, SEEDOIL, SHORT_MEAD("short.mead");
|
||||
|
||||
private static final List<String> myLiquids = new ArrayList<String>(values().length);
|
||||
|
||||
private final String tag;
|
||||
|
||||
private Fluids() {
|
||||
@@ -44,24 +53,20 @@ public enum Fluids {
|
||||
return FluidRegistry.getFluid(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a FluidStack filled with qty milliBuckets worth of Fluid.
|
||||
*
|
||||
* @param qty
|
||||
* @return
|
||||
*/
|
||||
public FluidStack get(int qty) {
|
||||
return FluidRegistry.getFluidStack(tag, qty);
|
||||
public void register() {
|
||||
Fluid fluid = get();
|
||||
if (fluid == null) {
|
||||
fluid = new Fluid(tag);
|
||||
FluidRegistry.registerFluid(fluid);
|
||||
myLiquids.add(tag);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a FluidStack filled with n buckets worth of Fluid.
|
||||
*
|
||||
* @param n
|
||||
* @return
|
||||
* Gets a FluidStack filled with mb milliBuckets worth of Fluid.
|
||||
*/
|
||||
public FluidStack getB(int n) {
|
||||
return FluidRegistry.getFluidStack(tag, n * FluidContainerRegistry.BUCKET_VOLUME);
|
||||
public FluidStack get(int mb) {
|
||||
return FluidRegistry.getFluidStack(tag, mb);
|
||||
}
|
||||
|
||||
public boolean is(Fluid fluid) {
|
||||
@@ -82,4 +87,12 @@ public enum Fluids {
|
||||
return fluid == null && fluidStack == null;
|
||||
}
|
||||
|
||||
public static void resetFluidIcons(IIconRegister register) {
|
||||
for (String fluidString : myLiquids) {
|
||||
Fluid fluid = FluidRegistry.getFluid(fluidString);
|
||||
IIcon icon = TextureManager.getInstance().registerTex(register, "liquid/" + fluid.getName());
|
||||
fluid.setIcons(icon);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,15 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gadgets;
|
||||
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.PacketPayload;
|
||||
|
||||
public abstract class Mill extends TileBase {
|
||||
|
||||
@EntityNetData
|
||||
public int charge = 0;
|
||||
@EntityNetData
|
||||
public float speed;
|
||||
@EntityNetData
|
||||
public int stage = 0;
|
||||
public float progress;
|
||||
|
||||
@@ -36,6 +33,24 @@ public abstract class Mill extends TileBase {
|
||||
update(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketPayload getPacketPayload() {
|
||||
PacketPayload payload = new PacketPayload(2, 1, 0);
|
||||
payload.intPayload[0] = charge;
|
||||
payload.intPayload[1] = stage;
|
||||
|
||||
payload.floatPayload[0] = speed;
|
||||
return payload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromPacketPayload(PacketPayload payload) {
|
||||
charge = payload.intPayload[0];
|
||||
stage = payload.intPayload[1];
|
||||
|
||||
speed = payload.floatPayload[0];
|
||||
}
|
||||
|
||||
private void update(boolean isSimulating) {
|
||||
|
||||
// Stop gracefully if discharged.
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Stack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -25,25 +26,23 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.inventory.wrappers.IInvSlot;
|
||||
import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
@@ -59,7 +58,6 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
/* MEMBER */
|
||||
private int analyzeTime;
|
||||
|
||||
@EntityNetData
|
||||
public final FilteredTank resourceTank;
|
||||
|
||||
private final TankManager tankManager;
|
||||
|
||||
@@ -10,15 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gadgets;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.network.ClassMap;
|
||||
import forestry.core.network.IndexInPayload;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
|
||||
@@ -52,37 +51,11 @@ public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
/* NETWORK */
|
||||
@Override
|
||||
public PacketPayload getPacketPayload() {
|
||||
if (!ClassMap.classMappers.containsKey(this.getClass()))
|
||||
ClassMap.classMappers.put(this.getClass(), new ClassMap(this.getClass()));
|
||||
|
||||
ClassMap classmap = ClassMap.classMappers.get(this.getClass());
|
||||
PacketPayload payload = new PacketPayload(classmap.intSize, classmap.floatSize, classmap.stringSize);
|
||||
|
||||
try {
|
||||
classmap.setData(this, payload.intPayload, payload.floatPayload, payload.stringPayload, new IndexInPayload(0, 0, 0));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return payload;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromPacketPayload(PacketPayload payload) {
|
||||
|
||||
if (payload.isEmpty())
|
||||
return;
|
||||
|
||||
if (!ClassMap.classMappers.containsKey(this.getClass()))
|
||||
ClassMap.classMappers.put(this.getClass(), new ClassMap(this.getClass()));
|
||||
|
||||
ClassMap classmap = ClassMap.classMappers.get(this.getClass());
|
||||
|
||||
try {
|
||||
classmap.fromData(this, payload.intPayload, payload.floatPayload, payload.stringPayload, new IndexInPayload(0, 0, 0));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/* INTERACTION */
|
||||
|
||||
@@ -16,7 +16,8 @@ import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.interfaces.IOwnable;
|
||||
@@ -188,9 +189,9 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit
|
||||
this.sendNetworkUpdate();
|
||||
}
|
||||
// / ERROR HANDLING
|
||||
public EnumErrorCode errorState = EnumErrorCode.OK;
|
||||
public IErrorState errorState = EnumErrorCode.OK;
|
||||
|
||||
public void setErrorState(EnumErrorCode state) {
|
||||
public void setErrorState(IErrorState state) {
|
||||
if (this.errorState == state)
|
||||
return;
|
||||
this.errorState = state;
|
||||
@@ -203,7 +204,7 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
public IErrorState getErrorState() {
|
||||
return errorState;
|
||||
}
|
||||
// / OWNERSHIP
|
||||
|
||||
@@ -10,62 +10,25 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gadgets;
|
||||
|
||||
import buildcraft.api.tiles.IHasWork;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
|
||||
import forestry.core.interfaces.IPowerHandler;
|
||||
import forestry.core.interfaces.IRenderableMachine;
|
||||
import forestry.core.network.ClassMap;
|
||||
import forestry.core.network.IndexInPayload;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.energy.EnergyManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
|
||||
import buildcraft.api.tiles.IHasWork;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.tiles.IHasWork", modid = "BuildCraftAPI|tiles")
|
||||
public abstract class TilePowered extends TileBase implements IRenderableMachine, IPowerHandler, IHasWork {
|
||||
|
||||
public static final int WORK_CYCLES = 4;
|
||||
|
||||
@Override
|
||||
public PacketPayload getPacketPayload() {
|
||||
if (!ClassMap.classMappers.containsKey(this.getClass()))
|
||||
ClassMap.classMappers.put(this.getClass(), new ClassMap(this.getClass()));
|
||||
|
||||
ClassMap classmap = ClassMap.classMappers.get(this.getClass());
|
||||
PacketPayload payload = new PacketPayload(classmap.intSize, classmap.floatSize, classmap.stringSize);
|
||||
|
||||
try {
|
||||
classmap.setData(this, payload.intPayload, payload.floatPayload, payload.stringPayload, new IndexInPayload(0, 0, 0));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return payload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromPacketPayload(PacketPayload payload) {
|
||||
|
||||
if (payload.isEmpty())
|
||||
return;
|
||||
|
||||
if (!ClassMap.classMappers.containsKey(this.getClass()))
|
||||
ClassMap.classMappers.put(this.getClass(), new ClassMap(this.getClass()));
|
||||
|
||||
ClassMap classmap = ClassMap.classMappers.get(this.getClass());
|
||||
|
||||
try {
|
||||
classmap.fromData(this, payload.intPayload, payload.floatPayload, payload.stringPayload, new IndexInPayload(0, 0, 0));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected final EnergyManager energyManager;
|
||||
|
||||
public TilePowered(int maxTransfer, int energyPerWork, int capacity) {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gui;
|
||||
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class ErrorLedger extends Ledger {
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
EnumErrorCode state = tile.getErrorState();
|
||||
IErrorState state = tile.getErrorState();
|
||||
if (state == EnumErrorCode.OK)
|
||||
return;
|
||||
|
||||
@@ -52,11 +53,8 @@ public class ErrorLedger extends Ledger {
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
EnumErrorCode state = tile.getErrorState();
|
||||
if (state == EnumErrorCode.OK)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
IErrorState state = tile.getErrorState();
|
||||
return state != EnumErrorCode.OK;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.interfaces;
|
||||
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.IErrorState;
|
||||
|
||||
public interface IErrorSource {
|
||||
|
||||
boolean throwsErrors();
|
||||
|
||||
EnumErrorCode getErrorState();
|
||||
IErrorState getErrorState();
|
||||
|
||||
}
|
||||
@@ -19,11 +19,12 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public class ItemFruit extends ItemForestryFood {
|
||||
@@ -49,6 +50,14 @@ public class ItemFruit extends ItemForestryFood {
|
||||
public IIcon getIcon() {
|
||||
return icons[ordinal()];
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return getStack(1);
|
||||
}
|
||||
|
||||
public ItemStack getStack(int qty) {
|
||||
return ForestryItem.fruits.getItemStack(qty, ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
public ItemFruit() {
|
||||
|
||||
@@ -1,232 +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.network;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
|
||||
public class ClassMap {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final HashMap<Class, ClassMap> classMappers = new HashMap<Class, ClassMap>();
|
||||
|
||||
private final LinkedList<Field> intMember = new LinkedList<Field>();
|
||||
private final LinkedList<Field> floatMember = new LinkedList<Field>();
|
||||
private final LinkedList<Field> booleanMember = new LinkedList<Field>();
|
||||
private final LinkedList<Field> stringMember = new LinkedList<Field>();
|
||||
private final LinkedList<Field> enumMember = new LinkedList<Field>();
|
||||
private final LinkedList<Field> gameProfileMember = new LinkedList<Field>();
|
||||
private final LinkedList<ClassMap> objectMember = new LinkedList<ClassMap>();
|
||||
|
||||
public int intSize;
|
||||
public int floatSize;
|
||||
public int stringSize;
|
||||
|
||||
private Field field;
|
||||
|
||||
/**
|
||||
* Writes the actual data to the packet payload
|
||||
*
|
||||
* @param obj
|
||||
* {@link TileForestry} to write to packet
|
||||
* @param intPayload
|
||||
* @param floatPayload
|
||||
* @param stringPayload
|
||||
* @param index
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void setData(Object obj, int[] intPayload, float[] floatPayload, String[] stringPayload, IndexInPayload index) throws IllegalAccessException {
|
||||
for (Field member : intMember) {
|
||||
intPayload[index.intIndex] = member.getInt(obj);
|
||||
index.intIndex++;
|
||||
}
|
||||
for (Field member : floatMember) {
|
||||
floatPayload[index.floatIndex] = member.getFloat(obj);
|
||||
index.floatIndex++;
|
||||
}
|
||||
for (Field member : booleanMember) {
|
||||
if (member.getBoolean(obj))
|
||||
floatPayload[index.intIndex] = 1;
|
||||
else
|
||||
floatPayload[index.intIndex] = 0;
|
||||
index.intIndex++;
|
||||
}
|
||||
for (Field member : stringMember) {
|
||||
stringPayload[index.stringIndex] = (String) member.get(obj);
|
||||
index.stringIndex++;
|
||||
}
|
||||
for (Field member : enumMember) {
|
||||
intPayload[index.intIndex] = ((Enum) member.get(obj)).ordinal();
|
||||
index.intIndex++;
|
||||
}
|
||||
for (Field member : gameProfileMember) {
|
||||
GameProfile profile = (GameProfile) member.get(obj);
|
||||
UUID profileID = profile.getId();
|
||||
if (profileID == null)
|
||||
profileID = new UUID(0,0);
|
||||
intPayload[index.intIndex] = (int) (profileID.getMostSignificantBits() >>> 32);
|
||||
intPayload[index.intIndex + 1] = (int) profileID.getMostSignificantBits();
|
||||
intPayload[index.intIndex + 2] = (int) (profileID.getLeastSignificantBits() >>> 32);
|
||||
intPayload[index.intIndex + 3] = (int) profileID.getLeastSignificantBits();
|
||||
index.intIndex += 4;
|
||||
stringPayload[index.stringIndex] = profile.getName();
|
||||
index.stringIndex++;
|
||||
}
|
||||
|
||||
// Handle subobjects
|
||||
for (ClassMap submap : objectMember) {
|
||||
Object source = submap.field.get(obj);
|
||||
|
||||
if (source == null) {
|
||||
intPayload[index.intIndex] = 0;
|
||||
index.intIndex++;
|
||||
|
||||
index.intIndex += submap.intSize;
|
||||
index.floatIndex += submap.floatSize;
|
||||
index.stringIndex += submap.stringSize;
|
||||
} else {
|
||||
intPayload[index.intIndex] = 1;
|
||||
index.intIndex++;
|
||||
submap.setData(source, intPayload, floatPayload, stringPayload, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the given object with the data from the passed payload arrays
|
||||
*
|
||||
* @param obj
|
||||
* @param intPayload
|
||||
* @param floatPayload
|
||||
* @param stringPayload
|
||||
* @param index
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void fromData(Object obj, int[] intPayload, float[] floatPayload, String[] stringPayload, IndexInPayload index) throws IllegalAccessException {
|
||||
|
||||
for (Field member : intMember) {
|
||||
member.setInt(obj, intPayload[index.intIndex]);
|
||||
index.intIndex++;
|
||||
}
|
||||
|
||||
for (Field member : booleanMember) {
|
||||
member.setBoolean(obj, intPayload[index.intIndex] == 1);
|
||||
index.intIndex++;
|
||||
}
|
||||
|
||||
for (Field member : enumMember) {
|
||||
member.set(obj, ((Class) member.getGenericType()).getEnumConstants()[intPayload[index.intIndex]]);
|
||||
index.intIndex++;
|
||||
}
|
||||
|
||||
for (Field member : floatMember) {
|
||||
member.setFloat(obj, floatPayload[index.floatIndex]);
|
||||
index.floatIndex++;
|
||||
}
|
||||
for (Field member : stringMember) {
|
||||
member.set(obj, stringPayload[index.stringIndex]);
|
||||
index.stringIndex++;
|
||||
}
|
||||
for (Field member : gameProfileMember) {
|
||||
GameProfile profile = new GameProfile(new UUID((long) intPayload[index.intIndex] << 32 | intPayload[index.intIndex + 1],
|
||||
(long) intPayload[index.intIndex + 2] << 32 | intPayload[index.intIndex + 3]),
|
||||
stringPayload[index.stringIndex]);
|
||||
index.intIndex += 4;
|
||||
index.stringIndex++;
|
||||
|
||||
member.set(obj, profile);
|
||||
}
|
||||
|
||||
for (ClassMap map : objectMember) {
|
||||
boolean isNull = intPayload[index.intIndex] == 0;
|
||||
index.intIndex++;
|
||||
|
||||
if (isNull) {
|
||||
index.intIndex += map.intSize;
|
||||
index.floatIndex += map.floatSize;
|
||||
index.stringIndex += map.stringSize;
|
||||
} else {
|
||||
map.field.get(obj);
|
||||
map.fromData(map.field.get(obj), intPayload, floatPayload, stringPayload, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public ClassMap(final Class targetClass) {
|
||||
Field[] fields = targetClass.getDeclaredFields();
|
||||
|
||||
try {
|
||||
for (Field field : fields) {
|
||||
// We only handle fields marked with EntityNetData
|
||||
if (!isNetworkedMember(field))
|
||||
continue;
|
||||
|
||||
field.setAccessible(true);
|
||||
Type type = field.getGenericType();
|
||||
|
||||
if (type instanceof Class && !((Class) type).isArray()) {
|
||||
Class memberClass = (Class) type;
|
||||
if (memberClass.equals(int.class)) {
|
||||
intSize++;
|
||||
intMember.add(field);
|
||||
} else if (memberClass.equals(float.class)) {
|
||||
floatSize++;
|
||||
floatMember.add(field);
|
||||
} else if (memberClass.equals(boolean.class)) {
|
||||
intSize++;
|
||||
booleanMember.add(field);
|
||||
} else if (memberClass.equals(String.class)) {
|
||||
stringSize++;
|
||||
stringMember.add(field);
|
||||
} else if (Enum.class.isAssignableFrom(memberClass)) {
|
||||
intSize++;
|
||||
enumMember.add(field);
|
||||
} else if (GameProfile.class.isAssignableFrom(memberClass)) {
|
||||
intSize += 4;
|
||||
stringSize++;
|
||||
gameProfileMember.add(field);
|
||||
} else {
|
||||
// If we are none of the above we assume to be another
|
||||
// mapable object
|
||||
// Might not be true and fail!
|
||||
ClassMap mapper = new ClassMap(memberClass);
|
||||
mapper.field = field;
|
||||
|
||||
objectMember.add(mapper);
|
||||
intSize++;
|
||||
|
||||
intSize += mapper.intSize;
|
||||
floatSize += mapper.floatSize;
|
||||
stringSize += mapper.stringSize;
|
||||
}
|
||||
} else if (type instanceof Class && ((Class) type).isArray())
|
||||
// We don't handle arrays currently. Throw exception
|
||||
throw new RuntimeException("Tried to map class " + targetClass.toString() + " but it requested mapping of an array. Not handled!");
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isNetworkedMember(Field member) {
|
||||
return member.getAnnotation(EntityNetData.class) != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,15 +18,17 @@ import java.util.UUID;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.core.ErrorStateRegistry;
|
||||
import forestry.api.core.IErrorState;
|
||||
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
|
||||
public class PacketTileUpdate extends PacketUpdate {
|
||||
|
||||
private ForgeDirection orientation = ForgeDirection.WEST;
|
||||
private EnumErrorCode errorState = EnumErrorCode.OK;
|
||||
private IErrorState errorState = EnumErrorCode.OK;
|
||||
|
||||
private boolean isOwnable = false;
|
||||
private EnumAccess access = EnumAccess.SHARED;
|
||||
@@ -57,11 +59,14 @@ public class PacketTileUpdate extends PacketUpdate {
|
||||
data.writeInt(posY);
|
||||
data.writeInt(posZ);
|
||||
|
||||
data.writeInt(this.orientation.ordinal());
|
||||
data.writeInt(this.errorState.ordinal());
|
||||
data.writeByte(this.orientation.ordinal());
|
||||
data.writeShort(this.errorState.getID());
|
||||
|
||||
// TODO: Should this really be sent to the client? Huge network cost.
|
||||
// As far as I know, only GUIs need it, and there are better ways to get the information to a GUI.
|
||||
// -CovertJaguar
|
||||
if (isOwnable) {
|
||||
data.writeInt(access.ordinal());
|
||||
data.writeByte(access.ordinal());
|
||||
if (owner == null) {
|
||||
data.writeBoolean(false);
|
||||
} else {
|
||||
@@ -83,10 +88,10 @@ public class PacketTileUpdate extends PacketUpdate {
|
||||
posY = data.readInt();
|
||||
posZ = data.readInt();
|
||||
|
||||
orientation = ForgeDirection.values()[data.readInt()];
|
||||
errorState = EnumErrorCode.values()[data.readInt()];
|
||||
orientation = ForgeDirection.getOrientation(data.readByte());
|
||||
errorState = ErrorStateRegistry.getErrorStateFromCode(data.readShort());
|
||||
|
||||
int ordinal = data.readInt();
|
||||
int ordinal = data.readByte();
|
||||
isOwnable = ordinal >= 0;
|
||||
if (isOwnable) {
|
||||
access = EnumAccess.values()[ordinal];
|
||||
@@ -105,7 +110,7 @@ public class PacketTileUpdate extends PacketUpdate {
|
||||
return this.orientation;
|
||||
}
|
||||
|
||||
public EnumErrorCode getErrorState() {
|
||||
public IErrorState getErrorState() {
|
||||
return this.errorState;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.proxy;
|
||||
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
|
||||
import forestry.core.network.ForestryPacket;
|
||||
|
||||
public class ClientProxyNetwork extends ProxyNetwork {
|
||||
|
||||
@Override
|
||||
public void sendToServer(ForestryPacket packet) {
|
||||
Proxies.common.getClientInstance().getNetHandler().addToSendQueue(packet.getPacket());
|
||||
NetHandlerPlayClient netHandler = Proxies.common.getClientInstance().getNetHandler();
|
||||
if (netHandler != null)
|
||||
netHandler.addToSendQueue(packet.getPacket());
|
||||
}
|
||||
}
|
||||
@@ -101,4 +101,35 @@ public class ProxyLog {
|
||||
LogManager.getLogger(Defaults.MOD).log(logLevel, new MessageFormatMessage(String.format(message, params), params));
|
||||
}
|
||||
|
||||
/* EXCEPTIONS */
|
||||
public void logThrowable(String msg, Throwable error, Object... args) {
|
||||
logThrowable(Level.ERROR, msg, 3, error, args);
|
||||
}
|
||||
|
||||
public void logThrowable(String msg, int lines, Throwable error, Object... args) {
|
||||
logThrowable(Level.ERROR, msg, lines, error, args);
|
||||
}
|
||||
|
||||
public void logThrowable(Level level, String msg, int lines, Throwable error, Object... args) {
|
||||
StackTraceElement[] oldtrace = error.getStackTrace();
|
||||
if (lines < oldtrace.length) {
|
||||
StackTraceElement[] newtrace = new StackTraceElement[lines];
|
||||
System.arraycopy(oldtrace, 0, newtrace, 0, newtrace.length);
|
||||
error.setStackTrace(newtrace);
|
||||
}
|
||||
LogManager.getLogger(Defaults.MOD).log(level, new MessageFormatMessage(msg, args), error);
|
||||
}
|
||||
|
||||
public void logErrorAPI(String mod, Throwable error, Class classFile) {
|
||||
StringBuilder msg = new StringBuilder(mod);
|
||||
msg.append(" API error, please update your mods. Error: ").append(error);
|
||||
logThrowable(Level.ERROR, msg.toString(), 2, error);
|
||||
|
||||
if (classFile != null) {
|
||||
msg = new StringBuilder(mod);
|
||||
msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation());
|
||||
log(Level.ERROR, msg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +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.utils;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public abstract class CommandMC extends CommandBase {
|
||||
|
||||
protected World getWorld(ICommandSender sender, String[] arguments) {
|
||||
|
||||
// Handle passed in world argument
|
||||
if (arguments.length > 2) {
|
||||
int dim = 0;
|
||||
try {
|
||||
dim = Integer.parseInt(arguments[1]);
|
||||
} catch (Exception ex) {
|
||||
throw new WrongUsageException("/" + getCommandName() + " set [<world-#>] <beekeeping-mode>");
|
||||
}
|
||||
|
||||
return MinecraftServer.getServer().worldServerForDimension(dim);
|
||||
}
|
||||
|
||||
if (sender instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) sender;
|
||||
return player.worldObj;
|
||||
} else
|
||||
return MinecraftServer.getServer().worldServerForDimension(0);
|
||||
|
||||
}
|
||||
|
||||
protected String[] getPlayers() {
|
||||
return MinecraftServer.getServer().getAllUsernames();
|
||||
}
|
||||
|
||||
protected void sendChatMessage(ICommandSender sender, String message) {
|
||||
sender.addChatMessage(new ChatComponentText(message));
|
||||
}
|
||||
}
|
||||
@@ -1,59 +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.utils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
|
||||
/**
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public enum Fluids {
|
||||
|
||||
WATER, LAVA, FUEL, BIOFUEL, CREOSOTE, STEAM;
|
||||
|
||||
public String getTag() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public Fluid get() {
|
||||
return FluidRegistry.getFluid(getTag());
|
||||
}
|
||||
|
||||
public FluidStack get(int qty) {
|
||||
return FluidRegistry.getFluidStack(getTag(), qty);
|
||||
}
|
||||
|
||||
public boolean is(Fluid fluid) {
|
||||
return get() == fluid;
|
||||
}
|
||||
|
||||
public boolean is(FluidStack fluidStack) {
|
||||
return fluidStack != null && get() == fluidStack.getFluid();
|
||||
}
|
||||
|
||||
public boolean isContained(ItemStack containerStack) {
|
||||
return containerStack != null && FluidHelper.containsFluid(containerStack, Fluids.WATER.get());
|
||||
}
|
||||
|
||||
public static boolean areEqual(Fluid fluid, FluidStack fluidStack) {
|
||||
if (fluidStack != null && fluid == fluidStack.getFluid())
|
||||
return true;
|
||||
return fluid == null && fluidStack == null;
|
||||
}
|
||||
}
|
||||
@@ -10,63 +10,42 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.fluids.Fluids;
|
||||
|
||||
public class LiquidHelper {
|
||||
|
||||
private static final LinkedList<String> myLiquids = new LinkedList<String>();
|
||||
|
||||
public static boolean isEmptyLiquidData() {
|
||||
return FluidContainerRegistry.getRegisteredFluidContainerData().length <= 0;
|
||||
}
|
||||
|
||||
public static Fluid getOrCreateLiquid(String ident) {
|
||||
if (!FluidRegistry.isFluidRegistered(ident)) {
|
||||
Fluid fluid = new Fluid(ident);
|
||||
FluidRegistry.registerFluid(fluid);
|
||||
myLiquids.add(ident);
|
||||
}
|
||||
return FluidRegistry.getFluid(ident);
|
||||
public static void injectLiquidContainer(Fluids fluid, int volume, ItemStack filled, ItemStack empty) {
|
||||
injectLiquidContainer(fluid, volume, filled, empty, null, 0);
|
||||
}
|
||||
|
||||
public static FluidStack getLiquid(String name, int amount) {
|
||||
return FluidRegistry.getFluidStack(name, amount);
|
||||
public static void injectWaxContainer(Fluids fluid, int volume, ItemStack filled, ItemStack empty) {
|
||||
injectLiquidContainer(fluid, volume, filled, empty, ForestryItem.beeswax.getItemStack(), 10);
|
||||
}
|
||||
|
||||
public static void injectLiquidContainer(String name, int volume, ItemStack filled, ItemStack empty) {
|
||||
injectLiquidContainer(name, volume, filled, empty, null, 0);
|
||||
public static void injectRefractoryContainer(Fluids fluid, int volume, ItemStack filled, ItemStack empty) {
|
||||
injectLiquidContainer(fluid, volume, filled, empty, ForestryItem.refractoryWax.getItemStack(), 10);
|
||||
}
|
||||
|
||||
public static void injectWaxContainer(String name, int volume, ItemStack filled, ItemStack empty) {
|
||||
injectLiquidContainer(name, volume, filled, empty, ForestryItem.beeswax.getItemStack(), 10);
|
||||
public static void injectTinContainer(Fluids fluid, int volume, ItemStack filled, ItemStack empty) {
|
||||
injectLiquidContainer(fluid, volume, filled, empty, ForestryItem.ingotTin.getItemStack(), 5);
|
||||
}
|
||||
|
||||
public static void injectRefractoryContainer(String name, int volume, ItemStack filled, ItemStack empty) {
|
||||
injectLiquidContainer(name, volume, filled, empty, ForestryItem.refractoryWax.getItemStack(), 10);
|
||||
}
|
||||
|
||||
public static void injectTinContainer(String name, int volume, ItemStack filled, ItemStack empty) {
|
||||
injectLiquidContainer(name, volume, filled, empty, ForestryItem.ingotTin.getItemStack(), 5);
|
||||
}
|
||||
|
||||
public static void injectLiquidContainer(String name, int volume, ItemStack filled, ItemStack empty, ItemStack remnant, int chance) {
|
||||
FluidStack contained = FluidRegistry.getFluidStack(name, volume);
|
||||
public static void injectLiquidContainer(Fluids fluid, int volume, ItemStack filled, ItemStack empty, ItemStack remnant, int chance) {
|
||||
FluidStack contained = fluid.get(volume);
|
||||
if (contained == null)
|
||||
throw new IllegalArgumentException(String.format("Attempted to inject a liquid container for the non-existent liquid '%s'.", name));
|
||||
throw new IllegalArgumentException(String.format("Attempted to inject a liquid container for the non-existent liquid '%s'.", fluid));
|
||||
|
||||
FluidContainerData container = new FluidContainerData(contained, filled, empty);
|
||||
FluidContainerRegistry.registerFluidContainer(container);
|
||||
@@ -79,11 +58,4 @@ public class LiquidHelper {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { container.filledContainer }, container.fluid);
|
||||
}
|
||||
|
||||
public static void resetLiquidIcons(IIconRegister register) {
|
||||
for (String fluidString : myLiquids) {
|
||||
Fluid fluid = FluidRegistry.getFluid(fluidString);
|
||||
IIcon icon = TextureManager.getInstance().registerTex(register, "liquid/" + fluid.getName());
|
||||
fluid.setIcons(icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,12 @@ import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gui.ContainerDummy;
|
||||
import forestry.core.interfaces.IDescriptiveRecipe;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -33,17 +35,17 @@ public class RecipeUtil {
|
||||
|
||||
private static final Container DUMMY_CONTAINER = new ContainerDummy();
|
||||
|
||||
public static void injectLeveledRecipe(ItemStack resource, int fermentationValue, String output) {
|
||||
public static void injectLeveledRecipe(ItemStack resource, int fermentationValue, Fluids output) {
|
||||
if (RecipeManagers.fermenterManager == null)
|
||||
return;
|
||||
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.0f, FluidRegistry.getFluidStack(output, 1), FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1));
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.0f, output.get(1), Fluids.WATER.get(1));
|
||||
|
||||
if (FluidRegistry.isFluidRegistered(Defaults.LIQUID_JUICE))
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.5f, FluidRegistry.getFluidStack(output, 1), FluidRegistry.getFluidStack(Defaults.LIQUID_JUICE, 1));
|
||||
if (FluidRegistry.isFluidRegistered(Fluids.JUICE.get()))
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.5f, output.get(1), Fluids.JUICE.get(1));
|
||||
|
||||
if (FluidRegistry.isFluidRegistered(Defaults.LIQUID_HONEY))
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.5f, FluidRegistry.getFluidStack(output, 1), FluidRegistry.getFluidStack(Defaults.LIQUID_HONEY, 1));
|
||||
if (FluidRegistry.isFluidRegistered(Fluids.HONEY.get()))
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.5f, output.get(1), Fluids.HONEY.get(1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*******************************************************************************
|
||||
* 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.utils;
|
||||
|
||||
import com.google.common.collect.ForwardingCollection;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
* @param <T>
|
||||
*/
|
||||
public class RevolvingList<T> extends ForwardingCollection<T> {
|
||||
|
||||
private final Deque<T> list = new LinkedList<T>();
|
||||
|
||||
public RevolvingList() {
|
||||
}
|
||||
|
||||
public RevolvingList(Collection<? extends T> collection) {
|
||||
list.addAll(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<T> delegate() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void rotateLeft() {
|
||||
if (list.isEmpty())
|
||||
return;
|
||||
list.addFirst(list.removeLast());
|
||||
}
|
||||
|
||||
public void rotateRight() {
|
||||
if (list.isEmpty())
|
||||
return;
|
||||
list.addLast(list.removeFirst());
|
||||
}
|
||||
|
||||
public T getCurrent() {
|
||||
if (list.isEmpty())
|
||||
return null;
|
||||
return list.getFirst();
|
||||
}
|
||||
|
||||
public void setCurrent(T e) {
|
||||
if (!contains(e))
|
||||
return;
|
||||
|
||||
if (e == null)
|
||||
while (getCurrent() != null) {
|
||||
rotateRight();
|
||||
}
|
||||
else
|
||||
while (getCurrent() == null || !getCurrent().equals(e)) {
|
||||
rotateRight();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -89,4 +89,12 @@ public class StringUtil {
|
||||
public static String floatAsPercent(float val) {
|
||||
return (int) (val * 100) + " %";
|
||||
}
|
||||
|
||||
public static String line(int length) {
|
||||
StringBuilder line = new StringBuilder();
|
||||
for (int i = 0; i < length; i++)
|
||||
line.append("-");
|
||||
|
||||
return line.toString();
|
||||
}
|
||||
}
|
||||
@@ -42,15 +42,19 @@ public abstract class WorldGenBase extends WorldGenerator {
|
||||
|
||||
@Override
|
||||
public final boolean generate(World world, Random random, int x, int y, int z) {
|
||||
return generate(world, random, x, y, z, false);
|
||||
}
|
||||
|
||||
public final boolean generate(World world, Random random, int x, int y, int z, boolean forced) {
|
||||
this.world = world;
|
||||
this.rand = random;
|
||||
boolean result = subGenerate(x, y, z);
|
||||
boolean result = subGenerate(x, y, z, forced);
|
||||
this.world = null;
|
||||
this.rand = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean subGenerate(int x, int y, int z) {
|
||||
public boolean subGenerate(int x, int y, int z, boolean forced) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,28 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.gadgets;
|
||||
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.fuels.EngineBronzeFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
@@ -26,6 +41,7 @@ import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketPayload;
|
||||
<<<<<<< HEAD
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -40,6 +56,10 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
=======
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
|
||||
>>>>>>> dev
|
||||
public class EngineBronze extends Engine implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
/* CONSTANTS */
|
||||
@@ -137,7 +157,8 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
if (heatStage > 0.25 && shutdown)
|
||||
shutdown(false);
|
||||
else if (shutdown)
|
||||
if (heatingTank.getFluidAmount() > 0 && heatingTank.getFluid().getFluid().getName().equals(Defaults.LIQUID_LAVA)) {
|
||||
|
||||
if (heatingTank.getFluidAmount() > 0 && Fluids.LAVA.is(heatingTank.getFluid())) {
|
||||
addHeat(Defaults.ENGINE_HEAT_VALUE_LAVA);
|
||||
heatingTank.drain(1, true);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ package forestry.energy.gadgets;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.core.TemperatureState;
|
||||
|
||||
@@ -22,7 +22,7 @@ import ic2.api.energy.prefab.BasicSink;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.TemperatureState;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
|
||||
@@ -19,29 +19,36 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import ic2.api.energy.prefab.BasicSource;
|
||||
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.GeneratorFuel;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.interfaces.IRenderableMachine;
|
||||
<<<<<<< HEAD
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.EntityNetData;
|
||||
=======
|
||||
>>>>>>> dev
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginIC2;
|
||||
<<<<<<< HEAD
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
=======
|
||||
|
||||
import ic2.api.energy.prefab.BasicSource;
|
||||
>>>>>>> dev
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +58,6 @@ public class MachineGenerator extends TileBase implements ISidedInventory, ILiqu
|
||||
public static final short SLOT_CAN = 0;
|
||||
public static final int maxEnergy = 30000;
|
||||
|
||||
@EntityNetData
|
||||
public final FilteredTank resourceTank;
|
||||
private final TankManager tankManager;
|
||||
private int tickCount = 0;
|
||||
|
||||
@@ -12,9 +12,9 @@ package forestry.factory.gadgets;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
@@ -23,12 +23,17 @@ import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -44,13 +49,6 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
public class MachineBottler extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
/* CONSTANTS */
|
||||
@@ -103,13 +101,12 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
if (recipe.matches(res, empty))
|
||||
return recipe;
|
||||
}
|
||||
|
||||
|
||||
// No recipe matched. See if the liquid dictionary has anything.
|
||||
if (FluidContainerRegistry.isEmptyContainer(empty)) {
|
||||
ItemStack filled = FluidContainerRegistry.fillFluidContainer(res, empty);
|
||||
if (FluidHelper.isEmptyContainer(empty)) {
|
||||
ItemStack filled = FluidHelper.getFilledContainer(res, empty);
|
||||
if (filled != null) {
|
||||
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(filled);
|
||||
Recipe recipe = new Recipe(CYCLES_FILLING_DEFAULT, fluidStack, empty, filled);
|
||||
Recipe recipe = new Recipe(CYCLES_FILLING_DEFAULT, res, empty, filled);
|
||||
recipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
@@ -141,7 +138,6 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
}
|
||||
}
|
||||
|
||||
@EntityNetData
|
||||
public final StandardTank resourceTank;
|
||||
private final TankManager tankManager;
|
||||
|
||||
@@ -154,9 +150,9 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
|
||||
public MachineBottler() {
|
||||
super(1100, 50, 4000);
|
||||
|
||||
|
||||
setInternalInventory(new TileInventoryAdapter(this, 3, "Items"));
|
||||
|
||||
|
||||
setHints(Config.hints.get("bottler"));
|
||||
resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
tankManager = new TankManager(resourceTank);
|
||||
@@ -219,13 +215,12 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
public void updateServerSide() {
|
||||
if (worldObj.getTotalWorldTime() % 20 * 10 != 0)
|
||||
return;
|
||||
|
||||
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
|
||||
|
||||
// Check if we have suitable items waiting in the item slot
|
||||
if (inventory.getStackInSlot(SLOT_CAN) != null) {
|
||||
if (inventory.getStackInSlot(SLOT_CAN) != null)
|
||||
FluidHelper.drainContainers(tankManager, inventory, SLOT_CAN);
|
||||
}
|
||||
|
||||
checkRecipe();
|
||||
if (getErrorState() == EnumErrorCode.NORECIPE && currentRecipe != null)
|
||||
@@ -436,7 +431,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
if (slotIndex == SLOT_RESOURCE)
|
||||
return FluidContainerRegistry.isEmptyContainer(itemstack);
|
||||
|
||||
if(slotIndex == SLOT_CAN) {
|
||||
if (slotIndex == SLOT_CAN) {
|
||||
FluidStack fluidStack = FluidHelper.getFluidStackInContainer(itemstack);
|
||||
return RecipeManager.isInput(fluidStack);
|
||||
}
|
||||
|
||||
@@ -29,37 +29,33 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.ICarpenterManager;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
<<<<<<< HEAD
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
=======
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
>>>>>>> 5ea4770a2d5fef57cf52fb7c81f33671f8086740
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.factory.gui.ContainerCarpenter;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class MachineCarpenter extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
@@ -151,28 +147,16 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
@Override
|
||||
public void addCrating(ItemStack itemStack) {
|
||||
ItemStack uncrated = ((forestry.core.items.ItemCrated) itemStack.getItem()).getContained(itemStack);
|
||||
<<<<<<< HEAD
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
ForestryItem.crate.getItemStack(), itemStack, new Object[]{"###", "###", "###", '#', uncrated});
|
||||
addRecipe(null, new ItemStack(uncrated.getItem(), 9, uncrated.getItemDamage()), new Object[]{"#", Character.valueOf('#'), itemStack});
|
||||
=======
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, Fluids.WATER.get(Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
ForestryItem.crate.getItemStack(), itemStack, new Object[] { "###", "###", "###", '#', uncrated });
|
||||
addRecipe(null, new ItemStack(uncrated.getItem(), 9, uncrated.getItemDamage()), new Object[] { "#", '#', itemStack });
|
||||
>>>>>>> 5ea4770a2d5fef57cf52fb7c81f33671f8086740
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCrating(String toCrate, ItemStack unpack, ItemStack crated) {
|
||||
<<<<<<< HEAD
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
ForestryItem.crate.getItemStack(), crated, new Object[]{"###", "###", "###", '#', toCrate});
|
||||
addRecipe(null, new ItemStack(unpack.getItem(), 9, unpack.getItemDamage()), new Object[]{"#", '#', crated});
|
||||
=======
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
addRecipe(Defaults.CARPENTER_CRATING_CYCLES, Fluids.WATER.get(Defaults.CARPENTER_CRATING_LIQUID_QUANTITY),
|
||||
ForestryItem.crate.getItemStack(), crated, new Object[] { "###", "###", "###", '#', toCrate });
|
||||
addRecipe(null, new ItemStack(unpack.getItem(), 9, unpack.getItemDamage()), new Object[] { "#", '#', crated });
|
||||
>>>>>>> 5ea4770a2d5fef57cf52fb7c81f33671f8086740
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,7 +211,6 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
}
|
||||
|
||||
/* MEMBER */
|
||||
@EntityNetData
|
||||
public final FilteredTank resourceTank;
|
||||
private final TankManager tankManager;
|
||||
private final TileInventoryAdapter craftingInventory;
|
||||
|
||||
@@ -15,7 +15,7 @@ import cpw.mods.fml.common.Optional;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
import forestry.api.recipes.ICentrifugeManager;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gadgets;
|
||||
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.IFabricatorManager;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
@@ -228,10 +229,14 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT
|
||||
|
||||
public MachineFabricator() {
|
||||
super(1100, 50, 3300);
|
||||
<<<<<<< HEAD
|
||||
setInternalInventory(new TileInventoryAdapter(this, 30, "Items"));
|
||||
invCrafting = new InventoryMapper(getInternalInventory(), SLOT_CRAFTING_1, SLOT_CRAFTING_COUNT);
|
||||
Fluid liquidGlass = FluidRegistry.getFluid(Defaults.LIQUID_GLASS);
|
||||
moltenTank = new FilteredTank(2 * Defaults.BUCKET_VOLUME, liquidGlass);
|
||||
=======
|
||||
moltenTank = new FilteredTank(2 * Defaults.BUCKET_VOLUME, Fluids.GLASS.get());
|
||||
>>>>>>> dev
|
||||
moltenTank.tankMode = StandardTank.TankMode.INTERNAL;
|
||||
tankManager = new TankManager(moltenTank);
|
||||
}
|
||||
@@ -425,14 +430,13 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
ItemStack itemToMelt = inventory.getStackInSlot(SLOT_METAL);
|
||||
Smelting smelting = RecipeManager.findMatchingSmelting(itemToMelt);
|
||||
FluidStack liquid = smelting.getProduct();
|
||||
if (moltenTank.fill(liquid, false) > 0)
|
||||
if (smelting != null && moltenTank.fill(smelting.getProduct(), false) > 0)
|
||||
return true;
|
||||
|
||||
ItemStack plan = inventory.getStackInSlot(SLOT_PLAN);
|
||||
ItemStack[] resources = inventory.getStacks(SLOT_CRAFTING_1, SLOT_CRAFTING_COUNT);
|
||||
|
||||
return RecipeManager.findMatchingRecipe(plan, liquid, resources) != null;
|
||||
return RecipeManager.findMatchingRecipe(plan, moltenTank.getFluid(), resources) != null;
|
||||
}
|
||||
|
||||
public int getHeatScaled(int i) {
|
||||
|
||||
@@ -27,13 +27,12 @@ import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.recipes.IFermenterManager;
|
||||
@@ -41,13 +40,13 @@ import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.Utils;
|
||||
@@ -138,7 +137,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
|
||||
|
||||
@Override
|
||||
public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output) {
|
||||
addRecipe(resource, fermentationValue, modifier, output, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000));
|
||||
addRecipe(resource, fermentationValue, modifier, output, Fluids.WATER.get(1000));
|
||||
}
|
||||
|
||||
public static Recipe findMatchingRecipe(ItemStack res, FluidStack liqu) {
|
||||
@@ -183,9 +182,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
|
||||
return recipeList;
|
||||
}
|
||||
}
|
||||
@EntityNetData
|
||||
public final FilteredTank resourceTank;
|
||||
@EntityNetData
|
||||
public final FilteredTank productTank;
|
||||
|
||||
private final TankManager tankManager;
|
||||
|
||||
@@ -10,12 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gadgets;
|
||||
|
||||
import static cpw.mods.fml.relauncher.FMLLaunchHandler.side;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.recipes.IMoistenerManager;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
@@ -25,11 +24,13 @@ import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.interfaces.IRenderableMachine;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -42,10 +43,6 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MachineMoistener extends TileBase implements ISidedInventory, ILiquidTankContainer, IRenderableMachine {
|
||||
|
||||
/* CONSTANTS */
|
||||
@@ -59,17 +56,17 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
|
||||
/* RECIPE MANAGMENT */
|
||||
public static class Recipe {
|
||||
|
||||
|
||||
public final int timePerItem;
|
||||
public final ItemStack resource;
|
||||
public final ItemStack product;
|
||||
|
||||
|
||||
public Recipe(ItemStack resource, ItemStack product, int timePerItem) {
|
||||
this.timePerItem = timePerItem;
|
||||
this.resource = resource;
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
|
||||
public boolean matches(ItemStack res) {
|
||||
if (res == null && resource == null)
|
||||
return true;
|
||||
@@ -79,28 +76,28 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
return resource.isItemEqual(res);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class RecipeManager implements IMoistenerManager {
|
||||
|
||||
|
||||
public static final ArrayList<MachineMoistener.Recipe> recipes = new ArrayList<MachineMoistener.Recipe>();
|
||||
|
||||
|
||||
@Override
|
||||
public void addRecipe(ItemStack resource, ItemStack product, int timePerItem) {
|
||||
recipes.add(new MachineMoistener.Recipe(resource, product, timePerItem));
|
||||
}
|
||||
|
||||
|
||||
public static boolean isResource(ItemStack resource) {
|
||||
if (resource == null)
|
||||
return false;
|
||||
|
||||
|
||||
for (Recipe rec : recipes) {
|
||||
if (StackUtils.isIdenticalItem(resource, rec.resource))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static Recipe findMatchingRecipe(ItemStack item) {
|
||||
for (int i = 0; i < recipes.size(); i++) {
|
||||
Recipe recipe = recipes.get(i);
|
||||
@@ -109,44 +106,43 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<Object[], Object[]> getRecipes() {
|
||||
HashMap<Object[], Object[]> recipeList = new HashMap<Object[], Object[]>();
|
||||
|
||||
|
||||
for (Recipe recipe : recipes) {
|
||||
recipeList.put(new ItemStack[]{recipe.resource}, new ItemStack[]{recipe.product});
|
||||
}
|
||||
|
||||
|
||||
return recipeList;
|
||||
}
|
||||
}
|
||||
|
||||
@EntityNetData
|
||||
|
||||
public final FilteredTank resourceTank;
|
||||
private final TankManager tankManager;
|
||||
//private ItemStack[] inventoryStacks = new ItemStack[12];
|
||||
public MachineMoistener.Recipe currentRecipe;
|
||||
|
||||
|
||||
public int burnTime = 0;
|
||||
public int totalTime = 0;
|
||||
public int productionTime = 0;
|
||||
private int timePerItem = 0;
|
||||
private ItemStack currentProduct;
|
||||
private ItemStack pendingProduct;
|
||||
|
||||
|
||||
public MachineMoistener() {
|
||||
setInternalInventory(new TileInventoryAdapter(this, 12, "Items"));
|
||||
setHints(Config.hints.get("moistener"));
|
||||
resourceTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, FluidRegistry.WATER);
|
||||
tankManager = new TankManager(resourceTank);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void openGui(EntityPlayer player, TileBase tile) {
|
||||
player.openGui(ForestryAPI.instance, GuiId.MoistenerGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord);
|
||||
@@ -156,11 +152,11 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
|
||||
nbttagcompound.setInteger("BurnTime", burnTime);
|
||||
nbttagcompound.setInteger("TotalTime", totalTime);
|
||||
nbttagcompound.setInteger("ProductionTime", productionTime);
|
||||
|
||||
|
||||
tankManager.writeTanksToNBT(nbttagcompound);
|
||||
|
||||
// Write pending product
|
||||
@@ -175,15 +171,15 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
nbttagcompound.setTag("CurrentProduct", nbttagcompoundP);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
|
||||
burnTime = nbttagcompound.getInteger("BurnTime");
|
||||
totalTime = nbttagcompound.getInteger("TotalTime");
|
||||
productionTime = nbttagcompound.getInteger("ProductionTime");
|
||||
|
||||
|
||||
tankManager.readTanksFromNBT(nbttagcompound);
|
||||
|
||||
// Load pending product
|
||||
@@ -195,10 +191,10 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
NBTTagCompound nbttagcompoundP = nbttagcompound.getCompoundTag("CurrentProduct");
|
||||
currentProduct = ItemStack.loadItemStackFromNBT(nbttagcompoundP);
|
||||
}
|
||||
|
||||
|
||||
checkRecipe();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateServerSide() {
|
||||
|
||||
@@ -232,23 +228,23 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
// Not working if there is no water available.
|
||||
if (resourceTank.getFluidAmount() <= 0)
|
||||
return;
|
||||
|
||||
|
||||
checkRecipe();
|
||||
|
||||
|
||||
if (currentRecipe == null)
|
||||
return;
|
||||
|
||||
|
||||
resourceTank.drain(1, true);
|
||||
burnTime -= speed;
|
||||
productionTime -= speed;
|
||||
|
||||
|
||||
if (productionTime <= 0) {
|
||||
pendingProduct = currentProduct;
|
||||
decrStackSize(SLOT_RESOURCE, 1);
|
||||
resetRecipe();
|
||||
tryAddPending();
|
||||
}
|
||||
|
||||
|
||||
} else if (pendingProduct != null)
|
||||
tryAddPending();
|
||||
// Try to start process
|
||||
@@ -259,33 +255,33 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
// Let's see if we have a valid resource in the working slot
|
||||
if (inventory.getStackInSlot(SLOT_WORKING) == null)
|
||||
return;
|
||||
|
||||
|
||||
if (FuelManager.moistenerResource.containsKey(inventory.getStackInSlot(SLOT_WORKING))) {
|
||||
MoistenerFuel res = FuelManager.moistenerResource.get(inventory.getStackInSlot(SLOT_WORKING));
|
||||
burnTime = totalTime = res.moistenerValue;
|
||||
}
|
||||
} else
|
||||
rotateReservoir();
|
||||
|
||||
|
||||
if (currentRecipe != null)
|
||||
setErrorState(EnumErrorCode.OK);
|
||||
else
|
||||
setErrorState(EnumErrorCode.NORECIPE);
|
||||
}
|
||||
|
||||
|
||||
private boolean tryAddPending() {
|
||||
if (pendingProduct == null)
|
||||
return false;
|
||||
|
||||
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory.tryAddStack(pendingProduct, SLOT_PRODUCT, 1, true)) {
|
||||
pendingProduct = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void checkRecipe() {
|
||||
Recipe sameRec = RecipeManager.findMatchingRecipe(getInternalInventory().getStackInSlot(SLOT_RESOURCE));
|
||||
if (currentRecipe != sameRec) {
|
||||
@@ -293,7 +289,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
resetRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void resetRecipe() {
|
||||
if (currentRecipe == null) {
|
||||
currentProduct = null;
|
||||
@@ -302,15 +298,15 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
setErrorState(EnumErrorCode.NORECIPE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
currentProduct = currentRecipe.product;
|
||||
productionTime = currentRecipe.timePerItem;
|
||||
timePerItem = currentRecipe.timePerItem;
|
||||
}
|
||||
|
||||
|
||||
private int getFreeSlot(ItemStack deposit, int startSlot, int endSlot, boolean emptyOnly) {
|
||||
int slot = -1;
|
||||
|
||||
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
for (int i = startSlot; i < endSlot; i++) {
|
||||
ItemStack slotStack = inventory.getStackInSlot(i);
|
||||
@@ -320,54 +316,54 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
slot = i;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (emptyOnly)
|
||||
continue;
|
||||
|
||||
// Wrong item or full
|
||||
if (!slotStack.isItemEqual(deposit) || slotStack.stackSize >= slotStack.getMaxStackSize())
|
||||
continue;
|
||||
|
||||
|
||||
slot = i;
|
||||
}
|
||||
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
|
||||
private int getFreeStashSlot(ItemStack deposit, boolean emptyOnly) {
|
||||
return getFreeSlot(deposit, 0, SLOT_RESERVOIR_1, emptyOnly);
|
||||
}
|
||||
|
||||
|
||||
private int getFreeReservoirSlot(ItemStack deposit) {
|
||||
return getFreeSlot(deposit, SLOT_RESERVOIR_1, SLOT_RESERVOIR_1 + SLOTS_COUNT_RESERVOIR, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private int getNextResourceSlot(int startSlot, int endSlot) {
|
||||
// Let's look for a new resource to put into the working slot.
|
||||
int stage = -1;
|
||||
int resourceSlot = -1;
|
||||
|
||||
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
for (int i = startSlot; i < endSlot; i++) {
|
||||
ItemStack slotStack = inventory.getStackInSlot(i);
|
||||
if (slotStack == null)
|
||||
continue;
|
||||
|
||||
|
||||
if (!FuelManager.moistenerResource.containsKey(slotStack))
|
||||
continue;
|
||||
|
||||
|
||||
MoistenerFuel res = FuelManager.moistenerResource.get(slotStack);
|
||||
if (stage < 0 || res.stage < stage) {
|
||||
stage = res.stage;
|
||||
resourceSlot = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return resourceSlot;
|
||||
}
|
||||
|
||||
private boolean rotateWorkingSlot() {
|
||||
|
||||
private boolean rotateWorkingSlot() {
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
// Put working slot contents into inventory if space is available
|
||||
if (inventory.getStackInSlot(SLOT_WORKING) != null) {
|
||||
@@ -378,20 +374,20 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
deposit = res.product.copy();
|
||||
} else
|
||||
deposit = inventory.getStackInSlot(SLOT_WORKING).copy();
|
||||
|
||||
|
||||
int targetSlot = getFreeReservoirSlot(deposit);
|
||||
// We stop the whole thing, if we don't have any room anymore.
|
||||
if (targetSlot < 0)
|
||||
return false;
|
||||
|
||||
|
||||
if (inventory.getStackInSlot(targetSlot) == null)
|
||||
inventory.setInventorySlotContents(targetSlot, deposit);
|
||||
else
|
||||
inventory.getStackInSlot(targetSlot).stackSize++;
|
||||
|
||||
|
||||
decrStackSize(SLOT_WORKING, 1);
|
||||
}
|
||||
|
||||
|
||||
if (inventory.getStackInSlot(SLOT_WORKING) != null)
|
||||
return true;
|
||||
|
||||
@@ -400,20 +396,20 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
// Nothing found, stop.
|
||||
if (resourceSlot < 0)
|
||||
return false;
|
||||
|
||||
|
||||
inventory.setInventorySlotContents(SLOT_WORKING, inventory.decrStackSize(resourceSlot, 1));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void rotateReservoir() {
|
||||
ArrayList<Integer> slotsToShift = new ArrayList<Integer>();
|
||||
|
||||
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
|
||||
|
||||
for (int i = SLOT_RESERVOIR_1; i < SLOT_RESERVOIR_1 + SLOTS_COUNT_RESERVOIR; i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
continue;
|
||||
|
||||
|
||||
if (!FuelManager.moistenerResource.containsKey(inventory.getStackInSlot(i)))
|
||||
slotsToShift.add(i);
|
||||
}
|
||||
@@ -425,7 +421,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
int targetSlot = getFreeStashSlot(slotStack, true);
|
||||
if (targetSlot < 0)
|
||||
continue;
|
||||
|
||||
|
||||
inventory.setInventorySlotContents(targetSlot, slotStack);
|
||||
inventory.setInventorySlotContents(slot, null);
|
||||
shiftedSlots++;
|
||||
@@ -452,16 +448,16 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isWorking() {
|
||||
return burnTime > 0 && resourceTank.getFluidAmount() > 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasFuelMin(float percentage) {
|
||||
int max = 0;
|
||||
int avail = 0;
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
|
||||
|
||||
for (int i = SLOT_STASH_1; i < SLOT_RESERVOIR_1; i++) {
|
||||
if (inventory.getStackInSlot(i) == null) {
|
||||
max += 64;
|
||||
@@ -475,38 +471,38 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ((float) avail / (float) max) > percentage;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasResourcesMin(float percentage) {
|
||||
TileInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory.getStackInSlot(SLOT_RESOURCE) == null)
|
||||
return false;
|
||||
|
||||
|
||||
return ((float) inventory.getStackInSlot(SLOT_RESOURCE).stackSize / (float) inventory.getStackInSlot(SLOT_RESOURCE).getMaxStackSize()) > percentage;
|
||||
}
|
||||
|
||||
|
||||
public boolean isProducing() {
|
||||
return productionTime > 0;
|
||||
}
|
||||
|
||||
|
||||
public int getProductionProgressScaled(int i) {
|
||||
if (timePerItem == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
return (productionTime * i) / timePerItem;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getConsumptionProgressScaled(int i) {
|
||||
if (totalTime == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
return (burnTime * i) / totalTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getResourceScaled(int i) {
|
||||
return (resourceTank.getFluidAmount() * i) / Defaults.PROCESSOR_TANK_CAPACITY;
|
||||
}
|
||||
@@ -516,7 +512,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
public EnumTankLevel getPrimaryLevel() {
|
||||
return Utils.rateTankLevel(getResourceScaled(100));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumTankLevel getSecondaryLevel() {
|
||||
return EnumTankLevel.EMPTY;
|
||||
@@ -527,62 +523,62 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
public int getSizeInventory() {
|
||||
return getInternalInventory().getSizeInventory();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return getInternalInventory().getStackInSlot(i);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
return getInternalInventory().decrStackSize(i, j);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
getInternalInventory().setInventorySlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return getInternalInventory().getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return getInternalInventory().getInventoryStackLimit();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
|
||||
|
||||
if (!getInternalInventory().isItemValidForSlot(slotIndex, itemstack))
|
||||
return false;
|
||||
|
||||
|
||||
if (slotIndex == SLOT_RESOURCE)
|
||||
return RecipeManager.isResource(itemstack);
|
||||
|
||||
|
||||
if (slotIndex >= SLOT_STASH_1 && slotIndex < SLOT_STASH_1 + SLOTS_COUNT_STASH - 2)
|
||||
return FuelManager.moistenerResource.containsKey(itemstack);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -592,21 +588,21 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
if (!getInternalInventory().canExtractItem(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
|
||||
if (slotIndex == SLOT_PRODUCT)
|
||||
return true;
|
||||
|
||||
|
||||
if (slotIndex >= SLOT_STASH_1 && slotIndex < SLOT_STASH_1 + SLOTS_COUNT_STASH)
|
||||
return !FuelManager.moistenerResource.containsKey(itemstack);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return getInternalInventory().getAccessibleSlotsFromSide(side);
|
||||
@@ -617,32 +613,32 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TankManager getTankManager() {
|
||||
return tankManager;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
return tankManager.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
return tankManager.canFill(from, fluid);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return tankManager.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
@@ -652,7 +648,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
@Override
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
i -= tankManager.maxMessageId() + 1;
|
||||
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
burnTime = j;
|
||||
@@ -668,7 +664,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
int i = tankManager.maxMessageId() + 1;
|
||||
@@ -677,5 +673,5 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
|
||||
iCrafting.sendProgressBarUpdate(container, i + 2, productionTime);
|
||||
iCrafting.sendProgressBarUpdate(container, i + 3, timePerItem);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,6 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gadgets;
|
||||
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -17,36 +32,18 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.Fluids;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class MachineRaintank extends TileBase implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
/* CONSTANTS */
|
||||
public static final short SLOT_RESOURCE = 0;
|
||||
public static final short SLOT_PRODUCT = 1;
|
||||
private static final FluidStack STACK_WATER = FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, Defaults.RAINTANK_AMOUNT_PER_UPDATE);
|
||||
private static final FluidStack STACK_WATER = Fluids.WATER.get(Defaults.RAINTANK_AMOUNT_PER_UPDATE);
|
||||
|
||||
/* MEMBER */
|
||||
public FilteredTank resourceTank;
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
package forestry.factory.gadgets;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
import forestry.api.recipes.ISqueezerManager;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
@@ -23,14 +22,18 @@ import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -43,13 +46,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
public class MachineSqueezer extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
/* CONSTANTS */
|
||||
@@ -134,7 +130,6 @@ public class MachineSqueezer extends TilePowered implements ISidedInventory, ILi
|
||||
|
||||
/* MEMBER */
|
||||
private final TankManager tankManager;
|
||||
@EntityNetData
|
||||
public final FilteredTank productTank;
|
||||
|
||||
private Recipe currentRecipe;
|
||||
@@ -455,7 +450,7 @@ public class MachineSqueezer extends TilePowered implements ISidedInventory, ILi
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
if(!getInternalInventory().isItemValidForSlot(slotIndex, itemstack))
|
||||
if (!getInternalInventory().isItemValidForSlot(slotIndex, itemstack))
|
||||
return false;
|
||||
|
||||
if (slotIndex == SLOT_CAN_INPUT)
|
||||
|
||||
@@ -10,25 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gadgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.IStillManager;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
@@ -39,10 +23,23 @@ import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
public class MachineStill extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
@@ -118,9 +115,7 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui
|
||||
}
|
||||
|
||||
/* MEMBER */
|
||||
@EntityNetData
|
||||
public final FilteredTank resourceTank;
|
||||
@EntityNetData
|
||||
public final FilteredTank productTank;
|
||||
private final TankManager tankManager;
|
||||
|
||||
@@ -131,7 +126,7 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui
|
||||
|
||||
public MachineStill() {
|
||||
super(1100, 50, 8000);
|
||||
setInternalInventory(new TileInventoryAdapter(this,3, "Items"));
|
||||
setInternalInventory(new TileInventoryAdapter(this, 3, "Items"));
|
||||
setHints(Config.hints.get("still"));
|
||||
resourceTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, RecipeManager.recipeFluidInputs);
|
||||
resourceTank.tankMode = StandardTank.TankMode.INPUT;
|
||||
@@ -381,7 +376,7 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* ISIDEDINVENTORY */
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.factory.recipes;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.core.gui.ContainerDummy;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.PlainInventory;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
@@ -35,7 +35,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.farming.ICrop;
|
||||
@@ -48,6 +48,7 @@ import forestry.core.GameMode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.interfaces.IClimatised;
|
||||
@@ -434,7 +435,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable
|
||||
else
|
||||
hasFertilizer = true;
|
||||
|
||||
FluidStack liquid = FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, logic.getWaterConsumption(getHydrationModifier()));
|
||||
FluidStack liquid = Fluids.WATER.get(logic.getWaterConsumption(getHydrationModifier()));
|
||||
if (liquid.amount > 0 && !hasLiquid(liquid))
|
||||
continue;
|
||||
else
|
||||
@@ -557,7 +558,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable
|
||||
}
|
||||
|
||||
// Check water
|
||||
FluidStack liquid = FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, provider.getWaterConsumption(getHydrationModifier()));
|
||||
FluidStack liquid = Fluids.WATER.get(provider.getWaterConsumption(getHydrationModifier()));
|
||||
if (liquid.amount > 0 && !hasLiquid(liquid)) {
|
||||
setErrorState(EnumErrorCode.NOLIQUID);
|
||||
return false;
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.farming.gadgets;
|
||||
|
||||
import forestry.api.core.ITileStructure;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.interfaces.IPowerHandler;
|
||||
import forestry.energy.EnergyManager;
|
||||
|
||||
@@ -10,31 +10,30 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.core.utils.Vect;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.core.utils.Vect;
|
||||
|
||||
public abstract class FarmLogicWatered extends FarmLogic {
|
||||
|
||||
protected ItemStack ground;
|
||||
private final ItemStack[] resource;
|
||||
|
||||
private static final FluidStack STACK_WATER = new FluidStack(FluidRegistry.getFluid(Defaults.LIQUID_WATER), 1000);
|
||||
private static final FluidStack STACK_WATER = Fluids.WATER.get(1000);
|
||||
|
||||
ArrayList<ItemStack> produce = new ArrayList<ItemStack>();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import forestry.core.inventory.AlyzerInventory;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
|
||||
@@ -10,24 +10,25 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.api.mail.EnumAddressee;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.api.mail.EnumAddressee;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
|
||||
public class MailAddress implements INBTTagable, IMailAddress {
|
||||
|
||||
private static final GameProfile invalidGameProfile = new GameProfile(new UUID(0, 0), "");
|
||||
@EntityNetData
|
||||
|
||||
private EnumAddressee type;
|
||||
@EntityNetData
|
||||
private GameProfile gameProfile; // gameProfile is a fake GameProfile for traders, and real for players
|
||||
|
||||
public MailAddress() {
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -163,11 +164,26 @@ public class PostRegistry implements IPostRegistry {
|
||||
return new MailAddress(gameProfile);
|
||||
}
|
||||
|
||||
public IMailAddress getValidMailAddress(World world, GameProfile gameProfile) {
|
||||
IMailAddress address = new MailAddress(gameProfile);;
|
||||
if (getPOBox(world, address) != null)
|
||||
return address;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMailAddress getMailAddress(String traderName) {
|
||||
return new MailAddress(traderName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMailAddress getValidMailAddress(World world, String traderName) {
|
||||
IMailAddress address = new MailAddress(traderName);
|
||||
if (getTradeStation(world, address) != null)
|
||||
return address;
|
||||
return null;
|
||||
}
|
||||
|
||||
/* CARRIER */
|
||||
private final HashMap<EnumAddressee, IPostalCarrier> carriers = new HashMap<EnumAddressee, IPostalCarrier>();
|
||||
|
||||
|
||||
@@ -16,19 +16,20 @@ import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.IStamps;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.mail.MailAddress;
|
||||
import forestry.mail.TradeStation;
|
||||
import forestry.plugins.PluginMail;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -38,12 +39,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class MachineTrader extends TileBase implements ISidedInventory {
|
||||
|
||||
@EntityNetData
|
||||
private MailAddress address;
|
||||
|
||||
public MachineTrader() {
|
||||
|
||||
@@ -156,14 +156,14 @@ public class ContainerLetter extends ContainerItemInventory {
|
||||
String typeName = packet.payload.stringPayload[1];
|
||||
|
||||
EnumAddressee type = EnumAddressee.fromString(typeName);
|
||||
IMailAddress recipient;
|
||||
IMailAddress recipient = null;
|
||||
if (type == EnumAddressee.PLAYER) {
|
||||
GameProfile gameProfile = MinecraftServer.getServer().func_152358_ax().func_152655_a(recipientName);
|
||||
if (gameProfile == null)
|
||||
gameProfile = new GameProfile(new UUID(0, 0), recipientName);
|
||||
recipient = PostManager.postRegistry.getMailAddress(gameProfile);
|
||||
recipient = PostManager.postRegistry.getValidMailAddress(player.worldObj, gameProfile);
|
||||
} else if (type == EnumAddressee.TRADER) {
|
||||
recipient = PostManager.postRegistry.getMailAddress(recipientName);
|
||||
recipient = PostManager.postRegistry.getValidMailAddress(player.worldObj, recipientName);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -171,7 +171,8 @@ public class ContainerLetter extends ContainerItemInventory {
|
||||
getLetter().setRecipient(recipient);
|
||||
|
||||
// Update the trading info
|
||||
updateTradeInfo(player.worldObj, recipient);
|
||||
if (recipient == null || recipient.isTrader())
|
||||
updateTradeInfo(player.worldObj, recipient);
|
||||
|
||||
// Update info on client
|
||||
Proxies.net.sendToPlayer(new PacketLetterInfo(PacketIds.LETTER_INFO, type, tradeInfo, recipient), player);
|
||||
@@ -210,12 +211,16 @@ public class ContainerLetter extends ContainerItemInventory {
|
||||
if (!Proxies.common.isSimulating(world))
|
||||
return;
|
||||
|
||||
if (address.isPlayer())
|
||||
if (address == null) {
|
||||
setTradeInfo(null);
|
||||
return;
|
||||
}
|
||||
|
||||
ITradeStation station = PostManager.postRegistry.getTradeStation(world, address);
|
||||
if (station == null)
|
||||
if (station == null) {
|
||||
setTradeInfo(null);
|
||||
return;
|
||||
}
|
||||
|
||||
setTradeInfo(station.getTradeInfo());
|
||||
}
|
||||
@@ -235,5 +240,9 @@ public class ContainerLetter extends ContainerItemInventory {
|
||||
|
||||
private void setTradeInfo(TradeStationInfo info) {
|
||||
this.tradeInfo = info;
|
||||
if (tradeInfo == null)
|
||||
getLetter().setRecipient(null);
|
||||
else
|
||||
getLetter().setRecipient(tradeInfo.address);
|
||||
}
|
||||
}
|
||||
@@ -50,13 +50,13 @@ public class ContainerTradeName extends ContainerForestry {
|
||||
PacketUpdate packet = new PacketUpdate(PacketIds.TRADING_ADDRESS_SET, payload);
|
||||
Proxies.net.sendToServer(packet);
|
||||
|
||||
IMailAddress address = PostManager.postRegistry.getMailAddress(addressName);
|
||||
IMailAddress address = PostManager.postRegistry.getValidMailAddress(machine.getWorld(), addressName);
|
||||
machine.setAddress(address);
|
||||
}
|
||||
|
||||
public void handleSetAddress(PacketUpdate packet) {
|
||||
String addressName = packet.payload.stringPayload[0];
|
||||
IMailAddress address = PostManager.postRegistry.getMailAddress(addressName);
|
||||
IMailAddress address = PostManager.postRegistry.getValidMailAddress(machine.getWorld(), addressName);
|
||||
machine.setAddress(address);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,6 +154,9 @@ public class GuiLetter extends GuiForestry<TileForestry> {
|
||||
if(!isProcessedLetter && !checkedSessionVars) {
|
||||
checkedSessionVars = true;
|
||||
setFromSessionVars();
|
||||
String recipient = this.address.getText();
|
||||
EnumAddressee recipientType = container.getCarrierType();
|
||||
setRecipient(recipient, recipientType);
|
||||
}
|
||||
|
||||
// Check for focus changes
|
||||
@@ -247,7 +250,7 @@ public class GuiLetter extends GuiForestry<TileForestry> {
|
||||
address.setText(recipient);
|
||||
|
||||
EnumAddressee type = EnumAddressee.fromString(typeName);
|
||||
setRecipient(recipient, type);
|
||||
container.setCarrierType(type);
|
||||
}
|
||||
|
||||
SessionVars.clearStringVar("mail.letter.recipient");
|
||||
|
||||
@@ -25,7 +25,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.mail.ILetter;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.interfaces.IHintSource;
|
||||
|
||||
@@ -30,7 +30,6 @@ import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@@ -73,7 +72,7 @@ import forestry.apiculture.GuiHandlerApiculture;
|
||||
import forestry.apiculture.PacketHandlerApiculture;
|
||||
import forestry.apiculture.SaveEventHandlerApiculture;
|
||||
import forestry.apiculture.VillageHandlerApiculture;
|
||||
import forestry.apiculture.commands.CommandBeekeeping;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
import forestry.apiculture.gadgets.BlockAlveary;
|
||||
import forestry.apiculture.gadgets.BlockBeehives;
|
||||
import forestry.apiculture.gadgets.BlockCandle;
|
||||
@@ -145,6 +144,7 @@ import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.Property;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.MachineDefinition;
|
||||
import forestry.core.gadgets.TileAnalyzer;
|
||||
@@ -268,8 +268,15 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
// Register village components with the Structure registry.
|
||||
VillageHandlerApiculture.registerVillageComponents();
|
||||
|
||||
// Modes
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.easy);
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.normal);
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.hard);
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.hardcore);
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.insane);
|
||||
|
||||
// Commands
|
||||
PluginCore.rootCommand.addChildCommand(new CommandBeekeeping());
|
||||
PluginCore.rootCommand.addChildCommand(new CommandBee());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,12 +312,6 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
createMutations();
|
||||
registerBeehiveDrops();
|
||||
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.easy);
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.normal);
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.hard);
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.hardcore);
|
||||
PluginApiculture.beeInterface.registerBeekeepingMode(BeekeepingMode.insane);
|
||||
|
||||
// Inducers for swarmer
|
||||
BeeManager.inducers.put(ForestryItem.royalJelly.getItemStack(), 10);
|
||||
|
||||
@@ -471,36 +472,6 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
// / HABITAT LOCATOR
|
||||
//Proxies.common.addRecipe(ForestryItem.biomeFinder.getItemStack(),
|
||||
// new Object[] { " X ", "X#X", " X ", '#', Items.redstone, 'X', "ingotBronze" });
|
||||
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(3),
|
||||
"###", "YXY",
|
||||
'#', ForestryItem.waxCapsule,
|
||||
'X', Items.bone,
|
||||
'Y', ForestryItem.pollenCluster);
|
||||
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(3),
|
||||
"###", "YXY",
|
||||
'#', ForestryItem.canEmpty,
|
||||
'X', Items.bone,
|
||||
'Y', ForestryItem.pollenCluster);
|
||||
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(),
|
||||
"###", "YXY", "###",
|
||||
'#', ForestryItem.honeyDrop,
|
||||
'Y', ForestryItem.fertilizerCompound,
|
||||
'X', ForestryItem.waxCapsule);
|
||||
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(),
|
||||
"###", "YXY", "###",
|
||||
'#', ForestryItem.honeyDrop,
|
||||
'Y', ForestryItem.fertilizerCompound,
|
||||
'X', ForestryItem.canEmpty);
|
||||
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(),
|
||||
"###", "YXY", "###",
|
||||
'#', ForestryItem.honeyDrop,
|
||||
'Y', ForestryItem.pollenCluster,
|
||||
'X', ForestryItem.waxCapsule);
|
||||
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(),
|
||||
"###", "YXY", "###",
|
||||
'#', ForestryItem.honeyDrop,
|
||||
'Y', ForestryItem.pollenCluster,
|
||||
'X', ForestryItem.canEmpty);
|
||||
|
||||
// Bees
|
||||
Proxies.common.addRecipe(ForestryItem.scoop.getItemStack(1),
|
||||
@@ -563,13 +534,13 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'#', ForestryItem.propolis.getItemStack(1, 2));
|
||||
|
||||
// / CANDLES
|
||||
RecipeManagers.carpenterManager.addRecipe(30, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 600), null, ForestryBlock.candle.getItemStack(24),
|
||||
RecipeManagers.carpenterManager.addRecipe(30, Fluids.WATER.get(600), null, ForestryBlock.candle.getItemStack(24),
|
||||
" X ",
|
||||
"###",
|
||||
"###",
|
||||
'#', ForestryItem.beeswax,
|
||||
'X', Items.string);
|
||||
RecipeManagers.carpenterManager.addRecipe(10, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 200), null, ForestryBlock.candle.getItemStack(6),
|
||||
RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.get(200), null, ForestryBlock.candle.getItemStack(6),
|
||||
"#X#",
|
||||
'#', ForestryItem.beeswax,
|
||||
'X', ForestryItem.craftingMaterial.getItemStack(1, 2));
|
||||
@@ -639,20 +610,20 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'W', ForestryItem.craftingMaterial.getItemStack(1, 3));
|
||||
|
||||
// / SQUEEZER
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.honeyDrop.getItemStack()}, FluidRegistry.getFluidStack(Defaults.LIQUID_HONEY, Defaults.FLUID_PER_HONEY_DROP),
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.honeyDrop.getItemStack()}, Fluids.HONEY.get(Defaults.FLUID_PER_HONEY_DROP),
|
||||
ForestryItem.propolis.getItemStack(), 5);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.honeydew.getItemStack()}, FluidRegistry.getFluidStack(Defaults.LIQUID_HONEY, Defaults.FLUID_PER_HONEY_DROP));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.sand)}, FluidRegistry.getFluidStack(Defaults.LIQUID_LAVA, 2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.dirt)}, FluidRegistry.getFluidStack(Defaults.LIQUID_LAVA, 1600));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.honeydew.getItemStack()}, Fluids.HONEY.get(Defaults.FLUID_PER_HONEY_DROP));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.sand)}, Fluids.LAVA.get(2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.dirt)}, Fluids.LAVA.get(1600));
|
||||
|
||||
// / CARPENTER
|
||||
RecipeManagers.carpenterManager.addRecipe(100, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 2000), null, ForestryItem.beealyzer.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.get(2000), null, ForestryItem.beealyzer.getItemStack(),
|
||||
"X#X", "X#X", "RDR",
|
||||
'#', Blocks.glass_pane,
|
||||
'X', "ingotTin",
|
||||
'R', Items.redstone,
|
||||
'D', Items.diamond);
|
||||
RecipeManagers.carpenterManager.addRecipe(50, FluidRegistry.getFluidStack(Defaults.LIQUID_HONEY, 500), null, ForestryItem.craftingMaterial.getItemStack(1, 6),
|
||||
RecipeManagers.carpenterManager.addRecipe(50, Fluids.HONEY.get(500), null, ForestryItem.craftingMaterial.getItemStack(1, 6),
|
||||
" J ", "###", "WPW",
|
||||
'#', "plankWood",
|
||||
'J', ForestryItem.royalJelly,
|
||||
@@ -707,8 +678,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
ForestryItem.craftingMaterial.getItemStack(1, 2), ForestryItem.propolis.getItemStack()}, new int[]{60, 10});
|
||||
|
||||
// / FERMENTER
|
||||
RecipeManagers.fermenterManager.addRecipe(ForestryItem.honeydew.getItemStack(), 500, 1.0f, FluidRegistry.getFluidStack(Defaults.LIQUID_MEAD, 1),
|
||||
FluidRegistry.getFluidStack(Defaults.LIQUID_HONEY, 1));
|
||||
RecipeManagers.fermenterManager.addRecipe(ForestryItem.honeydew.getItemStack(), 500, 1.0f, Fluids.SHORT_MEAD.get(1), Fluids.HONEY.get(1));
|
||||
|
||||
// ANALYZER
|
||||
definitionAnalyzer.recipes = createAlyzerRecipes(ForestryBlock.core.block(), Defaults.DEFINITION_ANALYZER_META);
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,7 +24,6 @@ import net.minecraft.util.WeightedRandomChestContent;
|
||||
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
@@ -47,9 +45,6 @@ import forestry.api.genetics.IClassification.EnumClassLevel;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.arboriculture.CommandSpawnForest;
|
||||
import forestry.arboriculture.CommandSpawnTree;
|
||||
import forestry.arboriculture.CommandTreekeepingMode;
|
||||
import forestry.arboriculture.EventHandlerArboriculture;
|
||||
import forestry.arboriculture.FruitProviderNone;
|
||||
import forestry.arboriculture.FruitProviderPod;
|
||||
@@ -60,6 +55,7 @@ import forestry.arboriculture.GuiHandlerArboriculture;
|
||||
import forestry.arboriculture.PacketHandlerArboriculture;
|
||||
import forestry.arboriculture.VillageHandlerArboriculture;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.commands.CommandTree;
|
||||
import forestry.arboriculture.gadgets.BlockArbFence;
|
||||
import forestry.arboriculture.gadgets.BlockArbFence.FenceCat;
|
||||
import forestry.arboriculture.gadgets.BlockArbStairs;
|
||||
@@ -133,6 +129,7 @@ import forestry.core.GameMode;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.MachineDefinition;
|
||||
import forestry.core.genetics.Allele;
|
||||
@@ -296,6 +293,15 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
validFences.add(Blocks.fence_gate);
|
||||
validFences.add(Blocks.nether_brick_fence);
|
||||
|
||||
// Modes
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.easy);
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.normal);
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.hard);
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.hardcore);
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.insane);
|
||||
|
||||
// Commands
|
||||
PluginCore.rootCommand.addChildCommand(new CommandTree());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -312,12 +318,6 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
registerTemplates();
|
||||
registerErsatzGenomes();
|
||||
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.easy);
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.normal);
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.hard);
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.hardcore);
|
||||
PluginArboriculture.treeInterface.registerTreekeepingMode(TreekeepingMode.insane);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandlerArboriculture());
|
||||
|
||||
VillagerRegistry.instance().registerVillagerId(Defaults.ID_VILLAGER_LUMBERJACK);
|
||||
@@ -412,7 +412,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
|
||||
ItemStack logStack = forestryBlock.getItemStack(1, i);
|
||||
ItemStack fireproofLogStack = fireproofLog.getItemStack(1, i);
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), fireproofLogStack, new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), fireproofLogStack, new Object[]{
|
||||
" # ",
|
||||
"#X#",
|
||||
" # ",
|
||||
@@ -427,7 +427,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
ForestryBlock fireproofPlank = BlockFireproofPlanks.getFireproofPlanks((BlockPlanks)plank.block());
|
||||
ItemStack plankStack = plank.getItemStack(1, i);
|
||||
ItemStack fireproofPlankStack = fireproofPlank.getItemStack(5, i);
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), fireproofPlankStack, new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), fireproofPlankStack, new Object[]{
|
||||
"X#X",
|
||||
"#X#",
|
||||
"X#X",
|
||||
@@ -439,7 +439,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
ForestryBlock fireproofPlank = BlockFireproofPlanks.getFireproofPlanks((BlockPlanks)plank.block());
|
||||
ItemStack plankStack = plank.getItemStack(1, i);
|
||||
ItemStack fireproofPlankStack = fireproofPlank.getItemStack(5, i);
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), fireproofPlankStack, new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), fireproofPlankStack, new Object[]{
|
||||
"X#X",
|
||||
"#X#",
|
||||
"X#X",
|
||||
@@ -477,22 +477,25 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
Proxies.common.addRecipe(ForestryBlock.fences2.getItemStack(4, i), "###", "# #", '#', ForestryBlock.planks2.getItemStack(1, i));
|
||||
|
||||
// Treealyzer
|
||||
RecipeManagers.carpenterManager.addRecipe(100, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 2000), null, ForestryItem.treealyzer.getItemStack(), "X#X", "X#X", "RDR",
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.get(2000), null, ForestryItem.treealyzer.getItemStack(), "X#X", "X#X", "RDR",
|
||||
'#', Blocks.glass_pane,
|
||||
'X', "ingotCopper",
|
||||
'R', Items.redstone,
|
||||
'D', Items.diamond);
|
||||
|
||||
// SQUEEZER RECIPES
|
||||
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.CHERRY.ordinal())}, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, 5 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 5);
|
||||
RecipeManagers.squeezerManager.addRecipe(60, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.WALNUT.ordinal())}, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, 18 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 5);
|
||||
RecipeManagers.squeezerManager.addRecipe(70, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.CHESTNUT.ordinal())}, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, 22 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 2);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.LEMON.ordinal())}, FluidRegistry.getFluidStack(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 2), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 0.5f));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.PLUM.ordinal())}, FluidRegistry.getFluidStack(Defaults.LIQUID_JUICE, (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 0.5f)), ForestryItem.mulch.getItemStack(), GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 3);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.PAPAYA.ordinal())}, FluidRegistry.getFluidStack(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 3), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 0.5f));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.DATES.ordinal())}, FluidRegistry.getFluidStack(Defaults.LIQUID_JUICE, (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 0.25)), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple")));
|
||||
int seedOilMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed");
|
||||
int juiceMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple");
|
||||
int mulchMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple");
|
||||
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{EnumFruit.CHERRY.getStack()}, Fluids.SEEDOIL.get(5 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 5);
|
||||
RecipeManagers.squeezerManager.addRecipe(60, new ItemStack[]{EnumFruit.WALNUT.getStack()}, Fluids.SEEDOIL.get(18 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 5);
|
||||
RecipeManagers.squeezerManager.addRecipe(70, new ItemStack[]{EnumFruit.CHESTNUT.getStack()}, Fluids.SEEDOIL.get(22 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 2);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{EnumFruit.LEMON.getStack()}, Fluids.JUICE.get(juiceMultiplier * 2), ForestryItem.mulch.getItemStack(), (int) Math.floor(mulchMultiplier * 0.5f));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{EnumFruit.PLUM.getStack()}, Fluids.JUICE.get((int) Math.floor(juiceMultiplier * 0.5f)), ForestryItem.mulch.getItemStack(), mulchMultiplier * 3);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{EnumFruit.PAPAYA.getStack()}, Fluids.JUICE.get(juiceMultiplier * 3), ForestryItem.mulch.getItemStack(), (int) Math.floor(mulchMultiplier * 0.5f));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{EnumFruit.DATES.getStack()}, Fluids.JUICE.get((int) Math.floor(juiceMultiplier * 0.25)), ForestryItem.mulch.getItemStack(), mulchMultiplier);
|
||||
|
||||
RecipeUtil.injectLeveledRecipe(ForestryItem.sapling.getItemStack(), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(ForestryItem.sapling.getItemStack(), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
|
||||
|
||||
// Stairs
|
||||
for (int i = 0; i < 16; i++) {
|
||||
@@ -918,17 +921,17 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
Allele.fruitApple = new AlleleFruit("fruitApple", new FruitProviderRandom("apple", pomes, new ItemStack(Items.apple), 1.0f).setColour(0xff2e2e).setOverlay("pomes"));
|
||||
Allele.fruitCocoa = new AlleleFruit("fruitCocoa", new FruitProviderPod("cocoa", jungle, EnumPodType.COCOA));
|
||||
// .setColours(0xecdca5, 0xc4d24a), true);
|
||||
Allele.fruitChestnut = new AlleleFruit("fruitChestnut", new FruitProviderRipening("chestnut", nux, ForestryItem.fruits.getItemStack(1, EnumFruit.CHESTNUT.ordinal()), 1.0f).setRipeningPeriod(6).setColours(0x7f333d, 0xc4d24a).setOverlay("nuts"), true);
|
||||
Allele.fruitWalnut = new AlleleFruit("fruitWalnut", new FruitProviderRipening("walnut", nux, ForestryItem.fruits.getItemStack(1, EnumFruit.WALNUT.ordinal()), 1.0f).setRipeningPeriod(8).setColours(0xfba248, 0xc4d24a).setOverlay("nuts"), true);
|
||||
Allele.fruitCherry = new AlleleFruit("fruitCherry", new FruitProviderRipening("cherry", prunes, ForestryItem.fruits.getItemStack(1, EnumFruit.CHERRY.ordinal()), 1.0f).setColours(0xff2e2e, 0xc4d24a).setOverlay("berries"), true);
|
||||
Allele.fruitDates = new AlleleFruit("fruitDates", new FruitProviderPod("dates", jungle, EnumPodType.DATES, ForestryItem.fruits.getItemStack(4, EnumFruit.DATES.ordinal())));
|
||||
Allele.fruitPapaya = new AlleleFruit("fruitPapaya", new FruitProviderPod("papaya", jungle, EnumPodType.PAPAYA, ForestryItem.fruits.getItemStack(1, EnumFruit.PAPAYA.ordinal())));
|
||||
Allele.fruitChestnut = new AlleleFruit("fruitChestnut", new FruitProviderRipening("chestnut", nux, EnumFruit.CHESTNUT.getStack(), 1.0f).setRipeningPeriod(6).setColours(0x7f333d, 0xc4d24a).setOverlay("nuts"), true);
|
||||
Allele.fruitWalnut = new AlleleFruit("fruitWalnut", new FruitProviderRipening("walnut", nux, EnumFruit.WALNUT.getStack(), 1.0f).setRipeningPeriod(8).setColours(0xfba248, 0xc4d24a).setOverlay("nuts"), true);
|
||||
Allele.fruitCherry = new AlleleFruit("fruitCherry", new FruitProviderRipening("cherry", prunes, EnumFruit.CHERRY.getStack(), 1.0f).setColours(0xff2e2e, 0xc4d24a).setOverlay("berries"), true);
|
||||
Allele.fruitDates = new AlleleFruit("fruitDates", new FruitProviderPod("dates", jungle, EnumPodType.DATES, EnumFruit.DATES.getStack(4)));
|
||||
Allele.fruitPapaya = new AlleleFruit("fruitPapaya", new FruitProviderPod("papaya", jungle, EnumPodType.PAPAYA, EnumFruit.PAPAYA.getStack()));
|
||||
// Allele.fruitCoconut = new AlleleFruit("fruitCoconut", new
|
||||
// FruitProviderPod("coconut", jungle, EnumPodType.COCONUT, new
|
||||
// ItemStack[] { new ItemStack(
|
||||
// ForestryItem.fruits, 1, EnumFruit.COCONUT.ordinal()) }));
|
||||
Allele.fruitLemon = new AlleleFruit("fruitLemon", new FruitProviderRipening("lemon", prunes, ForestryItem.fruits.getItemStack(1, EnumFruit.LEMON.ordinal()), 1.0f).setColours(0xeeee00, 0x99ff00).setOverlay("citrus"), true);
|
||||
Allele.fruitPlum = new AlleleFruit("fruitPlum", new FruitProviderRipening("plum", prunes, ForestryItem.fruits.getItemStack(1, EnumFruit.PLUM.ordinal()), 1.0f).setColours(0x663446, 0xeeff1a).setOverlay("plums"), true);
|
||||
Allele.fruitLemon = new AlleleFruit("fruitLemon", new FruitProviderRipening("lemon", prunes, EnumFruit.LEMON.getStack(), 1.0f).setColours(0xeeee00, 0x99ff00).setOverlay("citrus"), true);
|
||||
Allele.fruitPlum = new AlleleFruit("fruitPlum", new FruitProviderRipening("plum", prunes, EnumFruit.PLUM.getStack(), 1.0f).setColours(0x663446, 0xeeff1a).setOverlay("plums"), true);
|
||||
|
||||
// / TREES // GROWTH PROVIDER 1350 - 1399
|
||||
Allele.growthLightlevel = new AlleleGrowth("growthLightlevel", new GrowthProvider());
|
||||
@@ -1098,12 +1101,6 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
return new GuiHandlerArboriculture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICommand[] getConsoleCommands() {
|
||||
return new ICommand[]{new CommandSpawnTree(), new CommandSpawnForest(),
|
||||
new CommandTreekeepingMode()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return new IFuelHandler() {
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
package forestry.plugins;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.core.GameMode;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
|
||||
@@ -39,19 +39,19 @@ public class PluginBuildCraftFuels extends ForestryPlugin {
|
||||
@Optional.Method(modid = "BuildCraftAPI|fuels")
|
||||
@Override
|
||||
public void doInit() {
|
||||
BuildcraftFuelRegistry.coolant.addCoolant(FluidRegistry.getFluid(Defaults.LIQUID_ICE), 10.0f);
|
||||
BuildcraftFuelRegistry.coolant.addCoolant(Fluids.ICE.get(), 10.0f);
|
||||
|
||||
Fluid ethanol = FluidRegistry.getFluidStack(Defaults.LIQUID_ETHANOL, 1).getFluid();
|
||||
Fluid ethanol = Fluids.BIOETHANOL.get();
|
||||
int ethanolPower = 40;
|
||||
int ethanolBurnTime = Math.round(Defaults.ENGINE_CYCLE_DURATION_ETHANOL * GameMode.getGameMode().getFloatSetting("fuel.ethanol.combustion"));
|
||||
BuildcraftFuelRegistry.fuel.addFuel(ethanol, ethanolPower, ethanolBurnTime);
|
||||
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_OIL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleOil.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_FUEL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleFuel.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_OIL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryOil.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_FUEL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryFuel.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_OIL, Defaults.BUCKET_VOLUME, ForestryItem.canOil.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_FUEL, Defaults.BUCKET_VOLUME, ForestryItem.canFuel.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.OIL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleOil.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Fluids.FUEL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleFuel.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.OIL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryOil.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
LiquidHelper.injectRefractoryContainer(Fluids.FUEL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryFuel.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
|
||||
LiquidHelper.injectTinContainer(Fluids.OIL, Defaults.BUCKET_VOLUME, ForestryItem.canOil.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
LiquidHelper.injectTinContainer(Fluids.FUEL, Defaults.BUCKET_VOLUME, ForestryItem.canFuel.getItemStack(), ForestryItem.canEmpty.getItemStack());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,12 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
@@ -37,8 +35,6 @@ public class PluginBuildCraftRecipes extends ForestryPlugin {
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
// Add recipe for ethanol
|
||||
FluidStack input = FluidRegistry.getFluidStack(Defaults.LIQUID_BIOMASS, 4);
|
||||
FluidStack output = FluidRegistry.getFluidStack(Defaults.LIQUID_ETHANOL, 1);
|
||||
BuildcraftRecipeRegistry.refinery.addRecipe("forestry:BiomassToEthanol", input, output, 100, 1);
|
||||
BuildcraftRecipeRegistry.refinery.addRecipe("forestry:BiomassToEthanol", Fluids.BIOMASS.get(4), Fluids.BIOETHANOL.get(1), 100, 1);
|
||||
}
|
||||
}
|
||||
@@ -193,13 +193,6 @@ public class PluginCore extends ForestryPlugin {
|
||||
/* ARMOR */
|
||||
ForestryItem.naturalistHat.registerItem(new ItemArmorNaturalist(0), "naturalistHelmet");
|
||||
|
||||
// / DISCONTINUED
|
||||
// ForestryItem.vialEmpty = (new
|
||||
// ItemForestry(Config.getOrCreateIntProperty("vialEmpty",
|
||||
// Config.CATEGORY_ITEM, Defaults.ID_ITEM_VIAL_EMPTY)))
|
||||
// .setItemName("vialEmpty").setIconIndex(10);
|
||||
ForestryItem.vialCatalyst.registerItem((new ItemForestry()), "vialCatalyst");
|
||||
|
||||
// / PEAT PRODUCTION
|
||||
ForestryItem.peat.registerItem((new ItemForestry()), "peat");
|
||||
OreDictionary.registerOre("brickPeat", ForestryItem.peat.getItemStack());
|
||||
@@ -432,10 +425,6 @@ public class PluginCore extends ForestryPlugin {
|
||||
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', ForestryItem.refractoryWater, 'Y', Blocks.sand);
|
||||
}
|
||||
|
||||
// Vials and catalyst
|
||||
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(3), "###", "YXY", '#', ForestryItem.waxCapsule.item(), 'X', Items.bone, 'Y', ForestryItem.fertilizerCompound);
|
||||
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(3), "###", "YXY", '#', ForestryItem.canEmpty.item(), 'X', Items.bone, 'Y', ForestryItem.fertilizerCompound);
|
||||
|
||||
// Crafting Material
|
||||
Proxies.common.addRecipe(new ItemStack(Items.string), "#", "#", "#", '#', ForestryItem.craftingMaterial.getItemStack(1, 2));
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
@@ -27,6 +28,7 @@ import forestry.core.GameMode;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.MachineDefinition;
|
||||
import forestry.core.gadgets.MachineNBTDefinition;
|
||||
@@ -253,56 +255,58 @@ public class PluginFactory extends ForestryPlugin {
|
||||
protected void registerRecipes() {
|
||||
|
||||
// / FABRICATOR
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 0), new Object[]{
|
||||
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 0), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotCopper"});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 1), new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 1), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotTin"});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 2), new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 2), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotBronze"});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 3), new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 3), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.iron_ingot});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 4), new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 4), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.gold_ingot});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 5), new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 5), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.diamond});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 6), new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 6), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Blocks.obsidian});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 7), new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 7), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.blaze_powder});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 9), new Object[]{
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 9), new Object[]{
|
||||
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.emerald});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 10),
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 10),
|
||||
new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', "gemApatite"});
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 11),
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 11),
|
||||
new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', new ItemStack(Items.dye, 1, 4)});
|
||||
|
||||
String[] dyes = {"dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime",
|
||||
"dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite"};
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled())
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
FluidStack liquidGlass = Fluids.GLASS.get(Defaults.BUCKET_VOLUME);
|
||||
for (int i = 0; i < 16; i++)
|
||||
RecipeManagers.fabricatorManager.addRecipe(ForestryItem.waxCast.getItemStack(1, Defaults.WILDCARD), FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS,
|
||||
Defaults.BUCKET_VOLUME), ForestryBlock.glass.getItemStack(1, 15 - i), new Object[]{"#", "X", '#', dyes[i],
|
||||
'X', ForestryItem.propolis.getItemStack(1, Defaults.WILDCARD)});
|
||||
RecipeManagers.fabricatorManager.addRecipe(ForestryItem.waxCast.getItemStack(1, Defaults.WILDCARD), liquidGlass, ForestryBlock.glass.getItemStack(1, 15 - i), new Object[]{"#", "X", '#', dyes[i],
|
||||
'X', ForestryItem.propolis.getItemStack(1, Defaults.WILDCARD)});
|
||||
}
|
||||
|
||||
// / SQUEEZER
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.apple)}, FluidRegistry.getFluidStack(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple")),
|
||||
ForestryItem.mulch.getItemStack(), GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple"));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.wheat_seeds)}, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, GameMode
|
||||
.getGameMode().getIntegerSetting("squeezer.liquid.seed")));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.pumpkin_seeds)}, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, GameMode
|
||||
.getGameMode().getIntegerSetting("squeezer.liquid.seed")));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.melon_seeds)}, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, GameMode
|
||||
.getGameMode().getIntegerSetting("squeezer.liquid.seed")));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.cobblestone)},
|
||||
FluidRegistry.getFluidStack(Defaults.LIQUID_LAVA, 1600));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.cactus)}, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 500));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.snowball), ForestryItem.craftingMaterial.getItemStack(4, 5)},
|
||||
FluidRegistry.getFluidStack(Defaults.LIQUID_ICE, 4000));
|
||||
int appleMulchAmount = GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple");
|
||||
int appleJuiceAmount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple");
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.apple)}, Fluids.JUICE.get(appleJuiceAmount),
|
||||
ForestryItem.mulch.getItemStack(), appleMulchAmount);
|
||||
|
||||
int seedOilAmount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed");
|
||||
FluidStack seedOil = Fluids.SEEDOIL.get(seedOilAmount);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.wheat_seeds)}, seedOil);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.pumpkin_seeds)}, seedOil);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.melon_seeds)}, seedOil);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.cobblestone)}, Fluids.LAVA.get(1600));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.cactus)}, Fluids.WATER.get(500));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.snowball), ForestryItem.craftingMaterial.getItemStack(4, 5)}, Fluids.ICE.get(4000));
|
||||
|
||||
// STILL
|
||||
RecipeManagers.stillManager.addRecipe(Defaults.STILL_DESTILLATION_DURATION, FluidRegistry.getFluidStack(Defaults.LIQUID_BIOMASS,
|
||||
Defaults.STILL_DESTILLATION_INPUT), FluidRegistry.getFluidStack(Defaults.LIQUID_ETHANOL, Defaults.STILL_DESTILLATION_OUTPUT));
|
||||
RecipeManagers.stillManager.addRecipe(Defaults.STILL_DESTILLATION_DURATION, Fluids.BIOMASS.get(Defaults.STILL_DESTILLATION_INPUT),
|
||||
Fluids.BIOETHANOL.get(Defaults.STILL_DESTILLATION_OUTPUT));
|
||||
|
||||
// MOISTENER
|
||||
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Items.wheat_seeds), new ItemStack(Blocks.mycelium), 5000);
|
||||
@@ -310,29 +314,28 @@ public class PluginFactory extends ForestryPlugin {
|
||||
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stonebrick, 1, 1), 20000);
|
||||
|
||||
// FERMENTER
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, 0), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, 1), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, 2), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, 3), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
|
||||
for (int i = 0; i < 4; i++)
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, i), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
|
||||
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.cactus), GameMode.getGameMode().getIntegerSetting("fermenter.yield.cactus"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Items.wheat), GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Items.reeds), GameMode.getGameMode().getIntegerSetting("fermenter.yield.cane"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.brown_mushroom), GameMode.getGameMode().getIntegerSetting("fermenter.yield.mushroom"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.red_mushroom), GameMode.getGameMode().getIntegerSetting("fermenter.yield.mushroom"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.cactus), GameMode.getGameMode().getIntegerSetting("fermenter.yield.cactus"), Fluids.BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Items.wheat), GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Items.reeds), GameMode.getGameMode().getIntegerSetting("fermenter.yield.cane"), Fluids.BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.brown_mushroom), GameMode.getGameMode().getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.red_mushroom), GameMode.getGameMode().getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS);
|
||||
|
||||
// FABRICATOR
|
||||
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.glass), FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 1000), 1000);
|
||||
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.glass_pane), FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 375), 1000);
|
||||
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.sand), FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 1000), 3000);
|
||||
|
||||
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.glass), Fluids.GLASS.get(1000), 1000);
|
||||
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.glass_pane), Fluids.GLASS.get(375), 1000);
|
||||
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.sand), Fluids.GLASS.get(1000), 3000);
|
||||
|
||||
// / CARPENTER
|
||||
RecipeManagers.carpenterManager.addRecipe(50, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, 250), null, ForestryItem.impregnatedCasing.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(50, Fluids.SEEDOIL.get(250), null, ForestryItem.impregnatedCasing.getItemStack(),
|
||||
"###",
|
||||
"# #",
|
||||
"###",
|
||||
'#', "logWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(50, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, 500), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(50, Fluids.SEEDOIL.get(500), null,
|
||||
ForestryBlock.core.getItemStack(1, Defaults.DEFINITION_ESCRITOIRE_META),
|
||||
"# ",
|
||||
"###",
|
||||
@@ -340,35 +343,35 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'#', "plankWood");
|
||||
|
||||
// RESOURCES
|
||||
RecipeManagers.carpenterManager.addRecipe(10, FluidRegistry.getFluidStack(Defaults.LIQUID_SEEDOIL, 100), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(10, Fluids.SEEDOIL.get(100), null,
|
||||
ForestryItem.stickImpregnated.getItemStack(2),
|
||||
"#",
|
||||
"#",
|
||||
'#', "logWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(5, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 250), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.get(250), null,
|
||||
ForestryItem.woodPulp.getItemStack(4),
|
||||
"#",
|
||||
'#', "logWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(5, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 250), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.get(250), null,
|
||||
new ItemStack(Items.paper, 1),
|
||||
"#",
|
||||
"#",
|
||||
'#', "pulpWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(5, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.get(1000), null,
|
||||
ForestryBlock.soil.getItemStack(9),
|
||||
"###",
|
||||
"#X#",
|
||||
"###",
|
||||
'#', Blocks.dirt,
|
||||
'X', ForestryItem.mulch);
|
||||
RecipeManagers.carpenterManager.addRecipe(5, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.get(1000), null,
|
||||
ForestryBlock.soil.getItemStack(8, 1),
|
||||
"#X#",
|
||||
"XYX", "#X#",
|
||||
'#', Blocks.dirt,
|
||||
'X', Blocks.sand,
|
||||
'Y', ForestryItem.mulch);
|
||||
RecipeManagers.carpenterManager.addRecipe(75, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 5000), null, ForestryItem.hardenedCasing.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(75, Fluids.WATER.get(5000), null, ForestryItem.hardenedCasing.getItemStack(),
|
||||
"# #",
|
||||
" Y ",
|
||||
"# #",
|
||||
@@ -376,21 +379,21 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'Y', ForestryItem.sturdyCasing);
|
||||
|
||||
// / CHIPSETS
|
||||
RecipeManagers.carpenterManager.addRecipe(20, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 0),
|
||||
RecipeManagers.carpenterManager.addRecipe(20, Fluids.WATER.get(1000), null, ForestryItem.circuitboards.getItemStack(1, 0),
|
||||
"R R", "R#R", "R R", '#', "ingotTin", 'R', Items.redstone);
|
||||
RecipeManagers.carpenterManager.addRecipe(40, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 1),
|
||||
RecipeManagers.carpenterManager.addRecipe(40, Fluids.WATER.get(1000), null, ForestryItem.circuitboards.getItemStack(1, 1),
|
||||
"R#R", "R#R", "R#R", '#', "ingotBronze", 'R', Items.redstone);
|
||||
RecipeManagers.carpenterManager.addRecipe(80, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 2),
|
||||
RecipeManagers.carpenterManager.addRecipe(80, Fluids.WATER.get(1000), null, ForestryItem.circuitboards.getItemStack(1, 2),
|
||||
"R#R", "R#R", "R#R", '#', Items.iron_ingot, 'R', Items.redstone);
|
||||
RecipeManagers.carpenterManager.addRecipe(80, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 3),
|
||||
RecipeManagers.carpenterManager.addRecipe(80, Fluids.WATER.get(1000), null, ForestryItem.circuitboards.getItemStack(1, 3),
|
||||
"R#R", "R#R", "R#R", '#', Items.gold_ingot, 'R', Items.redstone);
|
||||
RecipeManagers.carpenterManager.addRecipe(40, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.solderingIron.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(40, Fluids.WATER.get(1000), null, ForestryItem.solderingIron.getItemStack(),
|
||||
" # ", "# #", " B", '#', Items.iron_ingot, 'B', "ingotBronze");
|
||||
// ForestryCore.oreHandler.registerCarpenterRecipe(solderingIron);
|
||||
|
||||
// RAIN SUBSTRATES
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
RecipeManagers.carpenterManager.addRecipe(5, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.iodineCharge.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.get(1000), null, ForestryItem.iodineCharge.getItemStack(),
|
||||
"Z#Z",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -399,7 +402,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'Y', ForestryItem.canEmpty,
|
||||
'Z', ForestryItem.honeyDrop);
|
||||
// ForestryCore.oreHandler.registerCarpenterRecipe(iodineCapsule);
|
||||
RecipeManagers.carpenterManager.addRecipe(5, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.craftingMaterial.getItemStack(1, 4),
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.get(1000), null, ForestryItem.craftingMaterial.getItemStack(1, 4),
|
||||
"Z#Z",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -414,13 +417,13 @@ public class PluginFactory extends ForestryPlugin {
|
||||
RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ender_pearl, 1), " # ", "###", " # ", '#',
|
||||
ForestryItem.craftingMaterial.getItemStack(1, 1));
|
||||
// Woven Silk
|
||||
RecipeManagers.carpenterManager.addRecipe(10, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 500), null, ForestryItem.craftingMaterial.getItemStack(1, 3),
|
||||
RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.get(500), null, ForestryItem.craftingMaterial.getItemStack(1, 3),
|
||||
"###", "###", "###", '#', ForestryItem.craftingMaterial.getItemStack(1, 2));
|
||||
|
||||
// Boxes
|
||||
RecipeManagers.carpenterManager.addRecipe(5, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.carton.getItemStack(2),
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.get(1000), null, ForestryItem.carton.getItemStack(2),
|
||||
" # ", "# #", " # ", '#', "pulpWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(20, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 1000), null, ForestryItem.crate.getItemStack(24),
|
||||
RecipeManagers.carpenterManager.addRecipe(20, Fluids.WATER.get(1000), null, ForestryItem.crate.getItemStack(24),
|
||||
" # ", "# #", " # ", '#', "logWood");
|
||||
|
||||
// Assembly Kits
|
||||
|
||||
@@ -20,6 +20,7 @@ import forestry.api.food.IBeverageEffect;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.core.items.ItemForestryFood;
|
||||
@@ -69,8 +70,8 @@ public class PluginFood extends ForestryPlugin {
|
||||
ItemStack meadBottle = ForestryItem.beverage.getItemStack();
|
||||
((ItemBeverage) ForestryItem.beverage.item()).beverages[0].saveEffects(meadBottle, new IBeverageEffect[] { BeverageEffect.weakAlcoholic });
|
||||
|
||||
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_MEAD);
|
||||
LiquidHelper.injectLiquidContainer(Defaults.LIQUID_MEAD, Defaults.BUCKET_VOLUME, meadBottle, new ItemStack(Items.glass_bottle));
|
||||
Fluids.SHORT_MEAD.register();
|
||||
LiquidHelper.injectLiquidContainer(Fluids.SHORT_MEAD, Defaults.BUCKET_VOLUME, meadBottle, new ItemStack(Items.glass_bottle));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,6 +38,7 @@ import forestry.core.config.Configuration;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.MachineDefinition;
|
||||
import forestry.core.items.ItemCrated;
|
||||
@@ -200,11 +201,11 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
definitionEngineTin.register();
|
||||
definitionGenerator.register();
|
||||
|
||||
FluidStack ethanol = FluidRegistry.getFluidStack(Defaults.LIQUID_ETHANOL, 1);
|
||||
FluidStack ethanol = Fluids.BIOETHANOL.get(1);
|
||||
GeneratorFuel ethanolFuel = new GeneratorFuel(ethanol, (int) (32 * GameMode.getGameMode().getFloatSetting("fuel.ethanol.generator")), 4);
|
||||
FuelManager.generatorFuel.put(ethanol.getFluid(), ethanolFuel);
|
||||
|
||||
FluidStack biomass = FluidRegistry.getFluidStack(Defaults.LIQUID_BIOMASS, 1);
|
||||
FluidStack biomass = Fluids.BIOMASS.get(1);
|
||||
GeneratorFuel biomassFuel = new GeneratorFuel(biomass, (int) (8 * GameMode.getGameMode().getFloatSetting("fuel.biomass.generator")), 1);
|
||||
FuelManager.generatorFuel.put(biomass.getFluid(), biomassFuel);
|
||||
|
||||
@@ -270,14 +271,14 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
|
||||
if (rubber != null) {
|
||||
for (Object rubberOreDict : RecipeUtil.getOreDictRecipeEquivalents(rubber)) {
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 8),
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.get(500), ForestryItem.tubes.getItemStack(4, 8),
|
||||
new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', rubberOreDict});
|
||||
}
|
||||
}
|
||||
|
||||
if (plantBall != null && compressedPlantBall != null) {
|
||||
RecipeUtil.injectLeveledRecipe(plantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 4, Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(compressedPlantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 5, Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(plantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 4, Fluids.BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(compressedPlantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 5, Fluids.BIOMASS);
|
||||
} else {
|
||||
Proxies.log.fine("No IC2 plantballs found.");
|
||||
}
|
||||
@@ -288,7 +289,7 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
Proxies.log.fine("Missing IC2 resin, skipping centrifuge recipe for propolis to resin.");
|
||||
|
||||
if (rubbersapling != null) {
|
||||
RecipeUtil.injectLeveledRecipe(rubbersapling, GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(rubbersapling, GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
|
||||
} else
|
||||
Proxies.log.fine("Missing IC2 rubber sapling, skipping fermenter recipe for converting rubber sapling to biomass.");
|
||||
|
||||
@@ -303,10 +304,10 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
}
|
||||
|
||||
if (lavaCell != null)
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_LAVA, Defaults.BUCKET_VOLUME, lavaCell, emptyCell);
|
||||
LiquidHelper.injectTinContainer(Fluids.LAVA, Defaults.BUCKET_VOLUME, lavaCell, emptyCell);
|
||||
|
||||
if (waterCell != null) {
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, waterCell, emptyCell);
|
||||
LiquidHelper.injectTinContainer(Fluids.WATER, Defaults.BUCKET_VOLUME, waterCell, emptyCell);
|
||||
|
||||
ItemStack bogEarthCan = GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can");
|
||||
if (bogEarthCan.stackSize > 0)
|
||||
|
||||
@@ -18,7 +18,6 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
@@ -39,6 +38,7 @@ import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.Property;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.MachineDefinition;
|
||||
import forestry.core.genetics.Allele;
|
||||
@@ -149,7 +149,7 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
protected void registerRecipes() {
|
||||
CraftingManager.getInstance().getRecipeList().add(new MatingRecipe());
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(100, FluidRegistry.getFluidStack(Defaults.LIQUID_WATER, 2000), null, ForestryItem.flutterlyzer.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.get(2000), null, ForestryItem.flutterlyzer.getItemStack(),
|
||||
"X#X", "X#X", "RDR", '#', Blocks.glass_pane, 'X', "ingotBronze", 'R',
|
||||
Items.redstone, 'D', Items.diamond);
|
||||
}
|
||||
|
||||
Loaded 100 of 107 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user