Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

}

 

}

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.