Java Code Examples for net.minecraft.inventory.IContainerListener#sendWindowProperty()

The following examples show how to use net.minecraft.inventory.IContainerListener#sendWindowProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContainerEnderFurnace.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void addListener(IContainerListener listener)
{
    super.addListener(listener);

    int b = 0;

    if (this.teef.burnTimeFresh != 0)
    {
        b = 100 * this.teef.burnTimeRemaining / this.teef.burnTimeFresh;
    }

    int c = 100 * this.teef.cookTime / TileEntityEnderFurnace.COOKTIME_DEFAULT;

    listener.sendWindowProperty(this, 0, c << 8 | b);
    listener.sendWindowProperty(this, 1, this.teef.outputToEnderChest ? 1 : 0);
}
 
Example 2
Source File: ContainerCreationStation.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void addListener(IContainerListener listener)
{
    super.addListener(listener);

    int modeMask = this.tecs.getModeMask();
    int selection = this.tecs.getQuickMode() << 2 | this.tecs.getSelectedModuleSlot();
    int smeltProgress = this.tecs.getSmeltProgressScaled(1, 100) << 8 | this.tecs.getSmeltProgressScaled(0, 100);
    int fuelProgress = this.tecs.getBurnTimeRemainingScaled(1, 100) << 8 | this.tecs.getBurnTimeRemainingScaled(0, 100);

    listener.sendWindowProperty(this, 0, modeMask);
    listener.sendWindowProperty(this, 1, selection);
    listener.sendWindowProperty(this, 2, fuelProgress);
    listener.sendWindowProperty(this, 3, smeltProgress);
    listener.sendWindowProperty(this, 4, this.tecs.lastInteractedCraftingGrid);

    this.detectAndSendChanges();
}
 
Example 3
Source File: ContainerCampfirePot.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);

        if (this.burnTime != this.tileCampfire.getField(0)) {
            icontainerlistener.sendWindowProperty(this, 0, this.tileCampfire.getField(0));
        }

        if (this.processTime != this.tileCampfire.getField(1)) {
            icontainerlistener.sendWindowProperty(this, 1, this.tileCampfire.getField(1));
        }

        if (this.maxProcessTime != this.tileCampfire.getField(2)) {
            icontainerlistener.sendWindowProperty(this, 2, this.tileCampfire.getField(2));
        }
    }

    this.burnTime = this.tileCampfire.getField(0);
    this.processTime = this.tileCampfire.getField(1);
    this.maxProcessTime = this.tileCampfire.getField(2);
}
 
Example 4
Source File: ContainerMapleCauldron.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);

        if (this.mapleTime != this.tileCampfire.getField(0)) {
            icontainerlistener.sendWindowProperty(this, 0, this.tileCampfire.getField(0));
        }

        if (this.cookTime != this.tileCampfire.getField(1)) {
            icontainerlistener.sendWindowProperty(this, 1, this.tileCampfire.getField(1));
        }

    }
    this.mapleTime = this.tileCampfire.getField(0);
    this.cookTime = this.tileCampfire.getField(1);
}
 
Example 5
Source File: ContainerStoneMortar.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);

        if (this.processTime != this.tileCampfire.getField(0)) {
            icontainerlistener.sendWindowProperty(this, 0, this.tileCampfire.getField(0));
        }

        if (this.maxProcessTime != this.tileCampfire.getField(1)) {
            icontainerlistener.sendWindowProperty(this, 1, this.tileCampfire.getField(1));
        }
    }

    this.processTime = this.tileCampfire.getField(0);
    this.maxProcessTime = this.tileCampfire.getField(1);
}
 
Example 6
Source File: ContainerGui.java    From customstuff4 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void detectAndSendChanges()
{
    super.detectAndSendChanges();

    for (IContainerListener listener : listeners)
    {
        for (int id = 0; id < prevFieldValues.length; id++)
        {
            if (prevFieldValues[id] != fieldSupplier.getField(id))
            {
                listener.sendWindowProperty(this, id, fieldSupplier.getField(id));
            }
        }
    }

    for (int id = 0; id < prevFieldValues.length; id++)
    {
        prevFieldValues[id] = fieldSupplier.getField(id);
    }
}
 
