Jump to content

Custom Furnace GUI issue 1.7.10 RESOLVED


INTENSS

Recommended Posts

this is for 1.7.10

 

I've created a custom furnace and almost everything works great, when its in idle state (not cooking) I right click and the GUI opens perfectly and everything works. Now when it is cooking (active state) and I try to open the GUI it crashes my game. only thing I'm getting from the crash report is:

 

Ticking memory connection

 

java.lang.ClassCastException: com.INTENSS.BTP.TileEntities.MagFurnaceTE cannot be cast to net.minecraft.tileentity.TileEntityFurnace

 

this is my onBlockActivated() snipplet:

 

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float hitX, float hitY, float hitZ) {
	if (!world.isRemote) {
		FMLNetworkHandler.openGui(player, MainRegistry.instance, MainRegistry.guiIDMagFurnace, world, x, y, z);
	} 

	return true;
}

 

I can provide any further information requested. I've poured over my code and can't seem to locate an issue. Has anyone else had this problem? Any suggestions will be appreciated.

Link to comment
Share on other sites

GUI code

 

import org.lwjgl.opengl.GL11;

import com.INTENSS.BTP.Containers.ContainerMagFurnace;
import com.INTENSS.BTP.TileEntities.MagFurnaceTE;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerFurnace;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.ResourceLocation;

@SideOnly(Side.CLIENT)
public class FurnaceGui extends GuiContainer {

public static final ResourceLocation GuiTexture = new ResourceLocation("btp:textures/gui/mag_furnace.png");
    public MagFurnaceTE magFurnace;

    public FurnaceGui(InventoryPlayer player, MagFurnaceTE entity)
    {
        super(new ContainerMagFurnace(player, entity));
        this.magFurnace = entity;
    }

    protected void drawGuiContainerForegroundLayer(int i, int j)
    {
        String s = this.magFurnace.hasCustomInventoryName() ? this.magFurnace.getInventoryName() : I18n.format(this.magFurnace.getInventoryName(), new Object[0]);
        this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
        this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
    }

    protected void drawGuiContainerBackgroundLayer(float a, int i, int j)
    {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.mc.getTextureManager().bindTexture(GuiTexture);
        int k = (this.width - this.xSize) / 2;
        int l = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);

        if (this.magFurnace.isBurning())
        {
            int i1 = this.magFurnace.getBurnTimeRemainingScaled(13);
            this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
            i1 = this.magFurnace.getCookProgressScaled(24);
            this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
        }
    }

}

Link to comment
Share on other sites

I just through all the code again for the the furnace and not once amd I casting my MagFurnaceTE to TileEntityFurnace, its odd because it only crashes when its in it's active state and works perfect when in inactive state

 

 

update: it also crashes when I break it while active but does not while inactive.

Link to comment
Share on other sites

well I've been testing and decided to create some cheap textures (I normally do this last) to verify that my block was in fact the block being placed. My custom INACTIVE furnace is being place, can be broken, GUI opens ect.. but when I throw fuel and an item to cook/smelt it updates the block with the vanilla minecraft block then crashes if I right or left click it, which really has me confused. I've went over this code for hours now and I KNOW I'm not casting to that vanilla block anywhere at all...

Link to comment
Share on other sites

I've resolved the crashing issue so the game no longer crashes and the GUI opens a functions regardless of the state. I WAS in fact calling BlockFurnace in the updateEntity() method. now that I switched and fixed the main issue my MagFurnace Block no longer updates to active when it is cooking and the particles have stopped displaying. These are minor issue I can figure out. Thanks for trying to help shadowfacts

Link to comment
Share on other sites

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.