Search in sources :

Example 1 with IContainerListener

use of net.minecraft.inventory.IContainerListener in project OpenModularTurrets by OpenModularTurretsTeam.

the class TurretBaseContainer method detectAndSendChanges.

@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    DebugHandler.getInstance().setListeners(this.listeners);
    for (IContainerListener listener : this.listeners) {
        if (listener instanceof EntityPlayerMP) {
            NetworkingHandler.INSTANCE.sendTo(new MessageTurretBase(this.tileEntity), (EntityPlayerMP) listener);
        }
    }
}
Also used : IContainerListener(net.minecraft.inventory.IContainerListener) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) MessageTurretBase(omtteam.openmodularturrets.network.messages.MessageTurretBase)

Example 2 with IContainerListener

use of net.minecraft.inventory.IContainerListener in project Railcraft by Railcraft.

the class ContainerLocomotiveSteamSolid method sendUpdateToClient.

@Override
public void sendUpdateToClient() {
    super.sendUpdateToClient();
    for (IContainerListener listener : listeners) {
        if (lastBurnTime != loco.boiler.burnTime)
            listener.sendProgressBarUpdate(this, 20, (int) Math.round(loco.boiler.burnTime));
        if (lastItemBurnTime != loco.boiler.currentItemBurnTime)
            listener.sendProgressBarUpdate(this, 21, (int) Math.round(loco.boiler.currentItemBurnTime));
    }
    this.lastBurnTime = loco.boiler.burnTime;
    this.lastItemBurnTime = loco.boiler.currentItemBurnTime;
}
Also used : IContainerListener(net.minecraft.inventory.IContainerListener)

Example 3 with IContainerListener

use of net.minecraft.inventory.IContainerListener in project Railcraft by Railcraft.

the class ContainerBoilerFluid method sendUpdateToClient.

@Override
public void sendUpdateToClient() {
    super.sendUpdateToClient();
    for (IContainerListener listener : listeners) {
        if (lastBurnTime != tile.boiler.burnTime)
            listener.sendProgressBarUpdate(this, 10, (int) Math.round(tile.boiler.burnTime));
        if (lastItemBurnTime != tile.boiler.currentItemBurnTime)
            listener.sendProgressBarUpdate(this, 11, (int) Math.round(tile.boiler.currentItemBurnTime));
        if (wasBurning != tile.boiler.isBurning())
            listener.sendProgressBarUpdate(this, 13, tile.boiler.isBurning() ? 1 : 0);
    }
    this.lastBurnTime = tile.boiler.burnTime;
    this.lastItemBurnTime = tile.boiler.currentItemBurnTime;
    this.wasBurning = tile.boiler.isBurning();
}
Also used : IContainerListener(net.minecraft.inventory.IContainerListener)

Example 4 with IContainerListener

use of net.minecraft.inventory.IContainerListener in project Railcraft by Railcraft.

the class ContainerEnergyLoader method sendUpdateToClient.

/**
     * Updates crafting matrix; called from onCraftMatrixChanged. Args: none
     */
@Override
public void sendUpdateToClient() {
    super.sendUpdateToClient();
    for (IContainerListener listener : listeners) {
        if (lastEnergy != device.getEnergy())
            PacketBuilder.instance().sendGuiIntegerPacket(listener, windowId, 0, (int) device.getEnergy());
        if (lastStorage != device.storageUpgrades)
            listener.sendProgressBarUpdate(this, 1, device.storageUpgrades);
        if (lastLapotron != device.lapotronUpgrades)
            listener.sendProgressBarUpdate(this, 2, device.lapotronUpgrades);
        if (lastTransferRate != device.transferRate)
            listener.sendProgressBarUpdate(this, 3, device.transferRate);
    }
    lastEnergy = (int) device.getEnergy();
    lastStorage = device.storageUpgrades;
    lastLapotron = device.lapotronUpgrades;
    lastTransferRate = device.transferRate;
}
Also used : IContainerListener(net.minecraft.inventory.IContainerListener)

Example 5 with IContainerListener

use of net.minecraft.inventory.IContainerListener in project Railcraft by Railcraft.

the class ContainerEngineSteam method sendUpdateToClient.

@Override
public void sendUpdateToClient() {
    super.sendUpdateToClient();
    for (IContainerListener crafter : listeners) {
        if (lastOutput != tile.currentOutput)
            crafter.sendProgressBarUpdate(this, 14, Math.round(tile.currentOutput * 100));
    }
    this.lastOutput = tile.currentOutput;
}
Also used : IContainerListener(net.minecraft.inventory.IContainerListener)

Aggregations

IContainerListener (net.minecraft.inventory.IContainerListener)25 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 MessageTurretBase (omtteam.openmodularturrets.network.messages.MessageTurretBase)2 LocoMode (mods.railcraft.common.carts.EntityLocomotive.LocoMode)1 LocoSpeed (mods.railcraft.common.carts.EntityLocomotive.LocoSpeed)1