Eldria Posted February 18, 2013 Posted February 18, 2013 hello i have a problem with updateCraftingResults() and i dont know how i can fix this can anyone help me to fix this ?? here is the code: import net.minecraft.entity.player.*; import net.minecraft.inventory.*; import net.minecraft.item.*; public class BaseContainer extends Container { public void addPlayerSlots(EntityPlayer player, int x, int y) { InventoryPlayer inventory = player.inventory; for (int var3 = 0; var3 < 3; ++var3) for (int var4 = 0; var4 < 9; ++var4) this.addSlotToContainer(new Slot(inventory, var4 + var3 * 9 + 9, x + var4 * 18, y + var3 * 18)); for (int var3 = 0; var3 < 9; ++var3) this.addSlotToContainer(new Slot(inventory, var3, x + var3 * 18, y + 58)); } @Override public boolean canInteractWith(EntityPlayer var1) { return true; } @Override public void updateCraftingResults() { super.updateCraftingResults(); for (int i = 0; i < crafters.size(); i++) { ICrafting crafter = (ICrafting)crafters.get(i); sendStateTo(crafter); } } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { return null; } void sendStateTo(ICrafting crafter) { } public void updateProgressBar(int i, int value) { } } Quote
gcewing Posted February 18, 2013 Posted February 18, 2013 This looks like my BaseContainer class from SGCraft. It's meant to be used by subclassing it and overriding the sendStateTo() and updateProgressBar() methods. For example, here's how the stargate container class communicates the stargate's fuel level from server to client: public class SGBaseContainer extends BaseContainer { ... SGBaseTE te; // the stargate's tile entity ... @Override void sendStateTo(ICrafting crafter) { crafter.sendProgressBarUpdate(this, 0, te.fuelBuffer); } @Override public void updateProgressBar(int i, int value) { switch (1) { case 0: te.fuelBuffer = value; break; } } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.