Jump to content

Recommended Posts

Posted

Hey there all! I know this is probably going to be something silly that I'm missing, so I'll apologize ahead of time if it is- I just need another pair of eyes to look at this code and point out what I'm doing wrong cause I've been staring at it so long, that I think I'm just glazing over it. I managed to get my custom block model to render fine, but I seem unable to get it to use the correct texture. Here is the code for the rendering, proxies, etc, and a link to my github so you can sneak a peak at the package and file structure to see where the images are located. Any help would be IMMENSELY appreciated as this has been driving me nuts all week.

 

Github: https://github.com/Wolfofthenyght/MysticGems

 

I'm also having an issue getting the GUI for the block to working, so if someone wants to chime in on that, I'd be appreciative as well!

 

BlockGemFuser:

 

package com.nyghtwolf.gemworks.block;

import com.nyghtwolf.gemworks.creativetab.CreativeTabGemworks;
import com.nyghtwolf.gemworks.gemworks;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class BlockGemFuser extends BlockContainer
{
    public BlockGemFuser()
    {
        super(Material.iron);

        this.setHardness(2.0F);
        this.setResistance(8.0F);
        this.setBlockName("GemFuser");
        this.setBlockTextureName("GemFuser");
        this.setCreativeTab(CreativeTabGemworks.Gemworks_Tab);
        this.setBlockBounds(0F, 0F, 0F, 1F, 0.95F, 1F);
    }

    @Override
    public TileEntity createNewTileEntity(World var1, int var2) {
        return new TileEntityGemFuser();
    }

    public int getRenderType(){
        return -1;
    }

    public boolean isOpaqueCube() {
        return false;
    }

    public boolean renderAsNormalBlock(){
        return false;
    }

    @SideOnly(cpw.mods.fml.relauncher.Side.CLIENT)
    public void registerBlockIcons(IIconRegister iconRegister){
        this.blockIcon = iconRegister.registerIcon(gemworks.modid + ":" + this.getUnlocalizedName().substring(5));
    }

    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){

        if (world.isRemote){
            return false;
        }

        else{
            //FMLNetworkHandler.openGui(player, gemworks.instance, gemworks.GuiGemfuser, world, x, y, z);
            player.openGui(player, gemworks.GuiGemfuser, world, x, y, z);
            return true;
        }

    }

}

 

 

TileEntityGemFuser:

 

package com.nyghtwolf.gemworks.block;

import net.minecraft.tileentity.TileEntity;

public class TileEntityGemFuser extends TileEntity {

}

 

 

ModTileEntities (Initialization):

 

package com.nyghtwolf.gemworks.init;

import com.nyghtwolf.gemworks.block.TileEntityGemFuser;
import com.nyghtwolf.gemworks.reference.Reference;
import cpw.mods.fml.common.registry.GameRegistry;

@GameRegistry.ObjectHolder(Reference.MOD_ID)

//Initialize Tile Entities
public class ModTileEntities
{
    public static void init()
    {

    GameRegistry.registerTileEntity(TileEntityGemFuser.class, ModBlocks.GemFuser.getUnlocalizedName());

    }
}

 

 

ClientProxy:

 

package com.nyghtwolf.gemworks.proxy;

import com.nyghtwolf.gemworks.block.TileEntityGemFuser;
import com.nyghtwolf.gemworks.render.RenderGemFuser;
import cpw.mods.fml.client.registry.ClientRegistry;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

public class ClientProxy extends CommonProxy {

    public void registerRenderThings(){
        //Gem Fuser Render
        TileEntitySpecialRenderer render = new RenderGemFuser();
        ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGemFuser.class, render);
    }

    public void registerTileTEntitySpecialRenderer(){

    }
}

 

 

ModBlocks:

 

package com.nyghtwolf.gemworks.init;

import com.nyghtwolf.gemworks.block.BlockGemFuser;
import com.nyghtwolf.gemworks.block.BlockGemworks;
import com.nyghtwolf.gemworks.block.BlockMysticInfuser;
import com.nyghtwolf.gemworks.reference.Reference;
import cpw.mods.fml.common.registry.GameRegistry;

@GameRegistry.ObjectHolder(Reference.MOD_ID)

public class ModBlocks
{
    //public static final Block GemFuser = new BlockGemFuser();
    public static final BlockGemworks MysticInfuser = new BlockMysticInfuser();
    public static final BlockGemFuser GemFuser = new BlockGemFuser();

    public static void init(){

        GameRegistry.registerBlock(GemFuser, "GemFuser");
        GameRegistry.registerBlock(MysticInfuser, "MysticInfuser");

    }
}

 

Posted

Hi

 

Just a guess - try replacing your this.bindTexture() with

      Minecraft.getMinecraft().renderEngine.bindTexture(textureGemFuser);

 

perhaps the TextureManager in your TESR hasn't been set

 

-TGG

Posted

Your texture is in assets/model but it should be in assets/textures/model

 

AHA!! That did it :D Thank you SO much. I'm so silly, I can't believe I missed that! I knew I had just been staring at it for too long xD

 

Now to figure out how to get the GUI to work ;_;

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.