Jump to content

Recommended Posts

Posted

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

Posted
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;
}


}

Posted

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

}}

Posted

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

Posted

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.

Posted

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.

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.