當前位置: 首頁>>代碼示例>>Java>>正文


Java IContainerListener.sendWindowProperty方法代碼示例

本文整理匯總了Java中net.minecraft.inventory.IContainerListener.sendWindowProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java IContainerListener.sendWindowProperty方法的具體用法?Java IContainerListener.sendWindowProperty怎麽用?Java IContainerListener.sendWindowProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.inventory.IContainerListener的用法示例。


在下文中一共展示了IContainerListener.sendWindowProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
public void detectAndSendChanges () {
    super.detectAndSendChanges();

    for (IContainerListener listener : this.listeners) {
        if (cookTime != tile.getField(2))
            listener.sendWindowProperty(this, 2, tile.getField(2));
        if (furnaceBurnTime != tile.getField(0))
            listener.sendWindowProperty(this, 0, tile.getField(0));
        if (currentItemBurnTime != tile.getField(1))
            listener.sendWindowProperty(this, 1, tile.getField(1));
        if (totalCookTime != tile.getField(3))
            listener.sendWindowProperty(this, 3, tile.getField(3));
    }

    cookTime = tile.getField(2);
    furnaceBurnTime = tile.getField(0);
    currentItemBurnTime = tile.getField(1);
    totalCookTime = tile.getField(3);
}
 
開發者ID:jaquadro,項目名稱:GardenStuff,代碼行數:20,代碼來源:ContainerBloomeryFurnace.java

示例2: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:22,代碼來源:ContainerGui.java

示例3: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();

	if (this.colors == null)
		this.colors = new int[this.tileInventory.getFieldCount()];

	boolean updateField[] = new boolean[this.tileInventory.getFieldCount()];

	for (int i = 0; i < this.colors.length; i++) {
		if (this.colors[i] != this.tileInventory.getField(i)) {
			this.colors[i] = this.tileInventory.getField(i);
			updateField[i] = true;
		}
	}

	for (IContainerListener listener : this.listeners)
		for (int i = 0; i < this.tileInventory.getFieldCount(); i++)
			if (updateField[i])
				listener.sendWindowProperty(this, i, colors[i]);

}
 
開發者ID:oMilkyy,項目名稱:SimpleTubes,代碼行數:23,代碼來源:ContainerDisplacerFilter.java

