I am having an issue with the texture of an item I am having drop from a custom ore, the texture shows up everywhere else EXCEPT when it drops from the ore when harvested. if I go into creative and give myself one of the items, it has the texture, but if I pick up the non-texture version in the world, as if im in survival mode, then the texture just doesn't update. Alternatively if I already have one of the items with texture in my inventory, then all drops in the world when I pick them up stack with the textured one. this is a code that is designed to pull from a init class elsewhere in the code to help condense characters, everything else works, with exception of smelting recipe and this one texture issue. Any help is appreciated, and please be aware that I am a novice to java programming and I have no official knowledge of how to code, everything I know I have picked up from youtube videos (please don't judge), so be specific and include examples please.
package guardia.test.mod.objects.blocks;
import java.util.Random;
import guardia.test.mod.Main;
import guardia.test.mod.init.BlockInit;
import guardia.test.mod.init.ItemInit;
import guardia.test.mod.objects.blocks.item.ItemBlockVariants;
import guardia.test.mod.util.handlers.EnumHandler;
import guardia.test.mod.util.handlers.EnumHandler.EnumTypeNether;
import guardia.test.mod.util.interfaces.IHasModel;
import guardia.test.mod.util.interfaces.IMetaName;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
public class BlockOresNether extends Block implements IHasModel, IMetaName
{
public static final PropertyEnum<EnumHandler.EnumTypeNether> VARIANT = PropertyEnum.<EnumHandler.EnumTypeNether>create("variant", EnumHandler.EnumTypeNether.class);
private String name, dimension;
public BlockOresNether(String name, String dimension, Material material, float hardness, float resistance)
{
super(material);
setUnlocalizedName(name);
setRegistryName(name);
setCreativeTab(Main.testtab);
setHardness(hardness);
setResistance(resistance);
setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, EnumHandler.EnumTypeNether.test));
this.name = name;
this.dimension = dimension;
BlockInit.BLOCKS.add(this);
ItemInit.ITEMS.add(new ItemBlockVariants(this).setRegistryName(this.getRegistryName()));
}
@Override
public int damageDropped(IBlockState state)
{
return ((EnumHandler.EnumTypeNether)state.getValue(VARIANT)).getMeta();
}
@Override
public int getMetaFromState(IBlockState state)
{
return ((EnumHandler.EnumTypeNether)state.getValue(VARIANT)).getMeta();
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(VARIANT, EnumHandler.EnumTypeNether.byMetadata(meta));
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(world.getBlockState(pos)));
}
@Override
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items)
{
for(EnumHandler.EnumTypeNether variant : EnumHandler.EnumTypeNether.values())
{
items.add(new ItemStack(this, 1, variant.getMeta()));
}
}
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {VARIANT});
}
@Override
public String getSpecialName(ItemStack stack)
{
return EnumHandler.EnumTypeNether.values()[stack.getItemDamage()].getName();
}
@Override
public void registerModels()
{
for(int i = 0; i < EnumHandler.EnumTypeNether.values().length; i++)
{
Main.proxy.registerVariantRenderer(Item.getItemFromBlock(this), i, "ore_" + this.dimension + "_" + EnumHandler.EnumTypeNether.values()[i].getName(), "inventory");
}
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
if(state == this.getDefaultState().withProperty(VARIANT, EnumHandler.EnumTypeNether.blackrock))
{
return ItemInit.SHARD_BLACKROCK;
}
return Item.getItemFromBlock(this);
}
@Override
public int quantityDropped(IBlockState state, int fortune, Random random)
{
if(state.getValue(VARIANT) == EnumTypeNether.blackrock)
{
return 2 + random.nextInt(4 - 2 + fortune + 1);
}
return fortune + 1;
}
}
I am having an issue with the texture of an item I am having drop from a custom ore, the texture shows up everywhere else EXCEPT when it drops from the ore when harvested. if I go into creative and give myself one of the items, it has the texture, but if I pick up the non-texture version in the world, as if im in survival mode, then the texture just doesn't update. Alternatively if I already have one of the items with texture in my inventory, then all drops in the world when I pick them up stack with the textured one. this is a code that is designed to pull from a init class elsewhere in the code to help condense characters, everything else works, with exception of smelting recipe and this one texture issue. Any help is appreciated, and please be aware that I am a novice to java programming and I have no official knowledge of how to code, everything I know I have picked up from youtube videos (please don't judge), so be specific and include examples please.
I found the issue, I needed to update the damageDropped value for my ore that drops the shards