Jump to content

Recommended Posts

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]

Posted

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

Posted

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]

Posted

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]

Posted

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]

Posted

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]

Posted

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]

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.