Jump to content

[1.10.2] Block renders on world but not in hand


American2050

Recommended Posts

Yes I know, this has been asked in forever I believe, but everything I found and read didn't helped me.

 

I must be missing some minor detail that I don't know of and that's why I'm having this problem. Weird enough on the same Mod I have another block that works perfectly. I'm sure the problem is because it's a furnace with 4 variants and I must be missing something for when I register it as an item, but dunno what.

 

Here are the .json and the way I register the block. PS: As for now I'm using the vanilla textures until I fix this ;)

 

block_aim_furnace.json (on assets/aim/blockstates)

 

{
    "variants": {
        "facing=north": { "model": "aim:block_aim_furnace" },
        "facing=south": { "model": "aim:block_aim_furnace", "y": 180 },
        "facing=west":  { "model": "aim:block_aim_furnace", "y": 270 },
        "facing=east":  { "model": "aim:block_aim_furnace", "y": 90 }
    }
}

 

block_aim_furnace.json (on assets/aim/models/block)

 

{
    "parent": "block/orientable",
    "textures": {
        "top": "blocks/furnace_top",
        "front": "blocks/furnace_front_off",
        "side": "blocks/furnace_side"
    }
}

 

block_aim_furnace.json (on assets/aim/models/item)

 

{
    "parent": "aim:block/block_aim_furnace"
}

 

 

The register:

 

public class ModBlocks {

//CREATE THE BLOCKS
public static final Block BLOCK_CHAMBER = new BlockChamber(Material.IRON, "block_chamber");
public static final Block AIM_FURNACE = new BlockAIMFurnace("block_aim_furnace", false);
//	public static final Block AIM_FURNACE_LIT = new BlockAIMFurnace("block_aim_furnace_lit", true);

public static void registerBlocks() {

	registerBlock(BLOCK_CHAMBER);

	registerBlock(AIM_FURNACE);
//		registerBlock(AIM_FURNACE_LIT);



}

//This gets called on ClientPoxy
public static void registerRenders() {

	registerRender(BLOCK_CHAMBER);

	registerRender(AIM_FURNACE);
//		registerRender(AIM_FURNACE_LIT);

}


public static void registerBlock(Block block) {
	GameRegistry.register(block);
	GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}

public static void registerRender(Block block) {
	ModelResourceLocation modelLocation = new ModelResourceLocation(block.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(block.getDefaultState()),  modelLocation);
}

}

 

At this point I don't know what I could be missing.

 

On the Block:

 

    public int getMetaFromState(IBlockState state)
    {
        return ((EnumFacing)state.getValue(FACING)).getIndex();
    }

 

^^That returns 2 for the furnace.

 

yVLfMhz.png

Link to comment
Share on other sites

You need an inventory variant.  You'd know this if you read the log.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You need an inventory variant.  You'd know this if you read the log.

 

I tried that earlier today and didn't helped either... Unless I did it wrong.

 

Like this?

 

block_aim_furnace.json (on assets/aim/blockstates)

{
    "variants": {
        "facing=north": { "model": "aim:block_aim_furnace" },
        "facing=south": { "model": "aim:block_aim_furnace", "y": 180 },
        "facing=west":  { "model": "aim:block_aim_furnace", "y": 270 },
        "facing=east":  { "model": "aim:block_aim_furnace", "y": 90 },
        "inventory": { "model": "aim:block_aim_furnace" }
    }
}

 

PS: I check the log and the word "furnace" is not on it, neither is "inventory" or any report of missing texture or variant.

 

This is the .json of my other block that did work:

 

{
    "variants": {
        "hasore=false": { "model": "aim:block_chamber" },
        "hasore=true": { "model": "aim:block_chamber" }
    }
}

Link to comment
Share on other sites

You need an inventory variant.  You'd know this if you read the log.

 

I tried that earlier today and didn't helped either... Unless I did it wrong.

 

Like this?

 

block_aim_furnace.json (on assets/aim/blockstates)

