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

Did you register your GUIHandler?  I can't seem to find the class for the GUIHandler.

You Only Live Once, So Win At Golf.

Sorry for my English, I'm American.

  • Author

  • You open the Gui on the client only, it should be server only

Can you explain a bit more on this?

  • Author

Ah, I'm such a noob... Nearly everything is fixed now, except the furnace isn't working. It consumes fuel but doesn't melt any items. I am working on this with a friend of mine, and I don't know quite as much java as he does, so he does all the OpenGL stuff.

Well take a look at net.minecraft.block.BlockFurnace, it may help you out.

Basicly if the fuel burn time isnt 0 then increase cook timer, if cook timer == 300 then reset cook timer and delete one item from the "to be cooked" slot and add x of the result items to the "already cooked" slot

  • Author

Well take a look at net.minecraft.block.BlockFurnace, it may help you out.

Basicly if the fuel burn time isnt 0 then increase cook timer, if cook timer == 300 then reset cook timer and delete one item from the "to be cooked" slot and add x of the result items to the "already cooked" slot

 

That's exactly what's written here:

 

	private static int getItemBurnTime(ItemStack itemstack) {
	if(itemstack == null){
		return 0;
	}else{
		Item item = itemstack.getItem();
		if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
			Block block = Block.getBlockFromItem(item);
			if(block == main.aniteBlock) return 216000;
		}
		if(item == main.aniteChunk) return 24000;
	}
	return GameRegistry.getFuelValue(itemstack);
}
public boolean isBurning() {
	return this.burnTime > 0;
}
public void updateEntity() {
	boolean flag = this.burnTime > 0;
	boolean flag1 = false;
	if(this.isBurning()) {
		this.burnTime--;
	}

	if(this.burnTime == 0 && this.canSmelt()) {
		this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.slots[1]);
		if(this.isBurning()) {
			flag1 = true;
			if(this.slots[1] != null) {
				this.slots[1].stackSize--;
				if(this.slots[1].stackSize == 0) {
					this.slots[1] = this.slots[1].getItem().getContainerItem(this.slots[1]);
				}
			}
		}
		if(this.isBurning() && this.canSmelt()) {
			this.cookTime++;
			if(this.cookTime == this.furnaceSpeed) {
				this.cookTime = 0;
				this.smeltItem();
				flag1 = true;
			}
		}else{
			this.cookTime = 0;
		}
		if(flag != this.isBurning()) {
			flag1 = true;
			compressedBlock.updateCompressedBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
		}
	}
	if(flag1) {
		this.markDirty();
	}	
}

private boolean canSmelt() {
	if (this.slots[0] == null) {
		return false;
	} else {
		ItemStack itemstack = CompressedBlockRecipes.smelting().getSmeltingResult(this.slots[0]);
		if (itemstack == null) return false;
		if (this.slots[2] == null) return true;
		if (!this.slots[2].isItemEqual(itemstack)) return false;
		int result = slots[2].stackSize + itemstack.stackSize;
		return result <= getInventoryStackLimit() && result <= this.slots[2].getMaxStackSize();
	}
}
public void smeltItem() {
	if (this.canSmelt()) {
		ItemStack itemstack = CompressedBlockRecipes.smelting().getSmeltingResult(this.slots[0]);
		if (this.slots[2] == null) {
			this.slots[2] = itemstack.copy();
		} else if (this.slots[2].getItem() == itemstack.getItem()) {
			this.slots[2].stackSize += itemstack.stackSize;
		}
		--this.slots[0].stackSize;
		if(this.slots[0].stackSize >= 0){
			this.slots[0] = null;
		}
	}
}

 

AFAIK there is not any errors here... halp?

Guest
This topic is now closed to further replies.

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.