net.minecraft.inventory.ICrafting Java Examples

The following examples show how to use net.minecraft.inventory.ICrafting. 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: BW_Container_RadioHatch.java    From bartworks with MIT License 6 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public void detectAndSendChanges() {
    if (!this.iGregTechTileEntity.getBaseMetaTileEntity().isClientSide() && this.iGregTechTileEntity.getBaseMetaTileEntity().getMetaTileEntity() != null) {
        this.coverage = this.iGregTechTileEntity.getCoverage();
        ++this.timer;
        Iterator var2 = this.crafters.iterator();
        if (this.timer >= Long.MAX_VALUE - 1)
            this.timer = 0;
        while (true) {
            do {
                if (!var2.hasNext()) {
                    this.dcoverage = this.coverage;
                    return;
                }
                ICrafting var1 = (ICrafting) var2.next();
                if (this.timer % 500 == 10 || this.dcoverage != this.coverage)
                    var1.sendProgressBarUpdate(this, 0, this.coverage);
            } while (this.timer % 500 != 10 && this.dcoverage != this.coverage);
        }
    }
}
 
Example #2
Source File: ContainerQuantumComputer.java    From qcraft-mod with Apache License 2.0 6 votes vote down vote up
@Override
public void addCraftingToCrafters( ICrafting icrafting )
{
    super.addCraftingToCrafters( icrafting );
    icrafting.sendProgressBarUpdate( this, PROGRESS_ERRORMSG, m_errorMessage.ordinal() );

    boolean canEdit = false;
    boolean canEditIPAddress = false;
    if( icrafting instanceof EntityPlayer )
    {
        EntityPlayer player = (EntityPlayer)icrafting;
        canEdit = QCraft.canPlayerCreatePortals( player );
        canEditIPAddress = QCraft.canPlayerEditPortalServers( player );
    }
    icrafting.sendProgressBarUpdate( this, PROGRESS_IS_TELEPORTER, m_isTeleporter ? 1 : 0 );
    icrafting.sendProgressBarUpdate( this, PROGRESS_IS_TELEPORTER_ENERGIZED, m_isTeleporterEnergized ? 1 : 0 );
    icrafting.sendProgressBarUpdate( this, PROGRESS_CAN_EDIT, canEdit ? 1 : 0 );
    icrafting.sendProgressBarUpdate( this, PROGRESS_CAN_EDIT_IP, canEditIPAddress ? 1 : 0 );
}
 
Example #3
Source File: ContainerNewBrewingStand.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();

	for (int i = 0; i < crafters.size(); i++) {
		ICrafting icrafting = (ICrafting) crafters.get(i);

		if (prevBrewTime != tile.getBrewTime())
			icrafting.sendProgressBarUpdate(this, 0, tile.getBrewTime());
		if (prevFuel != tile.getFuel())
			icrafting.sendProgressBarUpdate(this, 1, tile.getFuel());
		if (prevCurrentFuel != tile.getCurrentFuel())
			icrafting.sendProgressBarUpdate(this, 2, tile.getCurrentFuel());
	}
	prevBrewTime = tile.getBrewTime();
	prevFuel = tile.getFuel();
	prevCurrentFuel = tile.getCurrentFuel();
}
 
Example #4
Source File: ContainerBloomeryFurnace.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
public void detectAndSendChanges () {
    super.detectAndSendChanges();

    for (int i = 0; i < crafters.size(); i++) {
        ICrafting crafting = (ICrafting) crafters.get(i);
        if (lastCookTime != tileFurnace.furnaceCookTime)
            crafting.sendProgressBarUpdate(this, 0, tileFurnace.furnaceCookTime);
        if (lastBurnTime != tileFurnace.furnaceBurnTime)
            crafting.sendProgressBarUpdate(this, 1, tileFurnace.furnaceBurnTime);
        if (lastItemBurnTime != tileFurnace.currentItemBurnTime)
            crafting.sendProgressBarUpdate(this, 2, tileFurnace.currentItemBurnTime);
    }

    lastCookTime = tileFurnace.furnaceCookTime;
    lastBurnTime = tileFurnace.furnaceBurnTime;
    lastItemBurnTime = tileFurnace.currentItemBurnTime;
}
 
Example #5
Source File: ContainerEnchantment.java    From Et-Futurum with The Unlicense 6 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 var1 = 0; var1 < crafters.size(); ++var1) {
		ICrafting var2 = (ICrafting) crafters.get(var1);
		var2.sendProgressBarUpdate(this, 0, enchantLevels[0]);
		var2.sendProgressBarUpdate(this, 1, enchantLevels[1]);
		var2.sendProgressBarUpdate(this, 2, enchantLevels[2]);
		var2.sendProgressBarUpdate(this, 3, enchantmentSeed & -16);
		var2.sendProgressBarUpdate(this, 4, field_178151_h[0]);
		var2.sendProgressBarUpdate(this, 5, field_178151_h[1]);
		var2.sendProgressBarUpdate(this, 6, field_178151_h[2]);
	}
}
 