{
    "variants": {
        "facing=north": { "model": "aim:block_aim_furnace" },
        "facing=south": { "model": "aim:block_aim_furnace", "y": 180 },
        "facing=west":  { "model": "aim:block_aim_furnace", "y": 270 },
        "facing=east":  { "model": "aim:block_aim_furnace", "y": 90 },
        "inventory": { "model": "aim:block_aim_furnace" }
    }
}

Try a posting the log.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

You need an inventory variant.  You'd know this if you read the log.

 

I tried that earlier today and didn't helped either... Unless I did it wrong.

 

Like this?

 

block_aim_furnace.json (on assets/aim/blockstates)

{
    "variants": {
        "facing=north": { "model": "aim:block_aim_furnace" },
        "facing=south": { "model": "aim:block_aim_furnace", "y": 180 },
        "facing=west":  { "model": "aim:block_aim_furnace", "y": 270 },
        "facing=east":  { "model": "aim:block_aim_furnace", "y": 90 },
        "inventory": { "model": "aim:block_aim_furnace" }
    }
}

Try a posting the log.

 

This are the logs. Thanks for the help ;)

 

fml-client-latest.log

latest.log

 

http://pastebin.com/me9Q7g4E

Link to comment
Share on other sites

Did you register a renderer for your itemblock?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Did you register a renderer for your itemblock?

 

Not sure? I need my own renderer? I though this code takes care of that, and all my others blocks in this mod and in other mods works.

 

	public static void registerRender(Block block) {
	ModelResourceLocation modelLocation = new ModelResourceLocation(block.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(block.getDefaultState()),  modelLocation);
}

 

And that gets called on the ClientProxy

 

public class ClientProxy extends CommonProxy
{

@Override
public void registerRender()
{
	//Register Renders on Client Side Only
	ModItems.registerRenders();
	ModBlocks.registerRenders();
}

@Override
public void otherInits()
{

}

}

 

I guess all that on my code is correct. It works in other of my mods and it's working for my other block I have so far in this mod, and also for an Ore I just added. It's the Furnace that's having problems.

 

Also, you told me about adding an "inventory" variant, but the furnace in Vanilla doesn't has it neither. My problem must be somewhere else, not really sure where.

Link to comment
Share on other sites

That should work, provided that the block has an item associated with it.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

That should work, provided that the block has an item associated with it.

This is how they get registered.

 

	public static void registerBlock(Block block) {
	GameRegistry.register(block);
	GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}

 

On the other blocks it works, on the furnace, for some reason it does not. I'm almost sure the problem could be something related with the variants and facing, but dunno, the other block has also 2 variants, but it has no problem showing on inventory.

Link to comment
Share on other sites

Oh!

Your block has several states.

 

Are you holding one that does not correspond to the default state?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Oh!

Your block has several states.

 

Are you holding one that does not correspond to the default state?

 

Well, I guess when I register it from inventory, it's getting the default state from metadata 2, that is "facing=north" but now that you mention that, I will add "facing=up" and "facing=down" just in case and let you know if that helps.

 

Up and down didn't helped.

Link to comment
Share on other sites

This line when the itemblock gets registered:

 

ModelResourceLocation modelLocation = new ModelResourceLocation(block.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(block.getDefaultState()),  modelLocation);


	Log.info(Item.getItemFromBlock(block) + " "+ block.getMetaFromState(block.getDefaultState()) + " " + modelLocation);

 

is outputing:

net.minecraft.item.ItemBlock@61cf810c 2 aim:block_aim_furnace#inventory

 

So it's telling it to use the right metadata of 2.

 

Maybe I forgot to modify something on the code I took from the Vanilla furnace so far? (Still work to be done in this class)

 

package com.mramericanmike.aim.blocks;

import java.util.Random;

import javax.annotation.Nullable;

import com.mramericanmike.aim.ModInfo;
import com.mramericanmike.aim.creativetab.ModCreativeTab;
import com.mramericanmike.aim.init.ModBlocks;
import com.mramericanmike.aim.tileentity.TileEntityAIMFurnace;

