use of net.minecraft.inventory.ICrafting in project LogisticsPipes by RS485.
the class DummyContainer method detectAndSendChanges.
@Override
@SuppressWarnings("unchecked")
public void detectAndSendChanges() {
for (int i = 0; i < inventorySlots.size(); ++i) {
if (inventorySlots.get(i) instanceof IFuzzySlot) {
IFuzzySlot fuzzySlot = (IFuzzySlot) inventorySlots.get(i);
BitSet set = inventoryFuzzySlotsContent.get(i);
if (set == null) {
set = fuzzySlot.getFuzzyFlags().getBitSet();
MainProxy.sendToPlayerList(PacketHandler.getPacket(FuzzySlotSettingsPacket.class).setSlotNumber(fuzzySlot.getSlotId()).setFlags(set), crafters);
inventoryFuzzySlotsContent.set(i, set);
} else {
BitSet setB = fuzzySlot.getFuzzyFlags().getBitSet();
if (!set.equals(setB)) {
MainProxy.sendToPlayerList(PacketHandler.getPacket(FuzzySlotSettingsPacket.class).setSlotNumber(fuzzySlot.getSlotId()).setFlags(setB), crafters);
inventoryFuzzySlotsContent.set(i, setB);
}
}
}
ItemStack itemstack = ((Slot) inventorySlots.get(i)).getStack();
ItemStack itemstack1 = (ItemStack) inventoryItemStacks.get(i);
if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) {
itemstack1 = itemstack == null ? null : itemstack.copy();
inventoryItemStacks.set(i, itemstack1);
for (Object crafter : crafters) {
boolean revert = false;
if (overrideMCAntiSend && crafter instanceof EntityPlayerMP && ((EntityPlayerMP) crafter).isChangingQuantityOnly) {
((EntityPlayerMP) crafter).isChangingQuantityOnly = false;
revert = true;
}
((ICrafting) crafter).sendSlotContents(this, i, itemstack1);
if (revert) {
((EntityPlayerMP) crafter).isChangingQuantityOnly = true;
}
}
}
}
overrideMCAntiSend = false;
}
use of net.minecraft.inventory.ICrafting in project MineFactoryReloaded by powercrystals.
the class ContainerLiquiCrafter method detectAndSendChanges.
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
int tankIndex = (int) (_crafter.worldObj.getWorldTime() % 9);
ILiquidTank tank = _crafter.getTanks(ForgeDirection.UNKNOWN)[tankIndex];
LiquidStack l = tank.getLiquid();
for (int i = 0; i < crafters.size(); i++) {
((ICrafting) crafters.get(i)).sendProgressBarUpdate(this, 0, tankIndex);
if (l != null) {
((ICrafting) crafters.get(i)).sendProgressBarUpdate(this, 1, l.itemID);
((ICrafting) crafters.get(i)).sendProgressBarUpdate(this, 2, l.itemMeta);
((ICrafting) crafters.get(i)).sendProgressBarUpdate(this, 3, l.amount);
} else {
((ICrafting) crafters.get(i)).sendProgressBarUpdate(this, 1, 0);
((ICrafting) crafters.get(i)).sendProgressBarUpdate(this, 2, 0);
((ICrafting) crafters.get(i)).sendProgressBarUpdate(this, 3, 0);
}
}
}
use of net.minecraft.inventory.ICrafting in project compactsolars by cpw.
the class ContainerCompactSolar method detectAndSendChanges.
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
@SuppressWarnings("unchecked") List<ICrafting> crafters = this.crafters;
for (ICrafting crafter : crafters) {
if (theSunIsVisible != tile.theSunIsVisible || !initialized) {
crafter.sendProgressBarUpdate(this, 0, tile.theSunIsVisible ? 1 : 0);
}
}
initialized = true;
theSunIsVisible = tile.theSunIsVisible;
}
use of net.minecraft.inventory.ICrafting in project BluePower by Qmunity.
the class ContainerCircuitDatabaseMain 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 (curUploadProgress != circuitDatabase.curUploadProgress) {
icrafting.sendProgressBarUpdate(this, 0, circuitDatabase.curUploadProgress);
}
if (curCopyProgress != circuitDatabase.curCopyProgress) {
icrafting.sendProgressBarUpdate(this, 1, circuitDatabase.curCopyProgress);
}
if (selectedShareOption != circuitDatabase.selectedShareOption) {
icrafting.sendProgressBarUpdate(this, 2, circuitDatabase.selectedShareOption);
}
}
curUploadProgress = circuitDatabase.curUploadProgress;
curCopyProgress = circuitDatabase.curCopyProgress;
selectedShareOption = circuitDatabase.selectedShareOption;
}
use of net.minecraft.inventory.ICrafting in project BluePower by Qmunity.
the class ContainerRegulator 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 != tileRegulator.color.ordinal()) {
icrafting.sendProgressBarUpdate(this, 0, tileRegulator.color.ordinal());
}
if (mode != tileRegulator.mode) {
icrafting.sendProgressBarUpdate(this, 2, tileRegulator.mode);
}
if (fuzzySetting != tileRegulator.fuzzySetting) {
icrafting.sendProgressBarUpdate(this, 3, tileRegulator.fuzzySetting);
}
}
filterColor = tileRegulator.color.ordinal();
mode = tileRegulator.mode;
fuzzySetting = tileRegulator.fuzzySetting;
}
Aggregations