Example #6
Source File: ContainerCompostBin.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
public void detectAndSendChanges () {
    super.detectAndSendChanges();

    for (int i = 0; i < crafters.size(); i++) {
        ICrafting crafting = (ICrafting) crafters.get(i);
        if (lastDecompTime != tileCompost.getDecompTime())
            crafting.sendProgressBarUpdate(this, 0, tileCompost.getDecompTime());
        if (lastItemDecompTime != tileCompost.getCurrentItemDecompTime())
            crafting.sendProgressBarUpdate(this, 1, tileCompost.getCurrentItemDecompTime());
        if (lastDecompCount != tileCompost.itemDecomposeCount)
            crafting.sendProgressBarUpdate(this, 2, tileCompost.itemDecomposeCount);
    }

    lastDecompTime = tileCompost.getDecompTime();
    lastItemDecompTime = tileCompost.getCurrentItemDecompTime();
    lastDecompCount = tileCompost.itemDecomposeCount;
}
 
Example #7
Source File: ContainerExtended.java    From CodeChickenCore with MIT License 5 votes vote down vote up
@Override
public void onCraftGuiOpened(ICrafting icrafting) {
    if (icrafting instanceof EntityPlayerMP) {
        playerCrafters.add((EntityPlayerMP) icrafting);
        sendContainerAndContentsToPlayer(this, getInventory(), Arrays.asList((EntityPlayerMP) icrafting));
        detectAndSendChanges();
    } else
        super.onCraftGuiOpened(icrafting);
}
 
Example #8
Source File: ContainerPneumaticBase.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
protected void sendToCrafters(IMessage message){
    for(ICrafting crafter : (List<ICrafting>)crafters) {
        if(crafter instanceof EntityPlayerMP) {
            NetworkHandler.sendTo(message, (EntityPlayerMP)crafter);
        }
    }
}
 
Example #9
Source File: ContainerPack.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    
    int fuel = this.packItem.getFuelStored(this.chestplate);
    
    if (fuel != this.lastFuel) {
        for (int i = 0; i < this.crafters.size(); ++i) {
            ((ICrafting) this.crafters.get(i)).sendProgressBarUpdate(this, 0, (short) (fuel >> 16));
            ((ICrafting) this.crafters.get(i)).sendProgressBarUpdate(this, 1, (short) (fuel & 0xFFFF));
        }
        this.lastFuel = fuel;
    }
}
 
Example #10
Source File: ContainerBloomeryFurnace.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
public void addCraftingToCrafters (ICrafting crafting) {
    super.addCraftingToCrafters(crafting);

    crafting.sendProgressBarUpdate(this, 0, tileFurnace.furnaceCookTime);
    crafting.sendProgressBarUpdate(this, 1, tileFurnace.furnaceBurnTime);
    crafting.sendProgressBarUpdate(this, 2, tileFurnace.currentItemBurnTime);
}
 
Example #11
Source File: ContainerCompostBin.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
public void addCraftingToCrafters (ICrafting crafting) {
    super.addCraftingToCrafters(crafting);

    crafting.sendProgressBarUpdate(this, 0, tileCompost.getDecompTime());
    crafting.sendProgressBarUpdate(this, 1, tileCompost.getCurrentItemDecompTime());
    crafting.sendProgressBarUpdate(this, 2, tileCompost.itemDecomposeCount);
}
 
Example #12
Source File: ContainerExtended.java    From CodeChickenCore with MIT License 5 votes vote down vote up
@Override
public void removeCraftingFromCrafters(ICrafting icrafting) {
    if (icrafting instanceof EntityPlayerMP)
        playerCrafters.remove(icrafting);
    else
        super.removeCraftingFromCrafters(icrafting);
}
 
Example #13
Source File: BW_Container_HeatedWaterPump.java    From bartworks with MIT License 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    if (this.TILE.getWorldObj().isRemote)
        return;

    this.fuel = this.TILE.fuel;
    this.maxfuel = this.TILE.maxfuel;
    this.water = this.TILE.outputstack.amount;
    this.netfuel = ByteBuffer.allocate(8).putInt(this.fuel).array();
    this.netmaxfuel = ByteBuffer.allocate(8).putInt(this.maxfuel).array();
    ++this.timer;
    Iterator var2 = this.crafters.iterator();
    if (this.timer >= Long.MAX_VALUE - 1)
        this.timer = 0;
    while (true) {
        do {
            if (!var2.hasNext()) {
                this.netfuel = this.anetfuel;
                this.netmaxfuel = this.anetmaxfuel;
                this.water = this.awater;
                return;
            }
            ICrafting var1 = (ICrafting) var2.next();
            if (this.timer % 500 == 10 || this.water != this.awater)
                var1.sendProgressBarUpdate(this, 0, this.water);
            if (this.timer % 500 == 10 || this.netfuel != this.anetfuel)
                for (int i = 0; i < this.netfuel.length; i++) {
                    var1.sendProgressBarUpdate(this, i + 1, this.netfuel[i]);
                }
            if (this.timer % 500 == 10 || this.netmaxfuel != this.anetmaxfuel)
                for (int i = 0; i < this.netmaxfuel.length; i++) {
                    var1.sendProgressBarUpdate(this, i + 9, this.netmaxfuel[i]);
                }
        } while (this.timer % 500 != 10 && this.water != this.awater);
    }
}
 