import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockAIMFurnace extends GenericModBlockContainer
{
    public static final PropertyDirection FACING = BlockHorizontal.FACING;
    private final boolean isBurning;
    private static boolean keepInventory;

    public BlockAIMFurnace(String name, boolean isBurning)
    {
        super(Material.IRON, name);
        this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
        this.isBurning = isBurning;
        if(isBurning){
        	this.setCreativeTab(CreativeTabs.SEARCH);
        }
        else{
        	this.setCreativeTab(ModCreativeTab.MOD_TAB);
        }
    }

    /**
     * Get the Item that this Block should drop when harvested.
     */
    @Nullable
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
    {
        return Item.getItemFromBlock(ModBlocks.AIM_FURNACE);
    }

    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
    {
        this.setDefaultFacing(worldIn, pos, state);
    }

    private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
    {
        if (!worldIn.isRemote)
        {
            IBlockState iblockstate = worldIn.getBlockState(pos.north());
            IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
            IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
            IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
            EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);

            if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
            {
                enumfacing = EnumFacing.SOUTH;
            }
            else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
            {
                enumfacing = EnumFacing.NORTH;
            }
            else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
            {
                enumfacing = EnumFacing.EAST;
            }
            else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
            {
                enumfacing = EnumFacing.WEST;
            }

            worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
        }
    }

    @SideOnly(Side.CLIENT)
    @SuppressWarnings("incomplete-switch")
    public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
    {
        if (this.isBurning)
        {
            EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING);
            double d0 = (double)pos.getX() + 0.5D;
            double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
            double d2 = (double)pos.getZ() + 0.5D;
            double d3 = 0.52D;
            double d4 = rand.nextDouble() * 0.6D - 0.3D;

            if (rand.nextDouble() < 0.1D)
            {
                worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
            }

            switch (enumfacing)
            {
                case WEST:
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                    break;
                case EAST:
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                    break;
                case NORTH:
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                    break;
                case SOUTH:
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
            }
        }
    }

    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityAIMFurnace)
            {
                playerIn.displayGUIChest((TileEntityAIMFurnace)tileentity);
//                playerIn.addStat(StatList.FURNACE_INTERACTION);
            }

            return true;
        }
    }

    public static void setState(boolean active, World worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        TileEntity tileentity = worldIn.getTileEntity(pos);
        keepInventory = true;

        if (active)
        {
//            worldIn.setBlockState(pos, ModBlocks.AIM_FURNACE_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
//            worldIn.setBlockState(pos, ModBlocks.AIM_FURNACE_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        }
        else
        {
            worldIn.setBlockState(pos, ModBlocks.AIM_FURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
            worldIn.setBlockState(pos, ModBlocks.AIM_FURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        }

        keepInventory = false;

        if (tileentity != null)
        {
            tileentity.validate();
            worldIn.setTileEntity(pos, tileentity);
        }
    }

    /**
     * Returns a new instance of a block's tile entity class. Called on placing the block.
     */
    public TileEntity createNewTileEntity(World worldIn, int meta)
    {
        return new TileEntityAIMFurnace();
    }

    /**
     * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
     * IBlockstate
     */
    public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
    {
        return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
    }

    /**
     * Called by ItemBlocks after a block is set in the world, to allow post-place logic
     */
    public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
    {
        worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);

        if (stack.hasDisplayName())
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityAIMFurnace)
            {
                ((TileEntityAIMFurnace)tileentity).setCustomInventoryName(stack.getDisplayName());
            }
        }
    }

    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        if (!keepInventory)
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityAIMFurnace)
            {
                InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityAIMFurnace)tileentity);
                worldIn.updateComparatorOutputLevel(pos, this);
            }
        }

        super.breakBlock(worldIn, pos, state);
    }

    public boolean hasComparatorInputOverride(IBlockState state)
    {
        return true;
    }

    public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos)
    {
        return Container.calcRedstone(worldIn.getTileEntity(pos));
    }

    public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
    {
        return new ItemStack(ModBlocks.AIM_FURNACE);
    }

    /**
     * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
     */
    public EnumBlockRenderType getRenderType(IBlockState state)
    {
        return EnumBlockRenderType.MODEL;
    }

    /**
     * Convert the given metadata into a BlockState for this Block
     */
    public IBlockState getStateFromMeta(int meta)
    {
        EnumFacing enumfacing = EnumFacing.getFront(meta);

        if (enumfacing.getAxis() == EnumFacing.Axis.Y)
        {
            enumfacing = EnumFacing.NORTH;
        }

        return this.getDefaultState().withProperty(FACING, enumfacing);
    }

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        return ((EnumFacing)state.getValue(FACING)).getIndex();
    }

    /**
     * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
     * blockstate.
     */
    public IBlockState withRotation(IBlockState state, Rotation rot)
    {
        return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
    }

    /**
     * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
     * blockstate.
     */
    public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
    {
        return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
    }

    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {FACING});
    }
}

