Remove ore dict support. Lots of pain for very little gain.
This commit is contained in:
@@ -23,11 +23,6 @@ public interface ICraftingPattern {
|
|||||||
*/
|
*/
|
||||||
boolean isValid();
|
boolean isValid();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if this crafting pattern cares about the ore dictionary when extracting items, false otherwise
|
|
||||||
*/
|
|
||||||
boolean isOredicted();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the inputs
|
* @return the inputs
|
||||||
*/
|
*/
|
||||||
@@ -38,12 +33,6 @@ public interface ICraftingPattern {
|
|||||||
*/
|
*/
|
||||||
List<ItemStack> getOutputs();
|
List<ItemStack> getOutputs();
|
||||||
|
|
||||||
/**
|
|
||||||
* @param took the items that it already took
|
|
||||||
* @return the outputs
|
|
||||||
*/
|
|
||||||
List<ItemStack> getOutputsBasedOnTook(ItemStack[] took);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the id of the factory that creates a crafting task for this pattern, as defined in the registry
|
* @return the id of the factory that creates a crafting task for this pattern, as defined in the registry
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package refinedstorage.apiimpl.autocrafting;
|
package refinedstorage.apiimpl.autocrafting;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
@@ -83,11 +81,6 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
return !inputs.isEmpty() && !outputs.isEmpty();
|
return !inputs.isEmpty() && !outputs.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOredicted() {
|
|
||||||
return ItemPattern.isOredicted(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getInputs() {
|
public List<ItemStack> getInputs() {
|
||||||
return inputs;
|
return inputs;
|
||||||
@@ -98,43 +91,6 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
return outputs;
|
return outputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ItemStack> getOutputsBasedOnTook(ItemStack[] took) {
|
|
||||||
if (ItemPattern.isProcessing(stack) || !ItemPattern.isOredicted(stack)) {
|
|
||||||
return Lists.newArrayList(Iterables.concat(outputs, byproducts));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ItemStack> outputs = new ArrayList<>();
|
|
||||||
List<ItemStack> byproducts = new ArrayList<>();
|
|
||||||
|
|
||||||
InventoryCrafting inv = new InventoryCrafting(new Container() {
|
|
||||||
@Override
|
|
||||||
public boolean canInteractWith(EntityPlayer player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}, 3, 3);
|
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
|
||||||
if (took[i] != null) {
|
|
||||||
inv.setInventorySlotContents(i, took[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack output = CraftingManager.getInstance().findMatchingRecipe(inv, world);
|
|
||||||
|
|
||||||
if (output != null) {
|
|
||||||
outputs.add(output.copy());
|
|
||||||
|
|
||||||
for (ItemStack remaining : CraftingManager.getInstance().getRemainingItems(inv, world)) {
|
|
||||||
if (remaining != null) {
|
|
||||||
byproducts.add(remaining.copy());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Lists.newArrayList(Iterables.concat(outputs, byproducts));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return ItemPattern.isProcessing(stack) ? CraftingTaskFactoryProcessing.ID : CraftingTaskFactoryNormal.ID;
|
return ItemPattern.isProcessing(stack) ? CraftingTaskFactoryProcessing.ID : CraftingTaskFactoryNormal.ID;
|
||||||
|
|||||||
@@ -43,14 +43,6 @@ public class CraftingTaskFactoryNormal implements ICraftingTaskFactory {
|
|||||||
|
|
||||||
task.setTook(took);
|
task.setTook(took);
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
|
||||||
String id = String.format(CraftingTaskNormal.NBT_TOOK_SLOT, i);
|
|
||||||
|
|
||||||
if (tag.hasKey(id)) {
|
|
||||||
task.getTookSlots()[i] = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task.readChildNBT(world, tag);
|
task.readChildNBT(world, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package refinedstorage.apiimpl.autocrafting.task;
|
package refinedstorage.apiimpl.autocrafting.task;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import refinedstorage.api.autocrafting.task.CraftingTask;
|
import refinedstorage.api.autocrafting.task.CraftingTask;
|
||||||
@@ -9,18 +8,10 @@ import refinedstorage.api.network.INetworkMaster;
|
|||||||
import refinedstorage.apiimpl.storage.fluid.FluidUtils;
|
import refinedstorage.apiimpl.storage.fluid.FluidUtils;
|
||||||
|
|
||||||
public class CraftingTaskNormal extends CraftingTask {
|
public class CraftingTaskNormal extends CraftingTask {
|
||||||
public static final String NBT_TOOK_SLOT = "TookSlot_%d";
|
|
||||||
|
|
||||||
private ItemStack[] tookSlots = new ItemStack[9];
|
|
||||||
|
|
||||||
public CraftingTaskNormal(ICraftingPattern pattern) {
|
public CraftingTaskNormal(ICraftingPattern pattern) {
|
||||||
super(pattern);
|
super(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack[] getTookSlots() {
|
|
||||||
return tookSlots;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean update(World world, INetworkMaster network) {
|
public boolean update(World world, INetworkMaster network) {
|
||||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||||
@@ -29,13 +20,12 @@ public class CraftingTaskNormal extends CraftingTask {
|
|||||||
ItemStack input = pattern.getInputs().get(i);
|
ItemStack input = pattern.getInputs().get(i);
|
||||||
|
|
||||||
if (!satisfied[i]) {
|
if (!satisfied[i]) {
|
||||||
ItemStack received = FluidUtils.extractItemOrIfBucketLookInFluids(network, input, input.stackSize, pattern.isOredicted());
|
ItemStack received = FluidUtils.extractItemOrIfBucketLookInFluids(network, input, input.stackSize);
|
||||||
|
|
||||||
if (received != null) {
|
if (received != null) {
|
||||||
satisfied[i] = true;
|
satisfied[i] = true;
|
||||||
|
|
||||||
took.add(received);
|
took.add(received);
|
||||||
tookSlots[i] = received;
|
|
||||||
} else {
|
} else {
|
||||||
tryCreateChild(network, i);
|
tryCreateChild(network, i);
|
||||||
}
|
}
|
||||||
@@ -50,7 +40,7 @@ public class CraftingTaskNormal extends CraftingTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ItemStack output : pattern.getOutputsBasedOnTook(tookSlots)) {
|
for (ItemStack output : pattern.getOutputs()) {
|
||||||
// @TODO: Handle remainder
|
// @TODO: Handle remainder
|
||||||
network.insertItem(output, output.stackSize, false);
|
network.insertItem(output, output.stackSize, false);
|
||||||
}
|
}
|
||||||
@@ -97,19 +87,6 @@ public class CraftingTaskNormal extends CraftingTask {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
|
||||||
super.writeToNBT(tag);
|
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
|
||||||
if (tookSlots[i] != null) {
|
|
||||||
tag.setTag(String.format(NBT_TOOK_SLOT, i), tookSlots[i].serializeNBT());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getProgress() {
|
public int getProgress() {
|
||||||
int satisfiedAmount = 0;
|
int satisfiedAmount = 0;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class CraftingTaskProcessing extends CraftingTask {
|
|||||||
ItemStack input = pattern.getInputs().get(i);
|
ItemStack input = pattern.getInputs().get(i);
|
||||||
|
|
||||||
if (!satisfied[i]) {
|
if (!satisfied[i]) {
|
||||||
ItemStack received = FluidUtils.extractItemOrIfBucketLookInFluids(network, input, input.stackSize, pattern.isOredicted());
|
ItemStack received = FluidUtils.extractItemOrIfBucketLookInFluids(network, input, input.stackSize);
|
||||||
|
|
||||||
if (received != null) {
|
if (received != null) {
|
||||||
satisfied[i] = true;
|
satisfied[i] = true;
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public final class FluidUtils {
|
|||||||
return stack.getFluid() == FluidRegistry.WATER || stack.getFluid() == FluidRegistry.LAVA || FluidRegistry.getBucketFluids().contains(stack.getFluid());
|
return stack.getFluid() == FluidRegistry.WATER || stack.getFluid() == FluidRegistry.LAVA || FluidRegistry.getBucketFluids().contains(stack.getFluid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack extractItemOrIfBucketLookInFluids(INetworkMaster network, ItemStack stack, int size, boolean oredict) {
|
public static ItemStack extractItemOrIfBucketLookInFluids(INetworkMaster network, ItemStack stack, int size) {
|
||||||
ItemStack result = oredict ? NetworkUtils.extractItemOreDict(network, stack, size) : NetworkUtils.extractItem(network, stack, size);
|
ItemStack result = NetworkUtils.extractItem(network, stack, size);
|
||||||
|
|
||||||
if (result == null && stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
|
if (result == null && stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
|
||||||
FluidStack fluidStack = getFluidFromStack(stack, true);
|
FluidStack fluidStack = getFluidFromStack(stack, true);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ContainerProcessingPatternEncoder extends ContainerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addPlayerInventory(8, 102);
|
addPlayerInventory(8, 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,4 +65,4 @@ public class ContainerProcessingPatternEncoder extends ContainerBase {
|
|||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,32 +1,26 @@
|
|||||||
package refinedstorage.gui;
|
package refinedstorage.gui;
|
||||||
|
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
|
||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.container.ContainerProcessingPatternEncoder;
|
import refinedstorage.container.ContainerProcessingPatternEncoder;
|
||||||
import refinedstorage.network.MessageGridPatternCreate;
|
import refinedstorage.network.MessageGridPatternCreate;
|
||||||
import refinedstorage.network.MessageProcessingPatternEncoderClear;
|
import refinedstorage.network.MessageProcessingPatternEncoderClear;
|
||||||
import refinedstorage.tile.TileProcessingPatternEncoder;
|
import refinedstorage.tile.TileProcessingPatternEncoder;
|
||||||
import refinedstorage.tile.data.TileDataManager;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class GuiProcessingPatternEncoder extends GuiBase {
|
public class GuiProcessingPatternEncoder extends GuiBase {
|
||||||
private TileProcessingPatternEncoder processingPatternEncoder;
|
private TileProcessingPatternEncoder processingPatternEncoder;
|
||||||
|
|
||||||
private GuiCheckBox patternOredicted;
|
|
||||||
|
|
||||||
public GuiProcessingPatternEncoder(ContainerProcessingPatternEncoder container, TileProcessingPatternEncoder processingPatternEncoder) {
|
public GuiProcessingPatternEncoder(ContainerProcessingPatternEncoder container, TileProcessingPatternEncoder processingPatternEncoder) {
|
||||||
super(container, 176, 184);
|
super(container, 176, 172);
|
||||||
|
|
||||||
this.processingPatternEncoder = processingPatternEncoder;
|
this.processingPatternEncoder = processingPatternEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y) {
|
public void init(int x, int y) {
|
||||||
patternOredicted = addCheckBox(x + 7, y + 76, t("misc.refinedstorage:use_oredict"), TileProcessingPatternEncoder.PATTERN_OREDICTED.getValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -63,7 +57,7 @@ public class GuiProcessingPatternEncoder extends GuiBase {
|
|||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY) {
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
drawString(7, 7, t("gui.refinedstorage:processing_pattern_encoder"));
|
drawString(7, 7, t("gui.refinedstorage:processing_pattern_encoder"));
|
||||||
drawString(7, 91, t("container.inventory"));
|
drawString(7, 78, t("container.inventory"));
|
||||||
|
|
||||||
if (isOverCreatePattern(mouseX, mouseY)) {
|
if (isOverCreatePattern(mouseX, mouseY)) {
|
||||||
drawTooltip(mouseX, mouseY, t("gui.refinedstorage:processing_pattern_encoder.pattern_create"));
|
drawTooltip(mouseX, mouseY, t("gui.refinedstorage:processing_pattern_encoder.pattern_create"));
|
||||||
@@ -88,19 +82,4 @@ public class GuiProcessingPatternEncoder extends GuiBase {
|
|||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
protected void actionPerformed(GuiButton button) throws IOException {
|
|
||||||
super.actionPerformed(button);
|
|
||||||
|
|
||||||
if (button == patternOredicted) {
|
|
||||||
TileDataManager.setParameter(TileProcessingPatternEncoder.PATTERN_OREDICTED, patternOredicted.isChecked());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updatePatternOredicted(boolean oredicted) {
|
|
||||||
if (patternOredicted != null) {
|
|
||||||
patternOredicted.setIsChecked(oredicted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import com.google.common.collect.ArrayListMultimap;
|
|||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.common.collect.Multimaps;
|
import com.google.common.collect.Multimaps;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
@@ -14,7 +13,6 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.api.network.grid.IItemGridHandler;
|
import refinedstorage.api.network.grid.IItemGridHandler;
|
||||||
@@ -32,7 +30,6 @@ import refinedstorage.gui.sidebutton.*;
|
|||||||
import refinedstorage.integration.jei.IntegrationJEI;
|
import refinedstorage.integration.jei.IntegrationJEI;
|
||||||
import refinedstorage.integration.jei.RefinedStorageJEIPlugin;
|
import refinedstorage.integration.jei.RefinedStorageJEIPlugin;
|
||||||
import refinedstorage.network.*;
|
import refinedstorage.network.*;
|
||||||
import refinedstorage.tile.data.TileDataManager;
|
|
||||||
import refinedstorage.tile.grid.IGrid;
|
import refinedstorage.tile.grid.IGrid;
|
||||||
import refinedstorage.tile.grid.TileGrid;
|
import refinedstorage.tile.grid.TileGrid;
|
||||||
|
|
||||||
@@ -57,8 +54,6 @@ public class GuiGrid extends GuiBase {
|
|||||||
|
|
||||||
private GuiTextField searchField;
|
private GuiTextField searchField;
|
||||||
|
|
||||||
private GuiCheckBox patternOredicted;
|
|
||||||
|
|
||||||
private ContainerGrid container;
|
private ContainerGrid container;
|
||||||
private IGrid grid;
|
private IGrid grid;
|
||||||
|
|
||||||
@@ -99,10 +94,6 @@ public class GuiGrid extends GuiBase {
|
|||||||
searchField.yPosition = sy;
|
searchField.yPosition = sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grid.getType() == EnumGridType.PATTERN) {
|
|
||||||
patternOredicted = addCheckBox(x + 64, y + 138, t("misc.refinedstorage:use_oredict"), TileGrid.PATTERN_OREDICTED.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grid.getType() != EnumGridType.FLUID) {
|
if (grid.getType() != EnumGridType.FLUID) {
|
||||||
addSideButton(new SideButtonGridViewType(grid));
|
addSideButton(new SideButtonGridViewType(grid));
|
||||||
}
|
}
|
||||||
@@ -411,15 +402,6 @@ public class GuiGrid extends GuiBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(GuiButton button) throws IOException {
|
|
||||||
super.actionPerformed(button);
|
|
||||||
|
|
||||||
if (button == patternOredicted) {
|
|
||||||
TileDataManager.setParameter(TileGrid.PATTERN_OREDICTED, patternOredicted.isChecked());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char character, int keyCode) throws IOException {
|
protected void keyTyped(char character, int keyCode) throws IOException {
|
||||||
if (checkHotbarKeys(keyCode)) {
|
if (checkHotbarKeys(keyCode)) {
|
||||||
@@ -445,10 +427,4 @@ public class GuiGrid extends GuiBase {
|
|||||||
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(mode));
|
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(mode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePatternOredicted(boolean oredicted) {
|
|
||||||
if (patternOredicted != null) {
|
|
||||||
patternOredicted.setIsChecked(oredicted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
|
|
||||||
private static final String NBT_SLOT = "Slot_%d";
|
private static final String NBT_SLOT = "Slot_%d";
|
||||||
private static final String NBT_OUTPUTS = "Outputs";
|
private static final String NBT_OUTPUTS = "Outputs";
|
||||||
private static final String NBT_OREDICTED = "Oredicted";
|
|
||||||
|
|
||||||
public ItemPattern() {
|
public ItemPattern() {
|
||||||
super("pattern");
|
super("pattern");
|
||||||
@@ -64,10 +63,6 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
combineItems(tooltip, true, Iterables.toArray(pattern.getOutputs(), ItemStack.class));
|
combineItems(tooltip, true, Iterables.toArray(pattern.getOutputs(), ItemStack.class));
|
||||||
|
|
||||||
if (pattern.isOredicted()) {
|
|
||||||
tooltip.add(TextFormatting.BLUE + I18n.format("misc.refinedstorage:pattern.oredict"));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
tooltip.add(TextFormatting.RED + I18n.format("misc.refinedstorage:pattern.invalid") + TextFormatting.RESET);
|
tooltip.add(TextFormatting.RED + I18n.format("misc.refinedstorage:pattern.invalid") + TextFormatting.RESET);
|
||||||
|
|
||||||
@@ -94,22 +89,6 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOredicted(ItemStack pattern, boolean oredicted) {
|
|
||||||
if (!pattern.hasTagCompound()) {
|
|
||||||
pattern.setTagCompound(new NBTTagCompound());
|
|
||||||
}
|
|
||||||
|
|
||||||
pattern.getTagCompound().setBoolean(NBT_OREDICTED, oredicted);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isOredicted(ItemStack pattern) {
|
|
||||||
if (!pattern.hasTagCompound() || !pattern.getTagCompound().hasKey(NBT_OREDICTED)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pattern.getTagCompound().getBoolean(NBT_OREDICTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setSlot(ItemStack pattern, int slot, ItemStack stack) {
|
public static void setSlot(ItemStack pattern, int slot, ItemStack stack) {
|
||||||
if (!pattern.hasTagCompound()) {
|
if (!pattern.hasTagCompound()) {
|
||||||
pattern.setTagCompound(new NBTTagCompound());
|
pattern.setTagCompound(new NBTTagCompound());
|
||||||
|
|||||||
@@ -63,9 +63,7 @@ public class PatternBakedModel implements IBakedModel {
|
|||||||
CraftingPattern pattern = ItemPattern.getPatternFromCache(world, stack);
|
CraftingPattern pattern = ItemPattern.getPatternFromCache(world, stack);
|
||||||
|
|
||||||
if (GuiBase.isShiftKeyDown() && pattern.isValid() && pattern.getOutputs().size() == 1) {
|
if (GuiBase.isShiftKeyDown() && pattern.isValid() && pattern.getOutputs().size() == 1) {
|
||||||
ItemStack output = pattern.getOutputs().get(0);
|
return Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(pattern.getOutputs().get(0), world, entity);
|
||||||
|
|
||||||
return Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(output, world, entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.handleItemState(originalModel, stack, world, entity);
|
return super.handleItemState(originalModel, stack, world, entity);
|
||||||
|
|||||||
@@ -1,52 +1,21 @@
|
|||||||
package refinedstorage.tile;
|
package refinedstorage.tile;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.datasync.DataSerializers;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
import refinedstorage.RefinedStorageItems;
|
import refinedstorage.RefinedStorageItems;
|
||||||
import refinedstorage.gui.GuiProcessingPatternEncoder;
|
|
||||||
import refinedstorage.inventory.ItemHandlerBasic;
|
import refinedstorage.inventory.ItemHandlerBasic;
|
||||||
import refinedstorage.inventory.ItemValidatorBasic;
|
import refinedstorage.inventory.ItemValidatorBasic;
|
||||||
import refinedstorage.item.ItemPattern;
|
import refinedstorage.item.ItemPattern;
|
||||||
import refinedstorage.tile.data.ITileDataConsumer;
|
|
||||||
import refinedstorage.tile.data.ITileDataProducer;
|
|
||||||
import refinedstorage.tile.data.TileDataParameter;
|
|
||||||
|
|
||||||
public class TileProcessingPatternEncoder extends TileBase {
|
public class TileProcessingPatternEncoder extends TileBase {
|
||||||
public static final TileDataParameter<Boolean> PATTERN_OREDICTED = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileProcessingPatternEncoder>() {
|
|
||||||
@Override
|
|
||||||
public Boolean getValue(TileProcessingPatternEncoder tile) {
|
|
||||||
return tile.patternOredicted;
|
|
||||||
}
|
|
||||||
}, new ITileDataConsumer<Boolean, TileProcessingPatternEncoder>() {
|
|
||||||
@Override
|
|
||||||
public void setValue(TileProcessingPatternEncoder tile, Boolean value) {
|
|
||||||
tile.patternOredicted = value;
|
|
||||||
tile.markDirty();
|
|
||||||
}
|
|
||||||
}, parameter -> {
|
|
||||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiProcessingPatternEncoder) {
|
|
||||||
((GuiProcessingPatternEncoder) Minecraft.getMinecraft().currentScreen).updatePatternOredicted(parameter.getValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
private static final String NBT_PATTERN_OREDICTED = "PatternOredicted";
|
|
||||||
|
|
||||||
private ItemHandlerBasic patterns = new ItemHandlerBasic(2, this, new ItemValidatorBasic(RefinedStorageItems.PATTERN));
|
private ItemHandlerBasic patterns = new ItemHandlerBasic(2, this, new ItemValidatorBasic(RefinedStorageItems.PATTERN));
|
||||||
private ItemHandlerBasic configuration = new ItemHandlerBasic(9 * 2, this);
|
private ItemHandlerBasic configuration = new ItemHandlerBasic(9 * 2, this);
|
||||||
|
|
||||||
private boolean patternOredicted = false;
|
|
||||||
|
|
||||||
public TileProcessingPatternEncoder() {
|
|
||||||
dataManager.addWatchedParameter(PATTERN_OREDICTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
@@ -54,8 +23,6 @@ public class TileProcessingPatternEncoder extends TileBase {
|
|||||||
writeItems(patterns, 0, tag);
|
writeItems(patterns, 0, tag);
|
||||||
writeItems(configuration, 1, tag);
|
writeItems(configuration, 1, tag);
|
||||||
|
|
||||||
tag.setBoolean(NBT_PATTERN_OREDICTED, patternOredicted);
|
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,18 +32,12 @@ public class TileProcessingPatternEncoder extends TileBase {
|
|||||||
|
|
||||||
readItems(patterns, 0, tag);
|
readItems(patterns, 0, tag);
|
||||||
readItems(configuration, 1, tag);
|
readItems(configuration, 1, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_PATTERN_OREDICTED)) {
|
|
||||||
patternOredicted = tag.getBoolean(NBT_PATTERN_OREDICTED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreatePattern() {
|
public void onCreatePattern() {
|
||||||
if (canCreatePattern()) {
|
if (canCreatePattern()) {
|
||||||
ItemStack pattern = new ItemStack(RefinedStorageItems.PATTERN);
|
ItemStack pattern = new ItemStack(RefinedStorageItems.PATTERN);
|
||||||
|
|
||||||
ItemPattern.setOredicted(pattern, patternOredicted);
|
|
||||||
|
|
||||||
for (int i = 0; i < 18; ++i) {
|
for (int i = 0; i < 18; ++i) {
|
||||||
if (configuration.getStackInSlot(i) != null) {
|
if (configuration.getStackInSlot(i) != null) {
|
||||||
if (i >= 9) {
|
if (i >= 9) {
|
||||||
|
|||||||
@@ -107,28 +107,10 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
public static final TileDataParameter<Boolean> PATTERN_OREDICTED = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileGrid>() {
|
|
||||||
@Override
|
|
||||||
public Boolean getValue(TileGrid tile) {
|
|
||||||
return tile.patternOredicted;
|
|
||||||
}
|
|
||||||
}, new ITileDataConsumer<Boolean, TileGrid>() {
|
|
||||||
@Override
|
|
||||||
public void setValue(TileGrid tile, Boolean value) {
|
|
||||||
tile.patternOredicted = value;
|
|
||||||
tile.markDirty();
|
|
||||||
}
|
|
||||||
}, parameter -> {
|
|
||||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiGrid) {
|
|
||||||
((GuiGrid) Minecraft.getMinecraft().currentScreen).updatePatternOredicted(parameter.getValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
public static final String NBT_VIEW_TYPE = "ViewType";
|
public static final String NBT_VIEW_TYPE = "ViewType";
|
||||||
public static final String NBT_SORTING_DIRECTION = "SortingDirection";
|
public static final String NBT_SORTING_DIRECTION = "SortingDirection";
|
||||||
public static final String NBT_SORTING_TYPE = "SortingType";
|
public static final String NBT_SORTING_TYPE = "SortingType";
|
||||||
public static final String NBT_SEARCH_BOX_MODE = "SearchBoxMode";
|
public static final String NBT_SEARCH_BOX_MODE = "SearchBoxMode";
|
||||||
private static final String NBT_PATTERN_OREDICTED = "PatternOredicted";
|
|
||||||
|
|
||||||
public static final int SORTING_DIRECTION_ASCENDING = 0;
|
public static final int SORTING_DIRECTION_ASCENDING = 0;
|
||||||
public static final int SORTING_DIRECTION_DESCENDING = 1;
|
public static final int SORTING_DIRECTION_DESCENDING = 1;
|
||||||
@@ -170,14 +152,11 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
private int sortingType = SORTING_TYPE_NAME;
|
private int sortingType = SORTING_TYPE_NAME;
|
||||||
private int searchBoxMode = SEARCH_BOX_MODE_NORMAL;
|
private int searchBoxMode = SEARCH_BOX_MODE_NORMAL;
|
||||||
|
|
||||||
private boolean patternOredicted = false;
|
|
||||||
|
|
||||||
public TileGrid() {
|
public TileGrid() {
|
||||||
dataManager.addWatchedParameter(VIEW_TYPE);
|
dataManager.addWatchedParameter(VIEW_TYPE);
|
||||||
dataManager.addWatchedParameter(SORTING_DIRECTION);
|
dataManager.addWatchedParameter(SORTING_DIRECTION);
|
||||||
dataManager.addWatchedParameter(SORTING_TYPE);
|
dataManager.addWatchedParameter(SORTING_TYPE);
|
||||||
dataManager.addWatchedParameter(SEARCH_BOX_MODE);
|
dataManager.addWatchedParameter(SEARCH_BOX_MODE);
|
||||||
dataManager.addWatchedParameter(PATTERN_OREDICTED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -329,8 +308,6 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
|
|
||||||
ItemStack pattern = new ItemStack(RefinedStorageItems.PATTERN);
|
ItemStack pattern = new ItemStack(RefinedStorageItems.PATTERN);
|
||||||
|
|
||||||
ItemPattern.setOredicted(pattern, patternOredicted);
|
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
ItemStack ingredient = matrix.getStackInSlot(i);
|
ItemStack ingredient = matrix.getStackInSlot(i);
|
||||||
|
|
||||||
@@ -484,10 +461,6 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
if (tag.hasKey(NBT_SEARCH_BOX_MODE)) {
|
if (tag.hasKey(NBT_SEARCH_BOX_MODE)) {
|
||||||
searchBoxMode = tag.getInteger(NBT_SEARCH_BOX_MODE);
|
searchBoxMode = tag.getInteger(NBT_SEARCH_BOX_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.hasKey(NBT_PATTERN_OREDICTED)) {
|
|
||||||
patternOredicted = tag.getBoolean(NBT_PATTERN_OREDICTED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -502,7 +475,6 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
tag.setInteger(NBT_SORTING_DIRECTION, sortingDirection);
|
tag.setInteger(NBT_SORTING_DIRECTION, sortingDirection);
|
||||||
tag.setInteger(NBT_SORTING_TYPE, sortingType);
|
tag.setInteger(NBT_SORTING_TYPE, sortingType);
|
||||||
tag.setInteger(NBT_SEARCH_BOX_MODE, searchBoxMode);
|
tag.setInteger(NBT_SEARCH_BOX_MODE, searchBoxMode);
|
||||||
tag.setBoolean(NBT_PATTERN_OREDICTED, patternOredicted);
|
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,14 +60,12 @@ misc.refinedstorage:network_card.tooltip=Linked to %d, %d, %d.
|
|||||||
|
|
||||||
misc.refinedstorage:pattern.inputs=Inputs
|
misc.refinedstorage:pattern.inputs=Inputs
|
||||||
misc.refinedstorage:pattern.outputs=Outputs
|
misc.refinedstorage:pattern.outputs=Outputs
|
||||||
misc.refinedstorage:pattern.oredict=Uses ore dictionary
|
|
||||||
misc.refinedstorage:pattern.invalid=Invalid pattern
|
misc.refinedstorage:pattern.invalid=Invalid pattern
|
||||||
|
|
||||||
misc.refinedstorage:start=Start
|
misc.refinedstorage:start=Start
|
||||||
misc.refinedstorage:clear=Clear
|
misc.refinedstorage:clear=Clear
|
||||||
misc.refinedstorage:cancel_all=Cancel All
|
misc.refinedstorage:cancel_all=Cancel All
|
||||||
misc.refinedstorage:priority=Priority
|
misc.refinedstorage:priority=Priority
|
||||||
misc.refinedstorage:use_oredict=Use oredict
|
|
||||||
|
|
||||||
sidebutton.refinedstorage:compare.1=Compare Damage
|
sidebutton.refinedstorage:compare.1=Compare Damage
|
||||||
sidebutton.refinedstorage:compare.2=Compare NBT
|
sidebutton.refinedstorage:compare.2=Compare NBT
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Reference in New Issue
Block a user