Port ToMe25's PR for sawing factories (#5383)

* Port remainder of #5327 implementing #5236 sawing factories

* Add missing blockstate files for sawing factories

* Inline helper method

* Revert a bit of minor formatting changes to make dif easier to read

* remove redundant mcmeta for sawing front textures

* de-dupe sawmill factory textures (left+right are the same)
This commit is contained in:
Richard Freimer authored and GitHub committed 2019-04-12 10:22:16 -04:00
1 parent 0eb455b882
commit da71637053
49 files changed
+408 -17

No files matched your search

@@ -1,6 +1,7 @@
package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.Arrays;
import javax.annotation.Nonnull;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
@@ -36,6 +37,7 @@ import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.inputs.InfusionInput;
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
import mekanism.common.recipe.machines.BasicMachineRecipe;
import mekanism.common.recipe.machines.ChanceMachineRecipe;
import mekanism.common.recipe.machines.DoubleMachineRecipe;
import mekanism.common.recipe.machines.MachineRecipe;
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
@@ -358,6 +360,16 @@ public class TileEntityFactory extends TileEntityMachine implements IComputerInt
upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades());
secondaryEnergyPerTick = getSecondaryEnergyPerTick(recipeType);
if (type.getFuelType() == MachineFuelType.CHANCE) {
SideData data = configComponent.getOutputs(TransmissionType.ITEM).get(2);
//Append the "extra" slot to the available slots
data.availableSlots = Arrays.copyOf(data.availableSlots, data.availableSlots.length + 1);
data.availableSlots[data.availableSlots.length - 1] = 4;
ejectorComponent.trackers.put(TransmissionType.ITEM,
Arrays.copyOf(ejectorComponent.trackers.get(TransmissionType.ITEM), data.availableSlots.length));
}
for (Upgrade upgrade : upgradeComponent.getSupportedTypes()) {
recalculateUpgradables(upgrade);
}
@@ -491,10 +503,12 @@ public class TileEntityFactory extends TileEntityMachine implements IComputerInt
return true;
} else if (tier == FactoryTier.ADVANCED && slotID >= 10 && slotID <= 14) {
return true;
} else {
return tier == FactoryTier.ELITE && slotID >= 12 && slotID <= 18;
} else if (tier == FactoryTier.ELITE && slotID >= 12 && slotID <= 18) {
return true;
} else if (recipeType.getFuelType() == MachineFuelType.CHANCE && slotID == 4) {
return true;
}
return false;
}
@Override
@@ -600,6 +614,15 @@ public class TileEntityFactory extends TileEntityMachine implements IComputerInt
cachedRecipe[process] = recipe;
return recipe != null && recipe.canOperate(inventory, inputSlot, 4, outputSlot);
} else if (recipeType.getFuelType() == MachineFuelType.CHANCE) {
if (cachedRecipe[process] instanceof ChanceMachineRecipe && ((ChanceMachineRecipe) cachedRecipe[process])
.inputMatches(inventory, inputSlot)) {
return ((ChanceMachineRecipe) cachedRecipe[process]).canOperate(inventory, inputSlot, outputSlot, 4);
}
ChanceMachineRecipe<?> recipe = recipeType.getChanceRecipe(inventory.get(inputSlot));
cachedRecipe[process] = recipe;
return recipe != null && recipe.canOperate(inventory, inputSlot, outputSlot, 4);
}
if (recipeType == RecipeType.INFUSING) {
@@ -654,6 +677,11 @@ public class TileEntityFactory extends TileEntityMachine implements IComputerInt
DoubleMachineRecipe<?> recipe = (DoubleMachineRecipe<?>) cachedRecipe[process];
recipe.operate(inventory, inputSlot, 4, outputSlot);
} else if (recipeType.getFuelType() == MachineFuelType.CHANCE
&& cachedRecipe[process] instanceof ChanceMachineRecipe) {
ChanceMachineRecipe<?> recipe = (ChanceMachineRecipe<?>) cachedRecipe[process];
recipe.operate(inventory, inputSlot, outputSlot, 4);
} else if (recipeType == RecipeType.INFUSING && cachedRecipe[process] instanceof MetallurgicInfuserRecipe) {
MetallurgicInfuserRecipe recipe = (MetallurgicInfuserRecipe) cachedRecipe[process];