示例4: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
/**
 * 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);

		if (this.cookTime != this.tileFurnace.getField(2))
			icontainerlistener.sendWindowProperty(this, 2, this.tileFurnace.getField(2));

		if (this.furnaceBurnTime != this.tileFurnace.getField(0))
			icontainerlistener.sendWindowProperty(this, 0, this.tileFurnace.getField(0));

		if (this.currentItemBurnTime != this.tileFurnace.getField(1))
			icontainerlistener.sendWindowProperty(this, 1, this.tileFurnace.getField(1));

		if (this.totalCookTime != this.tileFurnace.getField(3))
			icontainerlistener.sendWindowProperty(this, 3, this.tileFurnace.getField(3));
	}

	this.cookTime = this.tileFurnace.getField(2);
	this.furnaceBurnTime = this.tileFurnace.getField(0);
	this.currentItemBurnTime = this.tileFurnace.getField(1);
	this.totalCookTime = this.tileFurnace.getField(3);
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:29,代碼來源:ContainerAmmoFurnace.java

示例5: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for(IContainerListener listener : this.listeners) {
    	ItemStack weapon = this.mercenary.loadout.getStackInSlot(0);
    	int loaded = weapon.getItem() instanceof ItemWeapon ? weapon.getMaxDamage() - weapon.getItemDamage() : 0;
     if(this.primaryAmmo != this.mercenary.getAmmo(0)) {
     	this.primaryAmmo = this.mercenary.getAmmo(0);
     	//System.out.println("ammo in:");
     	listener.sendWindowProperty(this, 0, this.primaryAmmo);
     }
     weapon = this.mercenary.loadout.getStackInSlot(0);
    	loaded = weapon.getItem() instanceof ItemWeapon ? weapon.getMaxDamage() - weapon.getItemDamage() : 0;
     if(this.secondaryAmmo != this.mercenary.getAmmo(1) + loaded) {
     	this.secondaryAmmo = this.mercenary.getAmmo(1) + loaded;
     	listener.sendWindowProperty(this, 1, this.secondaryAmmo);
     }
    }
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:20,代碼來源:ContainerMercenary.java

示例6: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges()
{
	super.detectAndSendChanges();

	for (IContainerListener listener : listeners)
	{
		if (lastCookTime != tileEntity.cookTime)
		{
			listener.sendWindowProperty(this, 0, tileEntity.cookTime);
		}
		if (lastBurnTime != tileEntity.burnTime)
		{
			listener.sendWindowProperty(this, 1, tileEntity.burnTime);
		}
		if (lastItemBurnTime != tileEntity.currentItemBurnLength)
		{
			listener.sendWindowProperty(this, 2, tileEntity.currentItemBurnLength);
		}
	}

	lastBurnTime = tileEntity.burnTime;
	lastCookTime = tileEntity.cookTime;
	lastItemBurnTime = tileEntity.currentItemBurnLength;
}
 
開發者ID:einsteinsci,項目名稱:BetterBeginningsReborn,代碼行數:26,代碼來源:ContainerSpecializedFurnace.java

示例7: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	for (IContainerListener crafter : listeners) {
		MessageProgress msg = new MessageProgress(crafter);
		if (lastEnergy != te.getClientEnergyStored())
			msg.add(0, te.getClientEnergyStored());
		if (lastProgress != te.getField(0))
			crafter.sendWindowProperty(this, 1, te.getField(0));
		if (lastMaxProgress != te.getField(1))
			crafter.sendWindowProperty(this, 2, te.getField(1));
		msg.send();
	}
	sync.detectAndSendChanges(listeners);
	lastEnergy = te.getClientEnergyStored();
	lastProgress = te.getField(0);
	lastMaxProgress = te.getField(1);
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:19,代碼來源:ContainerMixer.java

示例8: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	for (IContainerListener crafter : listeners) {
		MessageProgress msg = new MessageProgress(crafter);
		if (lastEnergy != te.getClientEnergyStored())
			msg.add(0, te.getClientEnergyStored());
		// crafter.sendProgressBarUpdate(this, 0,
		// te.getClientEnergyStored());
		if (lastProgress != te.getField(0))
			crafter.sendWindowProperty(this, 1, te.getField(0));
		msg.send();
	}
	lastEnergy = te.getClientEnergyStored();
	lastProgress = te.getField(0);
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:17,代碼來源:ContainerCharger.java

示例9: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	for (IContainerListener crafter : listeners) {
		MessageProgress msg = new MessageProgress(crafter);
		if (te.getField(0) != linkedLast) {
			crafter.sendWindowProperty(this, 0, te.getField(0));
		}
		if (te.getField(1) != rangeLast) {
			crafter.sendWindowProperty(this, 1, te.getField(1));
		}
		if (te.getField(2) != powerLast) {
			// crafter.sendProgressBarUpdate(this, 2, te.getField(2));
			msg.add(2, te.getField(2));
		}
		if (te.rsMode.ordinal() != lastRS) {
			crafter.sendWindowProperty(this, 3, te.rsMode.ordinal());
		}
		msg.send();
	}
	lastRS = te.rsMode.ordinal();
	powerLast = te.getField(2);
	rangeLast = te.getField(1);
	linkedLast = te.getField(0);
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:26,代碼來源:ContainerForceCapacitor.java

示例10: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	for (IContainerListener crafter : listeners) {
		// if(lastEnergy !=
		// te.getClientEnergyStored())crafter.sendProgressBarUpdate(this, 0,
		// te.getClientEnergyStored());
		if (lastProgress != te.getField(0))
			crafter.sendWindowProperty(this, 0, te.getField(0));
		// if(lastMaxProgress !=
		// te.getField(1))crafter.sendProgressBarUpdate(this, 2,
		// te.getField(1));
	}
	// lastEnergy = te.getClientEnergyStored();
	lastProgress = te.getField(0);
	// lastMaxProgress = te.getField(1);
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:18,代碼來源:ContainerAdvSteamFurnace.java

示例11: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	for (IContainerListener crafter : listeners) {
		MessageProgress msg = new MessageProgress(crafter);
		if (lastEnergy != te.getClientEnergyStored())
			msg.add(0, te.getClientEnergyStored());
		// crafter.sendProgressBarUpdate(this, 0,
		// te.getClientEnergyStored());
		if (lastProgress != te.getField(0))
			crafter.sendWindowProperty(this, 1, te.getField(0));
		if (lastMaxProgress != te.getField(1))
			crafter.sendWindowProperty(this, 2, te.getField(1));
		msg.send();
	}
	lastEnergy = te.getClientEnergyStored();
	lastProgress = te.getField(0);
	lastMaxProgress = te.getField(1);
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:20,代碼來源:ContainerUVLightbox.java

示例12: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	int heat = MathHelper.floor(te.getHeat());
	int progress = MathHelper.floor(((double) te.getProgress()) / TileEntityRubberBoiler.MAX_PROGRESS * 100);
	for (IContainerListener crafter : listeners) {
		if (this.heat != heat)
			crafter.sendWindowProperty(this, 0, heat);
		if (this.lastProgress != progress)
			crafter.sendWindowProperty(this, 1, progress);
		if (this.maxHeat != te.maxHeat)
			crafter.sendWindowProperty(this, 2, te.maxHeat);
	}
	sync.detectAndSendChanges(listeners);
	this.heat = heat;
	this.lastProgress = progress;
	this.maxHeat = te.maxHeat;
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:19,代碼來源:ContainerRubberBoiler.java

示例13: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	int compiledEditingCard = te.getCompiledRightsFromEditingCard();
	for (IContainerListener crafter : listeners) {
		if (te.getField(0) != powerLast) {
			crafter.sendWindowProperty(this, 0, te.getField(0));
		}
		if (te.rsMode.ordinal() != lastRS) {
			crafter.sendWindowProperty(this, 2, te.rsMode.ordinal());
		}

		if (compiledEditingCard != this.cardLast) {
			crafter.sendWindowProperty(this, 1, compiledEditingCard);
		}
	}
	powerLast = te.getField(2);
	this.cardLast = compiledEditingCard;
	lastRS = te.rsMode.ordinal();
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:21,代碼來源:ContainerSecurityStation.java

示例14: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	int bucket = te.getProperties().useContainerItems ? 1 : 0, storedOnly = te.getProperties().storedOnly ? 1 : 0,
			time = te.getProperties().time;
	NBTTagCompound tag = new NBTTagCompound();
	writeToNBT(tag);
	boolean equals = tag.equals(tagLast);
	for (IContainerListener crafter : listeners) {
		if (bucket != lastBucket)
			crafter.sendWindowProperty(this, 0, bucket);
		if (storedOnly != lastStoredOnly)
			crafter.sendWindowProperty(this, 1, storedOnly);
		if (time != lastTime)
			crafter.sendWindowProperty(this, 2, time);
		if (!equals)
			sendTo(crafter, tag);
	}
	lastBucket = bucket;
	lastStoredOnly = storedOnly;
	lastTime = time;
	tagLast = tag;
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:24,代碼來源:ContainerPatternOptions.java

示例15: detectAndSendChanges

import net.minecraft.inventory.IContainerListener; //導入方法依賴的package包/類
@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();
	int progress = te.getField(1) > 0 ? MathHelper.floor((1 - (((float) te.getField(0)) / te.getField(1))) * MAX_PROGRESS) : 0;
	for (IContainerListener crafter : listeners) {
		if (progress != lastProgress) {
			crafter.sendWindowProperty(this, 0, progress);
		}
		if (te.getField(2) != lastSolderingAlloy) {
			crafter.sendWindowProperty(this, 1, te.getField(2));
		}
		if (te.craftingError != craftingErrorLast) {
			crafter.sendWindowProperty(this, 2, te.craftingError);
		}
		if (te.getField(3) != lastEnergy) {
			crafter.sendWindowProperty(this, 3, te.getField(3));
		}
	}
	lastProgress = progress;
	lastSolderingAlloy = te.getField(2);
	craftingErrorLast = te.craftingError;
	lastEnergy = te.getField(3);
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:24,代碼來源:ContainerSolderingStation.java


注:本文中的net.minecraft.inventory.IContainerListener.sendWindowProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。