Example 7
Source File: ContainerDistillation.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);

        if (this.processTime != this.tileBarrel.getField(0)) {
            icontainerlistener.sendWindowProperty(this, 0, this.tileBarrel.getField(0));
        }
    }

    this.processTime = this.tileBarrel.getField(0);
}
 
Example 8
Source File: ContainerEnderFurnace.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void detectAndSendChanges()
{
    super.detectAndSendChanges();

    IContainerListener listener;

    for (int i = 0; i < this.listeners.size(); i++)
    {
        listener = this.listeners.get(i);

        // Note: the value gets truncated to a short in non-local SMP
        if (this.teef.burnTimeRemaining != this.burnTimeRemaining
            || this.teef.burnTimeFresh != this.burnTimeFresh
            || this.teef.cookTime != this.cookTime)
        {
            int b = 0, c = 0;

            if (this.teef.burnTimeFresh != 0)
            {
                b = 100 * this.teef.burnTimeRemaining / this.teef.burnTimeFresh;
            }

            c = 100 * this.teef.cookTime / TileEntityEnderFurnace.COOKTIME_DEFAULT;

            // smelting progress and fuel burning progress are both 0..100, we send the smelting progress in the upper byte of the short
            listener.sendWindowProperty(this, 0, c << 8 | b);
        }

        if (this.teef.outputToEnderChest != this.outputToEnderChest)
        {
            listener.sendWindowProperty(this, 1, this.teef.outputToEnderChest ? 1 : 0);
        }

        this.burnTimeRemaining = this.teef.burnTimeRemaining;
        this.burnTimeFresh = this.teef.burnTimeFresh;
        this.cookTime = this.teef.cookTime;
        this.outputToEnderChest = this.teef.outputToEnderChest;
    }
}
 
Example 9
Source File: ContainerHandyChest.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void detectAndSendChanges()
{
    if (this.tehc.getWorld().isRemote)
    {
        return;
    }

    for (int i = 0; i < this.listeners.size(); ++i)
    {
        IContainerListener listener = this.listeners.get(i);

        if (this.selectedModule != this.tehc.getSelectedModule())
        {
            listener.sendWindowProperty(this, 0, this.tehc.getSelectedModule());
        }

        if (this.actionMode != this.tehc.getQuickMode())
        {
            listener.sendWindowProperty(this, 1, this.tehc.getQuickMode());
        }

        if (this.lockMask != this.tehc.getLockMask())
        {
            listener.sendWindowProperty(this, 2, this.tehc.getLockMask());
        }
    }

    this.selectedModule = this.tehc.getSelectedModule();
    this.actionMode = this.tehc.getQuickMode();
    this.lockMask = this.tehc.getLockMask();

    super.detectAndSendChanges();
}
 
Example 10
Source File: ContainerHandyChest.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void addListener(IContainerListener listener)
{
    super.addListener(listener);

    listener.sendWindowProperty(this, 0, this.tehc.getSelectedModule());
    listener.sendWindowProperty(this, 1, this.tehc.getQuickMode());
    listener.sendWindowProperty(this, 2, this.tehc.getLockMask());
}
 
Example 11
Source File: ContainerSeedAnalyzer.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    for (IContainerListener listener : this.listeners) {
        if (this.progress != this.getTile().getProgress()) {
            listener.sendWindowProperty(this, 0, this.getTile().getProgress());
        }
    }
    this.progress = this.getTile().getProgress();
}
 
Example 12
Source File: SatelliteData.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void sendChanges(Container container, IContainerListener crafter, int variableId, int localId) {
	crafter.sendWindowProperty(container, variableId, (short)(( lastActionTime >>> (localId*16) ) & 0xffff));

	if(localId == 3)
		prevLastActionTime=lastActionTime;
}
 
