Jump to content

Cant make furnace with custom model


MrImba

Recommended Posts

Hello guys i made furnace but it have no model that i made in mc pre 4

before i made block with that custom model and all worked but after i added methods from BlockFurnace into my class customfurnaceblock model didnt work.

need some help:C

Link to comment
Share on other sites

package com.verdure.mod.blocks;

import java.util.Random;

import com.verdure.mod.VerdureGlobal;
import com.verdure.mod.entity.VDEntity_raw_furnace;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.renderer.entity.layers.LayerHeldBlock;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
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.tileentity.TileEntityFurnace;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;


public class raw_furnace extends BlockContainer {

public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
    private final boolean isBurning;
    private static boolean keepInventory;



protected raw_furnace (boolean isBurning, String unlocalizedName) {

	super(Material.rock);
	this.setCreativeTab(VerdureGlobal.vdCreativeTabs);
	this.setUnlocalizedName(unlocalizedName);
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
        this.isBurning = isBurning;	
} 


/**
     * Get the Item that this Block should drop when harvested.
     */

    public Item getItemDropped(IBlockState state, Random rand, int fortune)
    {
        return Item.getItemFromBlock(VDBlocks.raw_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)
        {
            Block block = worldIn.getBlockState(pos.north()).getBlock();
            Block block1 = worldIn.getBlockState(pos.south()).getBlock();
            Block block2 = worldIn.getBlockState(pos.west()).getBlock();
            Block block3 = worldIn.getBlockState(pos.east()).getBlock();
            EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);

            if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock())
            {
                enumfacing = EnumFacing.SOUTH;
            }
            else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock())
            {
                enumfacing = EnumFacing.NORTH;
            }
            else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock())
            {
                enumfacing = EnumFacing.EAST;
            }
            else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock())
            {
                enumfacing = EnumFacing.WEST;
            }

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

    @SideOnly(Side.CLIENT)
    @SuppressWarnings("incomplete-switch")
    public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
    {
        if (this.isBurning)
        {
            EnumFacing enumfacing = (EnumFacing)state.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;

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

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

            if (tileentity instanceof TileEntityFurnace)
            {
                playerIn.displayGUIChest((TileEntityFurnace)tileentity);
                playerIn.triggerAchievement(StatList.field_181741_Y);
            }

            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, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
            worldIn.setBlockState(pos, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        }
        else
        {
            worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
            worldIn.setBlockState(pos, Blocks.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 TileEntityFurnace();
    }

    /**
     * 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 TileEntityFurnace)
            {
                ((TileEntityFurnace)tileentity).setCustomInventoryName(stack.getDisplayName());
            }
        }
    }

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

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

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

    public boolean hasComparatorInputOverride()
    {
        return true;
    }

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

    @SideOnly(Side.CLIENT)
    public Item getItem(World worldIn, BlockPos pos)
    {
        return Item.getItemFromBlock(VDBlocks.raw_furnace);
    }
    /**
     * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
     */
    public int getRenderType()
    {
        return 3;
    }
   
    /**
     * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...)
     */
    @SideOnly(Side.CLIENT)
    public IBlockState getStateForEntityRender(IBlockState state)
    {
        return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH);
    }

    /**
     * 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();
    }

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








   
   



@Override
public boolean isOpaqueCube() {
return false;
}

@Override
public boolean isFullCube() {
return false;
}


}

Link to comment
Share on other sites

oh still dosent work and now when i open furnace minecraft crash but i used auto generated methods.. should i ad some methods by myself?

package com.verdure.mod.entity;

import net.minecraft.block.Block;
import net.minecraft.block.BlockFurnace;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerFurnace;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.SlotFurnaceFuel;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntityLockable;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class VDEntity_raw_furnace extends TileEntityLockable implements ITickable, ISidedInventory {

@Override
public int getSizeInventory() {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public ItemStack getStackInSlot(int index) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public ItemStack decrStackSize(int index, int count) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public ItemStack removeStackFromSlot(int index) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public void setInventorySlotContents(int index, ItemStack stack) {
	// TODO Auto-generated method stub

}

@Override
public int getInventoryStackLimit() {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public boolean isUseableByPlayer(EntityPlayer player) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public void openInventory(EntityPlayer player) {
	// TODO Auto-generated method stub

}

@Override
public void closeInventory(EntityPlayer player) {
	// TODO Auto-generated method stub

}

@Override
public boolean isItemValidForSlot(int index, ItemStack stack) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public int getField(int id) {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public void setField(int id, int value) {
	// TODO Auto-generated method stub

}

@Override
public int getFieldCount() {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public void clear() {
	// TODO Auto-generated method stub

}

@Override
public String getName() {
	// TODO Auto-generated method stub
	return null;
}

@Override
public boolean hasCustomName() {
	// TODO Auto-generated method stub
	return false;
}

@Override
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public String getGuiID() {
	// TODO Auto-generated method stub
	return null;
}

@Override
public int[] getSlotsForFace(EnumFacing side) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public void update() {
	// TODO Auto-generated method stub

}

public void setCustomInventoryName(String displayName) {
	// TODO Auto-generated method stub

}}

Link to comment
Share on other sites

Yes you need to create those methods yourself look through the TileEntityFurnace class as a REFERENCE not a copy.

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

ye but i made it, custom model worked when it was a block but when i started to add methods from furnaceBlock it is not working

this is my model

"parent": "block/orientable",
    "textures": {
        "0": "vd:blocks/raw_furnace",
        "1": "vd:blocks/raw_furnace.foward"
    },
    "elements": [
        {
            "name": "Cube",
            "from": [ 3.0, 0.0, 3.0 ], 
            "to": [ 13.0, 11.0, 13.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 2.0, 5.0, 12.0, 16.0 ] },
                "west": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 11.0 ] },
                "south": { "texture": "#1", "uv": [ 3.0, 5.0, 13.0, 16.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 10.0, 11.0 ] },
                "up": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 13.0 ] },
                "down": { "texture": "#0", "uv": [ 3.0, 6.0, 13.0, 16.0 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 4.0, 11.0, 4.0 ], 
            "to": [ 12.0, 12.0, 12.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 8.0 ] },
                "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 5.0, 12.0, 5.0 ], 
            "to": [ 11.0, 13.0, 11.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, -5.0, -1.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 6.0 ] },
                "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7.0, 13.0, 7.0 ], 
            "to": [ 9.0, 16.0, 9.0 ], 
            "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
            }
        }
    ]
}

and this blockfurnace

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

 

I think i need to add to my model top front and side but i dont know how:C

Link to comment
Share on other sites

No instead of

"parent": "block/orientable",
    "textures": {
        "0": "vd:blocks/raw_furnace",
        "1": "vd:blocks/raw_furnace.foward"
    },
    "elements": [
        {
            "name": "Cube",
            "from": [ 3.0, 0.0, 3.0 ], 
            "to": [ 13.0, 11.0, 13.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 2.0, 5.0, 12.0, 16.0 ] },
                "west": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 11.0 ] },
                "south": { "texture": "#1", "uv": [ 3.0, 5.0, 13.0, 16.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 10.0, 11.0 ] },
                "up": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 13.0 ] },
                "down": { "texture": "#0", "uv": [ 3.0, 6.0, 13.0, 16.0 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 4.0, 11.0, 4.0 ], 
            "to": [ 12.0, 12.0, 12.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 8.0 ] },
                "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 5.0, 12.0, 5.0 ], 
            "to": [ 11.0, 13.0, 11.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, -5.0, -1.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 6.0 ] },
                "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }
            }
        },
        {
            "name": "Cube",
            "from": [ 7.0, 13.0, 7.0 ], 
            "to": [ 9.0, 16.0, 9.0 ], 
            "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
            }
        }
    ]
}

 

Use this

{
    "parent": "block/orientable",
    "textures": {
        "top": "vd:blocks/raw_furnace_Top",
        "front": "vd:blocks/raw_furnace_Front",
        "side": "vd:blocks/raw_furnace_Side"
    }
}

 

The difference between a model and a texture is a pretty big one. When I say model I mean the JSONs

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

I believe you have 3 options

1. Editing your model to work manually

2. Using one of these http://minecraft.gamepedia.com/Programs_and_editors/3D_modeling

3. Using a TESR(Tile Entity Special Renderer) if they still exist in your version.

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am not using hardcoded recipes, I'm using Vanilla's already existing code for leather armor dying. (via extending and implementing DyeableArmorItem / DyeableLeatherItem respectively) I have actually figured out that it's something to do with registering item colors to the ItemColors instance, but I'm trying to figure out where exactly in my mod's code I would be placing a call to the required event handler. Unfortunately the tutorial is criminally undescriptive. The most I've found is that it has to be done during client initialization. I'm currently trying to do the necessary setup via hijacking the item registry since trying to modify the item classes directly (via using SubscribeEvent in the item's constructor didn't work. Class so far: // mrrp mrow - mcmod item painter v1.0 - catzrule ch package catzadvitems.init; import net.minecraft.client.color.item.ItemColors; import net.minecraft.world.item.Item; import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.client.event.ColorHandlerEvent; import catzadvitems.item.DyeableWoolArmorItem; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class Painter { @ObjectHolder("cai:dyeable_wool_chestplate") public static final Item W_CHEST = null; @ObjectHolder("cai:dyeable_wool_leggings") public static final Item W_LEGS = null; @ObjectHolder("cai:dyeable_wool_boots") public static final Item W_SOCKS = null; public Painter() { // left blank, idk if forge throws a fit if constructors are missing, not taking the chance of it happening. } @SubscribeEvent public static void init(FMLClientSetupEvent event) { new Painter(); } @Mod.EventBusSubscriber private static class ForgeBusEvents { @SubscribeEvent public static void registerItemColors(ColorHandlerEvent.Item event) { ItemColors col = event.getItemColors(); col.register(DyeableUnderArmorItem::getItemDyedColor, W_CHEST, W_LEGS, W_SOCKS); //placeholder for other dye-able items here later.. } } } (for those wondering, i couldn't think of a creative wool helmet name)
    • nvm found out it was because i had create h and not f
    • Maybe there's something happening in the 'leather armor + dye' recipe itself that would be updating the held item texture?
    • @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre e) { e.setCanceled(true); model.renderToBuffer(e.getPoseStack(), pBuffer, e.getPackedLight(), 0f, 0f, 0f, 0f, 0f); //ToaPlayerRenderer.render(); } Since getting the render method from a separate class is proving to be bit of a brick wall for me (but seems to be the solution in older versions of minecraft/forge) I've decided to try and pursue using the renderToBuffer method directly from the model itself. I've tried this route before but can't figure out what variables to feed it for the vertexConsumer and still can't seem to figure it out; if this is even a path to pursue.  The vanilla model files do not include any form of render methods, and seem to be fully constructed from their layer definitions? Their renderer files seem to take their layers which are used by the render method in the vanilla MobRenderer class. But for modded entities we @Override this function and don't have to feed the method variables because of that? I assume that the render method in the extended renderer takes the layer definitions from the renderer classes which take those from the model files. Or maybe instead of trying to use a render method I should be calling the super from the renderer like   new ToaPlayerRenderer(context, false); Except I'm not sure what I would provide for context? There's a context method in the vanilla EntityRendererProvider class which doesn't look especially helpful. I've been trying something like <e.getEntity(), model<e.getEntity()>> since that generally seems to be what is provided to the renderers for context, but I don't know if it's THE context I'm looking for? Especially since the method being called doesn't want to take this or variations of this.   In short; I feel like I'm super super close but I have to be missing something obvious? Maybe this insane inane ramble post will provide some insight into this puzzle?
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.