Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Так и дело в том что тяжело объяснить.Liahim написал(а):Пиши сразу, в чём беда. Скорее ответят.
мой ContainerLiahim написал(а):Кажется, догадываюсь, что за беда с 1-м слотом...
Ты один из имеющихся убрал, а слоты игрока не перенумеровывал... Вот и беда с ними.
1-й слот игрока должен идти сразу за последним слотом печки.
public class ContainerInputFurnace extends Container
{
private TileEntityInputFurnace blast;
private int dualCookTime = 0;
private int dualBurnTime = 0;
private int lastItemBurnTime = 0;
public ContainerInputFurnace(InventoryPlayer inventoryplayer, TileEntityInputFurnace tileentityInputFurnace)
{
this.blast = tileentityInputFurnace;
//this.addSlotToContainer(new Slot(tileentityInputFurnace, 0, 56, 17));
this.addSlotToContainer(new Slot(tileentityInputFurnace, 1, 56, 53));
this.addSlotToContainer(new SlotFurnace(inventoryplayer.player, tileentityInputFurnace, 2, 116, 35));
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(inventoryplayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(inventoryplayer, i, 8 + i * 18, 142));
}
}
public void addCraftingToCrafters(ICrafting par1ICrafting)
{
super.addCraftingToCrafters(par1ICrafting);
par1ICrafting.sendProgressBarUpdate(this, 0, this.blast.dualCookTime);
par1ICrafting.sendProgressBarUpdate(this, 1, this.blast.dualBurnTime);
par1ICrafting.sendProgressBarUpdate(this, 2, this.blast.currentItemBurnTime);
}
/**
* Looks for changes made in the container, sends them to every listener.
*/
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i)
{
ICrafting icrafting = (ICrafting)this.crafters.get(i);
if (this.dualCookTime != this.blast.dualCookTime)
{
icrafting.sendProgressBarUpdate(this, 0, this.blast.dualCookTime);
}
if (this.dualBurnTime != this.blast.dualBurnTime)
{
icrafting.sendProgressBarUpdate(this, 1, this.blast.dualBurnTime);
}
if (this.lastItemBurnTime != this.blast.currentItemBurnTime)
{
icrafting.sendProgressBarUpdate(this, 2, this.blast.currentItemBurnTime);
}
}
this.dualCookTime = this.blast.dualCookTime;
this.dualBurnTime = this.blast.dualBurnTime;
this.lastItemBurnTime = this.blast.currentItemBurnTime;
}
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2)
{
if (par1 == 0)
{
this.blast.dualCookTime = par2;
}
if (par1 == 1)
{
this.blast.dualBurnTime = par2;
}
if (par1 == 2)
{
this.blast.currentItemBurnTime = par2;
}
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.blast.isUseableByPlayer(par1EntityPlayer);
}
/**
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
*/
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(par2);
if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (par2 == 2)
{
if (!this.mergeItemStack(itemstack1, 3, 39, true))
{
return null;
}
slot.onSlotChange(itemstack1, itemstack);
}
else if (par2 != 1 && par2 != 0)
{
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null)
{
if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null;
}
}
else if (TileEntityFurnace.isItemFuel(itemstack1))
{
if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null;
}
}
else if (par2 >= 3 && par2 < 30)
{
if (!this.mergeItemStack(itemstack1, 30, 39, false))
{
return null;
}
}
else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{
return null;
}
}
else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{
return null;
}
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
else
{
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize)
{
return null;
}
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
}
return itemstack;
}
}
if (!this.mergeItemStack(itemstack1, 3, 39, true))
не в этом тоже..Liahim написал(а):А нет, я ошибся... Беда не в ID слотов, а, скорее всего в методе transferStackInSlot.
Как пример, строка:
Код:if (!this.mergeItemStack(itemstack1, 3, 39, true))
говорит о том, что слоты игрока у тебя с 3-го по 39-й, хотя по факту они у тебя со 2-го по 38-й.
Вот и исправляй все подобные места...
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(par2);
if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (par2 == 2)
{
if (!this.mergeItemStack(itemstack1, 2, 38, true))
{
return null;
}
slot.onSlotChange(itemstack1, itemstack);
}
else if (par2 != 1 && par2 != 0)
{
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null)
{
if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null;
}
}
else if (TileEntityFurnace.isItemFuel(itemstack1))
{
if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null;
}
}
else if (par2 >= 2 && par2 < 30)
{
if (!this.mergeItemStack(itemstack1, 30, 38, false))
{
return null;
}
}
else if (par2 >= 30 && par2 < 38 && !this.mergeItemStack(itemstack1, 2, 30, false))
{
return null;
}
}
else if (!this.mergeItemStack(itemstack1, 3, 38, false))
{
return null;
}
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
else
{
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize)
{
return null;
}
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
}
return itemstack;
}
}