Example #14
Source File: ContainerEnchantment.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@Override
public void addCraftingToCrafters(ICrafting p_75132_1_) {
	super.addCraftingToCrafters(p_75132_1_);
	p_75132_1_.sendProgressBarUpdate(this, 0, enchantLevels[0]);
	p_75132_1_.sendProgressBarUpdate(this, 1, enchantLevels[1]);
	p_75132_1_.sendProgressBarUpdate(this, 2, enchantLevels[2]);
	p_75132_1_.sendProgressBarUpdate(this, 3, enchantmentSeed & -16);
	p_75132_1_.sendProgressBarUpdate(this, 4, field_178151_h[0]);
	p_75132_1_.sendProgressBarUpdate(this, 5, field_178151_h[1]);
	p_75132_1_.sendProgressBarUpdate(this, 6, field_178151_h[2]);
}
 
Example #15
Source File: ContainerQuantumComputer.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
public void detectAndSendChanges()
{
    super.detectAndSendChanges();

    TileEntityQuantumComputer.TeleportError error = m_computer.canEnergize();
    boolean isTeleporter = m_computer.isTeleporter();
    boolean isTeleporterEnergized = m_computer.isTeleporterEnergized();
    for( int i = 0; i < crafters.size(); ++i )
    {
        ICrafting icrafting = (ICrafting) crafters.get( i );
        if( error != m_errorMessage )
        {
            icrafting.sendProgressBarUpdate( this, PROGRESS_ERRORMSG, error.ordinal() );
        }
        if( isTeleporter != m_isTeleporter )
        {
            icrafting.sendProgressBarUpdate( this, PROGRESS_IS_TELEPORTER, isTeleporter ? 1 : 0 );
        }
        if( isTeleporterEnergized != m_isTeleporterEnergized )
        {
            icrafting.sendProgressBarUpdate( this, PROGRESS_IS_TELEPORTER_ENERGIZED, isTeleporterEnergized ? 1 : 0 );
        }
    }
    m_errorMessage = error;
    m_isTeleporter = isTeleporter;
    m_isTeleporterEnergized = isTeleporterEnergized;
}
 
Example #16
Source File: ContainerExtended.java    From CodeChickenCore with MIT License 4 votes vote down vote up
public void sendProgressBarUpdate(int barID, int value) {
    for (ICrafting crafting : (List<ICrafting>) crafters)
        crafting.sendProgressBarUpdate(this, barID, value);
}
 
Example #17
Source File: GT_Container_RadioHatch.java    From bartworks with MIT License 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void detectAndSendChanges() {
    super.detectAndSendChanges();
    if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) {
        this.TE = (GT_MetaTileEntity_RadioHatch) this.mTileEntity.getMetaTileEntity();
        this.mass = this.TE.getMass();
        this.sievert = (short) this.TE.sievert;
        short[] rgb = this.TE.getColorForGUI();
        this.r = rgb[0];
        this.g = rgb[1];
        this.b = rgb[2];
        this.sv = (short) this.TE.getSievert();
        this.teTimer = ByteBuffer.allocate(8).putLong(this.TE.getTimer()).array();
        ++this.timer;
        Iterator var2 = this.crafters.iterator();
        if (this.timer >= Long.MAX_VALUE - 1)
            this.timer = 0;
        while (true) {
            do {
                if (!var2.hasNext()) {
                    this.dmass = this.mass;
                    this.dsievert = this.sievert;
                    this.dr = this.r;
                    this.dg = this.g;
                    this.db = this.b;
                    this.dteTimer = this.teTimer;
                    this.dsv = this.sv;
                    return;
                }
                ICrafting var1 = (ICrafting) var2.next();

                if (this.timer % 500 == 10 || this.dmass != this.mass)
                    var1.sendProgressBarUpdate(this, 21, this.mass);
                if (this.timer % 500 == 10 || this.dsievert != this.sievert)
                    var1.sendProgressBarUpdate(this, 22, (this.sievert - 100));
                if (this.timer % 500 == 10 || this.dr != this.r)
                    var1.sendProgressBarUpdate(this, 23, this.r);
                if (this.timer % 500 == 10 || this.dg != this.g)
                    var1.sendProgressBarUpdate(this, 24, this.g);
                if (this.timer % 500 == 10 || this.db != this.b)
                    var1.sendProgressBarUpdate(this, 25, this.b);
                if (this.timer % 500 == 10 || this.dteTimer != this.teTimer)
                    for (int i = 0; i < this.teTimer.length; i++) {
                        var1.sendProgressBarUpdate(this, 26 + i, this.teTimer[i]);
                    }
                if (this.timer % 500 == 10 || this.dsv != this.sv)
                    var1.sendProgressBarUpdate(this, 34, this.sv);

            } while (this.timer % 500 != 10 && this.dmass == this.mass);
        }
    }
}