Example 13
Source File: ModuleData.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void sendChanges(Container container, IContainerListener crafter,
		int variableId, int localId) {
	if(localId < data.length)
		crafter.sendWindowProperty(container, variableId, data[localId].getData());
	else
		crafter.sendWindowProperty(container, variableId, data[0].getDataType().ordinal());
}
 
Example 14
Source File: ContainerEnderInfuser.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void detectAndSendChanges()
{
    super.detectAndSendChanges();

    if (this.teef.chargeableItemCurrentCharge != this.ciCurrent)
    {
        this.ciCurrent = this.teef.chargeableItemCurrentCharge;
        this.ciCapacity = this.teef.chargeableItemCapacity;
        this.ciStarting = this.teef.chargeableItemStartingCharge;
        this.updateChargingProgress();
    }

    for (int i = 0; i < this.listeners.size(); ++i)
    {
        IContainerListener listener = this.listeners.get(i);

        // The values need to fit into a short, where these get truncated to in non-local SMP

        if (this.teef.amountStored != this.amountStored)
        {
            listener.sendWindowProperty(this, 0, this.teef.amountStored);
        }

        if (this.teef.meltingProgress != this.meltingProgress)
        {
            listener.sendWindowProperty(this, 1, this.teef.meltingProgress);
        }

        if (this.ciCurrentLast != this.ciCurrent)
        {
            listener.sendWindowProperty(this, 2, this.chargeProgress);
        }
    }

    this.ciCurrentLast = this.ciCurrent;
    this.amountStored = this.teef.amountStored;
    this.meltingProgress = this.teef.meltingProgress;
}
 
Example 15
Source File: ContainerTFStorage.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Looks for changes made in the container, sends them to every listener.
 */
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);
            icontainerlistener.sendWindowProperty(this, 0, this.tileStorageMachine.getField(0));
            icontainerlistener.sendWindowProperty(this, 2, this.tileStorageMachine.getField(2));
            icontainerlistener.sendWindowProperty(this, 1, this.tileStorageMachine.getField(1));
    }

}
 
Example 16
Source File: ContainerBarrel.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);

        if (this.processTime != this.tileBarrel.getField(0)) {
            icontainerlistener.sendWindowProperty(this, 0, this.tileBarrel.getField(0));
        }
    }

    this.processTime = this.tileBarrel.getField(0);
}
 
Example 17
Source File: ContainerTFAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Looks for changes made in the container, sends them to every listener.
 */
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);
            icontainerlistener.sendWindowProperty(this, 0, this.tileMachine.getField(0));
            icontainerlistener.sendWindowProperty(this, 2, this.tileMachine.getField(2));
            icontainerlistener.sendWindowProperty(this, 1, this.tileMachine.getField(1));
    }

}
 
Example 18
Source File: ContainerTFOven.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Looks for changes made in the container, sends them to every listener.
 */
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);
        icontainerlistener.sendWindowProperty(this, 0, this.tileStorageMachine.getField(0));
        icontainerlistener.sendWindowProperty(this, 1, this.tileStorageMachine.getField(1));
    }

}
 
Example 19
Source File: ContainerTFAdvancedAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Looks for changes made in the container, sends them to every listener.
 */
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.listeners.size(); ++i) {
        IContainerListener icontainerlistener = this.listeners.get(i);
            icontainerlistener.sendWindowProperty(this, 0, this.tileMachine.getField(0));
            icontainerlistener.sendWindowProperty(this, 2, this.tileMachine.getField(2));
            icontainerlistener.sendWindowProperty(this, 1, this.tileMachine.getField(1));
    }

}
 
Example 20
Source File: ContainerPortalPanel.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void addListener(IContainerListener listener)
{
    super.addListener(listener);

    listener.sendWindowProperty(this, 0, this.tepp.getActiveTargetId());
}