Search in sources :

Example 11 with ICrafting

use of net.minecraft.inventory.ICrafting in project BluePower by Qmunity.

the class ContainerSortingMachine method detectAndSendChanges.

/**
     * Looks for changes made in the container, sends them to every listener.
     */
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    for (Object crafter : crafters) {
        ICrafting icrafting = (ICrafting) crafter;
        for (int i = 0; i < 9; i++) {
            if (colors[i] != sortingMachine.colors[i].ordinal()) {
                icrafting.sendProgressBarUpdate(this, i, sortingMachine.colors[i].ordinal());
            }
        }
        if (pullMode != sortingMachine.pullMode.ordinal()) {
            icrafting.sendProgressBarUpdate(this, 9, sortingMachine.pullMode.ordinal());
        }
        if (sortMode != sortingMachine.sortMode.ordinal()) {
            icrafting.sendProgressBarUpdate(this, 10, sortingMachine.sortMode.ordinal());
        }
        if (curColumn != sortingMachine.curColumn) {
            icrafting.sendProgressBarUpdate(this, 11, sortingMachine.curColumn);
        }
        for (int i = 0; i < 8; i++) {
            if (fuzzySettings[i] != sortingMachine.fuzzySettings[i]) {
                icrafting.sendProgressBarUpdate(this, i + 12, sortingMachine.fuzzySettings[i]);
            }
        }
    }
    pullMode = sortingMachine.pullMode.ordinal();
    sortMode = sortingMachine.sortMode.ordinal();
    curColumn = sortingMachine.curColumn;
    for (int i = 0; i < colors.length; i++) {
        colors[i] = sortingMachine.colors[i].ordinal();
    }
    for (int i = 0; i < fuzzySettings.length; i++) {
        fuzzySettings[i] = sortingMachine.fuzzySettings[i];
    }
}
Also used : ICrafting(net.minecraft.inventory.ICrafting)

Example 12 with ICrafting

use of net.minecraft.inventory.ICrafting in project BluePower by Qmunity.

the class ContainerFilter method detectAndSendChanges.

/**
     * Looks for changes made in the container, sends them to every listener.
     */
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    for (Object crafter : crafters) {
        ICrafting icrafting = (ICrafting) crafter;
        if (filterColor != tileFilter.filterColor.ordinal()) {
            icrafting.sendProgressBarUpdate(this, 0, tileFilter.filterColor.ordinal());
        }
        if (fuzzySetting != tileFilter.fuzzySetting) {
            icrafting.sendProgressBarUpdate(this, 1, tileFilter.fuzzySetting);
        }
    }
    filterColor = tileFilter.filterColor.ordinal();
    fuzzySetting = tileFilter.fuzzySetting;
}
Also used : ICrafting(net.minecraft.inventory.ICrafting)

Aggregations

ICrafting (net.minecraft.inventory.ICrafting)12 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)2 MessageSyncMachineBacklog (com.bluepowermod.network.message.MessageSyncMachineBacklog)1 BitSet (java.util.BitSet)1 IFuzzySlot (logisticspipes.interfaces.IFuzzySlot)1 FuzzySlotSettingsPacket (logisticspipes.network.packets.gui.FuzzySlotSettingsPacket)1 Slot (net.minecraft.inventory.Slot)1 ItemStack (net.minecraft.item.ItemStack)1 ILiquidTank (net.minecraftforge.liquids.ILiquidTank)1 LiquidStack (net.minecraftforge.liquids.LiquidStack)1