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

I am making a furnace that will produce power, called a 'power furnace.'

I would like to have the textures update based on whether the furnace is burning or not.

To do this, i used metadata. 0-3 directionals off, 4-7 directionals on

However, when I place fuel in the tile entity, the textures on the x axis start to flicker, and the the front texture, no matter what side. They seem to be changing metadata and my console proves it.

Although the furnace should be burning, the metadata output i coded in shows 0 most of the time, sometimes jumping to 3, back to 0, sometimes to 7, back to 0, and then sometime to 11. It shouldnt be going that high.

 

TileEntity:

https://github.com/KeeganDeathman/LabStuff/blob/master/java/keegan/LabStuff/tileentity/TileEntityPowerFurnace.java

BlockPowerFurnace:

https://github.com/KeeganDeathman/LabStuff/blob/master/java/keegan/LabStuff/blocks/BlockPowerFurnace.java

 

It shouldn't be doing this, should it?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

  • Author

the burn time if-else chain is because i do not think you can have a case for >0, if you can, IDK.

Also no switch statements for booleans.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Switch statements have a "default" case which handles all cases you don't explicitly specify.

 

int number;
...
switch (number) {
case 0:
	// do thing given number == 0
	break;
case 1:
	// do thing given number ==1
	break;
default:
	// do thing for all unspecified cases
	break;
}

  • Author

I guess it might have helped some, but there was no noticeable difference when I restricted the operations of updateEntity to just the server.

I'd also like to pint out the following:

 

side1 is the top/bottom texture as well as the default

side2 is the sides and back texture

side3 is the front when off

side3On is the front while on

 

The textures facing east and west will flicker between their correct state(except the front, which should be side3On, but shows side3, but that may be a problem with the burnTime) and side1.

If the side3 is facing north it flickers between side3 and side3On

If the side3 is facing south, it flickers between side3 and side2, and the back flickers between side2 and side1

 

MrCaracal thank you. I will update my code.

disesiben07 I will try that

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

  • Author

diesienben07 regarding your latest post, I have updated the code regarding that, if it detects more fuel it sets it back to true in the same tick.

 

Swapping out the if-else chains with switch statements seems to have stopped the flickering, but now the burn time is acting odd.

The console shows the bt increasing and decreasing appropriately. However, the fuel is eaten up automatically, and the gui counter and the textures both indicate 0.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

  • Author

I dont have that source linked. Do you?

Either way, the getIconOff and getIconOn are different, in the terms of which metadata is being checked.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

  • Author

Regarding the source, tell me how to do that.

Regarding the icons. Yep, just saw that. Thing is when i switched back to if-else from switch statements in the TE, it started flickering again.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

  • Author

Shut up i figured the source out. Google!

After MrCaracal explained default.

I ended up changing it back due to thinking that was a problem, but I may just change it back.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

  • Author

Okay so for the container I would guess I need to sync the server's tile entity with the client's tile entity?

I found these two...

public void addCraftingToCrafters(ICrafting p_75132_1_)
    {
        super.addCraftingToCrafters(p_75132_1_);
        p_75132_1_.sendProgressBarUpdate(this, 0, this.tileFurnace.furnaceCookTime);
        p_75132_1_.sendProgressBarUpdate(this, 1, this.tileFurnace.furnaceBurnTime);
        p_75132_1_.sendProgressBarUpdate(this, 2, this.tileFurnace.currentItemBurnTime);
    }

 

@SideOnly(Side.CLIENT)
    public void updateProgressBar(int p_75137_1_, int p_75137_2_)
    {
        if (p_75137_1_ == 0)
        {
            this.tileFurnace.furnaceCookTime = p_75137_2_;
        }

        if (p_75137_1_ == 1)
        {
            this.tileFurnace.furnaceBurnTime = p_75137_2_;
        }

        if (p_75137_1_ == 2)
        {
            this.tileFurnace.currentItemBurnTime = p_75137_2_;
        }
    }

 

Would I use these to make my gui get the proper burn time, or am I grasping at non-existent hooks.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

  • Author

I am wondering how I would get it to continousley update,

I have it working, but you get whatever the burnTime was at the opening of the gui.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

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.