Link to comment
Share on other sites

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It's just a loop that determines all the valid states and registers a renderer for them.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It's just a loop that determines all the valid states and registers a renderer for them.

But, don't I need only 1 for a Furnace? I mean, on my hand, the furnace will always be one of the 4 variants, for instance, the default one, facing north. So the valied state for that block as an item, should only be one and not the 4 facings. Sorry I'm confuse. Still didn't tried what you sent, I will have to take closer look at what that code is exactly doing.

Link to comment
Share on other sites

You'd want the only value for the singular variant in that case, yes.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You'd want the only value for the singular variant in that case, yes.

And isn't that what this line should already be doing?

 

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(block.getDefaultState()),  modelLocation);

 

I'm so confuse. From looking at your code, the final method ends up registering the item for the block on the same way right? But you also have a Class for your Item Block, but I dont see Vanilla doing that for furnaces, or Wools if that's the case.

Link to comment
Share on other sites

That depends: is the default state the one used for the itemblock?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

That depends: is the default state the one used for the itemblock?

 

No it's the block, I'm not passing any state.

 

 

	public static final Block AIM_FURNACE = new BlockAIMFurnace("block_aim_furnace", false);


registerBlock(AIM_FURNACE);


public static void registerBlock(Block block) {
	GameRegistry.register(block);
	GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}

 

At this point I believe I need a complete rewrite on how I'm registering the blocks, but already tried to replicate what your code does, and it not only didn't got the block to render in hand, but also something broke and the furnace when placed in world was always facing the direction.

 

What makes "Special" or so different to other blocks that do work, the registering of a furnace? I can't find in the vanilla code, what they doing different for them.

Link to comment
Share on other sites

The ItemBlock still uses a metadata value somewhere.  It's probably using 0.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It turns out that when I register it like

 

		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), block.getMetaFromState(block.getDefaultState()),  modelLocation);

 

It doesn't render, as block.getMetaFromState(block.getDefaultState()) is returning a 2 (The default meta for the Facing North)

 

But if I try:

 

 

		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0,  modelLocation);

 

Forcing to use a 0 there, makes the block render in hand...

 

Link to comment
Share on other sites

Yep, because the item version of your block uses metadata:0.  If you want it to be a different variant, you need to specify that.

(e.g. getSubBlocks)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Yep, because the item version of your block uses metadata:0.  If you want it to be a different variant, you need to specify that.

(e.g. getSubBlocks)

 

Ok, gonna experiment with that, I believe I understand what you mean ;)

 

Thanks a lot for the help. I can't believe this got so complicated, lol. But I see where this is going and why it's done this way.

 

PS: Do you know where I can look at how Vanilla does it for the ItemBlock for the Furnace, and for the wools? I'm sure that will help me a lot.

Link to comment
Share on other sites

Alternatively you can just add a rotation to your inventory variant.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.