Jump to content

Recommended Posts

Posted

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) {

}

 

}

 

Posted

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;
	}
}

}

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.