have search everywhere, and all the information I find is outdated, most of it so outdated that it actually says you need a custom loader for OBJ files still. But even the newest example that people often cite, the debug loader test on github, uses a bunch of deprecated methods and objects. So here's the problem, I can get the items to render correctly, but when I try to use an obj file for a block it only renders in the item form. When placed it renders nothing. I created a temporary custom renderer but all I can get is the two block tall block to render using only a small part of the texture. Like the coordinates for the block are being shrunk into a much smaller portion of the texture.
So here's the Java class for the object:
public class MagitechStorageBinTall extends BlockContainer implements
IMagitechBlock, ITileEntityProvider {
protected String NAME = null;
protected String MAGITECHID = null;
public MagitechStorageBinTall(String unlocalizedName, String name, Material material, float hardness, float resistance, SoundType sound, int opacity, float lightlevel, String harvest, int harvestlevel) {
super(material);
this.NAME = name;
this.MAGITECHID = unlocalizedName;
this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
this.setHardness(hardness);
this.setResistance(resistance);
this.setSoundType(sound);
this.setLightOpacity(opacity);
this.setLightLevel(lightlevel);
this.setHarvestLevel(harvest, harvestlevel);
this.setRegistryName(Magitech.MODID, unlocalizedName);
this.setUnlocalizedName(unlocalizedName);
}
@Override
@Nullable
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new MagitechTileEntityStorageBinTall();
}
@Override
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
return MagitechTileEntityStorageBinTall.BOUNDINGBOX;
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.SOLID;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public String getMagitechName() {
return this.NAME;
}
@Override
public String getMagitechID() {
return this.MAGITECHID;
}
@Override
public Block getBlock() {
return this;
}
@Override
public void registerModel(ItemBlock item) {
ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation(Magitech.MODID + ":" + this.MAGITECHID, "normal");
ModelLoader.setCustomModelResourceLocation(item, 0, itemModelResourceLocation);
}
@Override
public void registerItemBlock(IForgeRegistry<Item> event) {
final ItemBlock item = new ItemBlock(this.getBlock());
item.setRegistryName(Magitech.MODID, this.getMagitechID());
event.register(item);
RegistrationHandler.BLOCKS.add(item);
}
@Override
public void registerBlock(Register<Block> event) {
event.getRegistry().register(this);
}
}
The JSON file:
{
"forge_marker": 1,
"defaults": {
"textures": {
"Material": "magitech:entity/storage_bin_tall"
},
"model": "magitech:storage_bin_tall.obj"
},
"variants": {
"normal": [{
}],
"inventory": [{
"transform": "forge:default-block"
}]
}
}