Jump to content

1.5.1 Custom Furnace Error


deadrecon98

Recommended Posts

Hey I Just myself recently made a Custom Furnace,

 

for the Textures did you copy the code straight from the BlockFurnace.class.

 

Example of my code and what was from the BlockFurnace Class. (May help with texture glitch)

 

 

    @SideOnly(Side.CLIENT)

    /**
     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
     */
    public Icon getIcon(int par1, int par2)
    {
        return par1 == 1 ? this.furnaceIconTop : (par1 == 0 ? this.furnaceIconTop : (par1 != par2 ? this.blockIcon : this.furnaceIconFront));
    }

    @SideOnly(Side.CLIENT)

    /**
     * When this method is called, your block should register all the icons it needs with the given IconRegister. This
     * is the only chance you get to register icons.
     */
    public void registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = par1IconRegister.registerIcon("NetherCraft:sideFurnace");
        this.furnaceIconFront = par1IconRegister.registerIcon(this.isActive ? "NetherCraft:activeFurnace" : "NetherCraft:inactiveFurnace");
        this.furnaceIconTop = par1IconRegister.registerIcon("NetherCraft:sideFurnace");
    }

 

 

Link to comment
Share on other sites

Hey I Just myself recently made a Custom Furnace,

 

for the Textures did you copy the code straight from the BlockFurnace.class.

 

Example of my code and what was from the BlockFurnace Class. (May help with texture glitch)

 

 

    @SideOnly(Side.CLIENT)

    /**
     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
     */
    public Icon getIcon(int par1, int par2)
    {
        return par1 == 1 ? this.furnaceIconTop : (par1 == 0 ? this.furnaceIconTop : (par1 != par2 ? this.blockIcon : this.furnaceIconFront));
    }

    @SideOnly(Side.CLIENT)

    /**
     * When this method is called, your block should register all the icons it needs with the given IconRegister. This
     * is the only chance you get to register icons.
     */
    public void registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = par1IconRegister.registerIcon("NetherCraft:sideFurnace");
        this.furnaceIconFront = par1IconRegister.registerIcon(this.isActive ? "NetherCraft:activeFurnace" : "NetherCraft:inactiveFurnace");
        this.furnaceIconTop = par1IconRegister.registerIcon("NetherCraft:sideFurnace");
    }

 

 

Thats the same as mine... Wonder whats going on there.

Link to comment
Share on other sites

A) The @Mod annotation has to be above the @NetworkMod annotation.

B) You need to have a client packet handler and a server packet handler. Replace you @NetworkMod annotation with this:

@NetworkMod(clientSideRequired = true, serverSideRequired = false, clientPacketHandlerSpec = @SidedPacketHandler(channels = UCReferences.CHANNEL_NAME, packetHandler = ClientPacketHandler.class), serverPacketHandlerSpec = @SidedPacketHandler(channels = UCReferences.CHANNEL_NAME, packetHandler = ServerPacketHandler.class))

and change the ClientPacketHandler.class with your client packet handler class and the ServerPacketHandler.class with your server packet handler class

 

Also, put this in your client packet handler class:

 

package com.larsg310.uc.core.handlers;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;

public class ClientPacketHandler implements IPacketHandler
{
    @Override
    public void onPacketData(INetworkManager manager, Packet250CustomPayload payload, Player player)
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(payload.data));
    }
}

 

 

And put this in your server packet handler class:

 

package com.larsg310.uc.core.handlers;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;

public class ServerPacketHandler implements IPacketHandler
{
    @Override
    public void onPacketData(INetworkManager manager, Packet250CustomPayload payload, Player player)
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(payload.data));
        EntityPlayer sender = (EntityPlayer) player;
    }
}

 

 

This code is from my mod and it works for me.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

A) The @Mod annotation has to be above the @NetworkMod annotation.

B) You need to have a client packet handler and a server packet handler. Replace you @NetworkMod annotation with this:

@NetworkMod(clientSideRequired = true, serverSideRequired = false, clientPacketHandlerSpec = @SidedPacketHandler(channels = UCReferences.CHANNEL_NAME, packetHandler = ClientPacketHandler.class), serverPacketHandlerSpec = @SidedPacketHandler(channels = UCReferences.CHANNEL_NAME, packetHandler = ServerPacketHandler.class))

and change the ClientPacketHandler.class with your client packet handler class and the ServerPacketHandler.class with your server packet handler class

 

Also, put this in your client packet handler class:

 

package com.larsg310.uc.core.handlers;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;

public class ClientPacketHandler implements IPacketHandler
{
    @Override
    public void onPacketData(INetworkManager manager, Packet250CustomPayload payload, Player player)
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(payload.data));
    }
}

 

 

And put this in your server packet handler class:

 

package com.larsg310.uc.core.handlers;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;

public class ServerPacketHandler implements IPacketHandler
{
    @Override
    public void onPacketData(INetworkManager manager, Packet250CustomPayload payload, Player player)
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(payload.data));
        EntityPlayer sender = (EntityPlayer) player;
    }
}

 

 

This code is from my mod and it works for me.

 

Thank you it seems that the tutorial I followed was wrong.

Link to comment
Share on other sites

Does it actually work now? Cause i've made a new furnace and mine can't smelt the items. Do you mind taking a look at my code? It's on this thread: http://www.minecraftforge.net/forum/index.php/topic,8381.0.html

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

  • 2 months later...

Hey I Just myself recently made a Custom Furnace,

 

for the Textures did you copy the code straight from the BlockFurnace.class.

 

Example of my code and what was from the BlockFurnace Class. (May help with texture glitch)

 

 

    @SideOnly(Side.CLIENT)

    /**
     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
     */
    public Icon getIcon(int par1, int par2)
    {
        return par1 == 1 ? this.furnaceIconTop : (par1 == 0 ? this.furnaceIconTop : (par1 != par2 ? this.blockIcon : this.furnaceIconFront));
    }

    @SideOnly(Side.CLIENT)

    /**
     * When this method is called, your block should register all the icons it needs with the given IconRegister. This
     * is the only chance you get to register icons.
     */
    public void registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = par1IconRegister.registerIcon("NetherCraft:sideFurnace");
        this.furnaceIconFront = par1IconRegister.registerIcon(this.isActive ? "NetherCraft:activeFurnace" : "NetherCraft:inactiveFurnace");
        this.furnaceIconTop = par1IconRegister.registerIcon("NetherCraft:sideFurnace");
    }

 

 

 

this actual worked so i can get my own furnace texture.

 

but why does the block show in your hand only with top textures and side texture .. and not like the funace texture it shows the front also ??

how so i fix this??

 

also in creative tabs it shows with top and side textures only ...

 

meanwhile when you place it it does have the front texture i put in and the active front texture when its burning..

so only when your holding it or seeing it in creative tab .. it dusnt show like the furnace.

 

 

it was the same btw with the vanilla textures and skin ... (with custom furnace)

 

 

greets

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.