mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27b9b7bc57 | ||
|
|
06b1f9fabf | ||
|
|
b00f92ab76 | ||
|
|
83a41d41d3 | ||
|
|
a47fab4579 | ||
|
|
07389fe1dc | ||
|
|
b276c5bb38 | ||
|
|
b630540a26 |
No files matched your search
@@ -2,4 +2,4 @@ mcversion=1.7.10
|
||||
forgeversion=10.13.3.1370-1.7.10
|
||||
version_major=3
|
||||
version_minor=6
|
||||
version_patch=6
|
||||
version_patch=9
|
||||
@@ -29,7 +29,7 @@ import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.utils.StackUtils;
|
||||
|
||||
@@ -103,36 +103,6 @@ public final class FluidHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot) {
|
||||
processContainers(tank, inv, inputSlot, outputSlot, tank.getFluidType(), true, true);
|
||||
}
|
||||
|
||||
public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) {
|
||||
TankManager tankManger = new TankManager();
|
||||
tankManger.add(tank);
|
||||
processContainers(tankManger, inv, inputSlot, outputSlot, fluidToFill, processFilled, processEmpty);
|
||||
}
|
||||
|
||||
public static void processContainers(TankManager tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) {
|
||||
processContainers(tank, inv, inputSlot, outputSlot, fluidToFill, true, true);
|
||||
}
|
||||
|
||||
public static void processContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
|
||||
if (input == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (processFilled && drainContainers(fluidHandler, inv, inputSlot, outputSlot)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (processEmpty && fluidToFill != null) {
|
||||
fillContainers(fluidHandler, inv, inputSlot, outputSlot, fluidToFill);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean fillContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) {
|
||||
return fillContainers(fluidHandler, inv, inputSlot, outputSlot, fluidToFill, true);
|
||||
}
|
||||
@@ -161,10 +131,10 @@ public final class FluidHelper {
|
||||
}
|
||||
|
||||
public static boolean drainContainers(IFluidHandler fluidHandler, IInventory inv, int slot) {
|
||||
return drainContainers(fluidHandler, inv, slot, slot);
|
||||
return drainContainers(fluidHandler, inv, slot, slot, Defaults.BUCKET_VOLUME);
|
||||
}
|
||||
|
||||
public static boolean drainContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot) {
|
||||
public static boolean drainContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, int maxAmount) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
ItemStack output = inv.getStackInSlot(outputSlot);
|
||||
|
||||
@@ -176,36 +146,39 @@ public final class FluidHelper {
|
||||
if (fluidInContainer == null) {
|
||||
return false;
|
||||
}
|
||||
if (fluidInContainer.amount > maxAmount) {
|
||||
fluidInContainer.amount = maxAmount;
|
||||
}
|
||||
|
||||
int used = fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, false);
|
||||
if (used < fluidInContainer.amount) {
|
||||
|
||||
ItemStack drainedItem = getDrainedContainer(input, used);
|
||||
if (ItemStack.areItemStacksEqual(input, drainedItem)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack emptyItem = getEmptyContainer(input);
|
||||
|
||||
if (output != null && emptyItem != null) {
|
||||
if (output != null && drainedItem != null) {
|
||||
if (outputSlot == inputSlot) {
|
||||
if (input.stackSize > 1) {
|
||||
return false;
|
||||
}
|
||||
} else if (!StackUtils.isIdenticalItem(output, emptyItem)) {
|
||||
} else if (!StackUtils.isIdenticalItem(output, drainedItem)) {
|
||||
return false;
|
||||
} else if (output.stackSize + emptyItem.stackSize > output.getMaxStackSize()) {
|
||||
} else if (output.stackSize + drainedItem.stackSize > output.getMaxStackSize()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
|
||||
if (emptyItem != null) {
|
||||
if (drainedItem != null) {
|
||||
if (outputSlot == inputSlot) {
|
||||
inv.setInventorySlotContents(outputSlot, emptyItem);
|
||||
inv.setInventorySlotContents(outputSlot, drainedItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (output == null) {
|
||||
inv.setInventorySlotContents(outputSlot, emptyItem);
|
||||
inv.setInventorySlotContents(outputSlot, drainedItem);
|
||||
} else {
|
||||
output.stackSize++;
|
||||
}
|
||||
@@ -269,15 +242,6 @@ public final class FluidHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getEmptyContainer(ItemStack container) {
|
||||
Item item = container.getItem();
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return item.getContainerItem(container);
|
||||
}
|
||||
|
||||
public static ItemStack getDrainedContainer(ItemStack container, int drainAmount) {
|
||||
if (container == null) {
|
||||
return null;
|
||||
@@ -288,15 +252,20 @@ public final class FluidHelper {
|
||||
}
|
||||
|
||||
Item item = container.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
} else if (item instanceof IFluidContainerItem) {
|
||||
ItemStack drained = container.copy();
|
||||
drained.stackSize = 1;
|
||||
IFluidContainerItem containerItem = (IFluidContainerItem) item;
|
||||
containerItem.drain(drained, drainAmount, true);
|
||||
return drained;
|
||||
} else {
|
||||
if (drainAmount < Defaults.BUCKET_VOLUME) {
|
||||
return container;
|
||||
}
|
||||
return item.getContainerItem(container);
|
||||
}
|
||||
|
||||
return getEmptyContainer(container);
|
||||
}
|
||||
|
||||
public static ItemStack getFilledContainer(Fluid fluid, ItemStack empty) {
|
||||
|
||||
@@ -1102,12 +1102,14 @@ public abstract class InvTools {
|
||||
}
|
||||
|
||||
public static boolean tryAddStack(IInventory inventory, ItemStack stack, int startSlot, int slots, boolean all, boolean doAdd) {
|
||||
int added = addStack(inventory, stack, startSlot, slots, doAdd);
|
||||
if (all) {
|
||||
return added == stack.stackSize;
|
||||
} else {
|
||||
return added > 0;
|
||||
int added = addStack(inventory, stack, startSlot, slots, false);
|
||||
boolean success = all ? (added == stack.stackSize) : (added > 0);
|
||||
|
||||
if (success && doAdd) {
|
||||
addStack(inventory, stack, startSlot, slots, true);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public static int addStack(IInventory inventory, ItemStack stack, boolean doAdd) {
|
||||
|
||||
@@ -268,6 +268,10 @@ public class StackUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (craftingTools && isCraftingTool(base) && base.getItem() == comparison.getItem()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (base.hasTagCompound() && !base.stackTagCompound.hasNoTags()) {
|
||||
if (!ItemStack.areItemStacksEqual(base, comparison)) {
|
||||
return false;
|
||||
@@ -294,21 +298,22 @@ public class StackUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if (craftingTools) {
|
||||
return isThisCraftingTool(base, comparison);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isCraftingTool(ItemStack itemstack) {
|
||||
return itemstack.getItem().hasContainerItem(itemstack)
|
||||
&& itemstack.getItem().isDamageable()
|
||||
&& !itemstack.getItem().doesContainerItemLeaveCraftingGrid(itemstack);
|
||||
}
|
||||
Item item = itemstack.getItem();
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isThisCraftingTool(ItemStack phantom, ItemStack actual) {
|
||||
return isCraftingTool(phantom) && phantom.getItem() == actual.getItem();
|
||||
if (item.hasContainerItem(itemstack)) {
|
||||
if (item.isDamageable() || itemstack.hasTagCompound()) {
|
||||
return !item.doesContainerItemLeaveCraftingGrid(itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void stowContainerItem(ItemStack itemstack, IInventory stowing, int slotIndex, EntityPlayer player) {
|
||||
|
||||
@@ -68,7 +68,7 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
|
||||
setInternalInventory(new EngineBronzeInventoryAdapter(this));
|
||||
|
||||
fuelTank = new FilteredTank(Defaults.ENGINE_TANK_CAPACITY, FuelManager.bronzeEngineFuel.keySet());
|
||||
fuelTank.tankMode = StandardTank.TankMode.INPUT;
|
||||
fuelTank.tankMode = StandardTank.TankMode.DEFAULT;
|
||||
heatingTank = new FilteredTank(Defaults.ENGINE_TANK_CAPACITY, FluidRegistry.LAVA);
|
||||
heatingTank.tankMode = StandardTank.TankMode.INPUT;
|
||||
this.tankManager = new TankManager(fuelTank, heatingTank);
|
||||
|
||||
@@ -58,6 +58,9 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
for (int i = SLOT_STAMPS_1; i < SLOT_STAMPS_1 + SLOT_STAMPS_COUNT; i++) {
|
||||
slots.add(i);
|
||||
}
|
||||
for (int i = SLOT_RECEIVE_BUFFER; i < SLOT_RECEIVE_BUFFER + SLOT_RECEIVE_BUFFER_COUNT; i++) {
|
||||
slots.add(i);
|
||||
}
|
||||
for (int i = SLOT_SEND_BUFFER; i < SLOT_SEND_BUFFER + SLOT_SEND_BUFFER_COUNT; i++) {
|
||||
slots.add(i);
|
||||
}
|
||||
@@ -95,6 +98,10 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return canSlotAccept(i, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
// / CONSTANTS
|
||||
|
||||
@@ -275,11 +275,11 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
if (plantBall != null && compressedPlantBall != null) {
|
||||
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.");
|
||||
if (plantBall != null) {
|
||||
RecipeUtil.injectLeveledRecipe(plantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 9, Fluids.BIOMASS);
|
||||
}
|
||||
if (compressedPlantBall != null) {
|
||||
RecipeUtil.injectLeveledRecipe(compressedPlantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 9, Fluids.BIOMASS);
|
||||
}
|
||||
|
||||
if (resin != null) {
|
||||
|
||||
Reference in new issue
Block a user