Posted July 12, 20178 yr Whenever I try to place my TileEntity, the model doesn't render and there is an empty bounding box where the block should be. Here is my code: Block Class: Spoiler public class BlockTurret extends BlockTileEntity<TileEntityTurret> { public BlockTurret(String name) { super(Material.IRON, MapColor.TNT, name); setHardness(1.5f); setSoundType(SoundType.METAL); } @Override public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return false; } @Override public boolean isBlockNormalCube(IBlockState state) { return false; } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } @Override public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { return false; } @Override public Class<TileEntityTurret> getTileEntityClass() { return TileEntityTurret.class; } @Nullable @Override public TileEntityTurret createTileEntity(World world, IBlockState state) { return new TileEntityTurret(); } @Override @Deprecated public boolean isOpaqueCube(IBlockState state) { return false; } @Override @Deprecated public boolean isFullCube(IBlockState state) { return false; } } TileEntity Base Class: Spoiler public abstract class BlockTileEntity<TE extends TileEntity> extends BlockBase { public BlockTileEntity(Material material, MapColor mapColor, String name) { super(material, mapColor, name); } public abstract Class<TE> getTileEntityClass(); public TE getTileEntity(IBlockAccess world, BlockPos pos) { return (TE) world.getTileEntity(pos); } @Override public boolean hasTileEntity(IBlockState state) { return true; } @Nullable @Override public abstract TE createTileEntity(World world, IBlockState state); } TESR Class: Spoiler @SideOnly(Side.CLIENT) public class TESRTurret extends TileEntitySpecialRenderer<TileEntityTurret> { private final ModelTurret model = new ModelTurret(); private static ResourceLocation TEXTURE = new ResourceLocation(Sentries.modId,"textures/blocks/turret/rf_turret.png"); @Override public void render(TileEntityTurret te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { GlStateManager.pushMatrix(); GlStateManager.translate(x,y,z); bindTexture(TEXTURE); model.renderAll(); GlStateManager.popMatrix(); super.render(te, x, y, z, partialTicks, destroyStage, alpha); } } Model Class: Spoiler @SideOnly(Side.CLIENT) public class ModelTurret extends ModelBase { public ModelRenderer base; public ModelRenderer swivel; public ModelRenderer westArm; public ModelRenderer eastArm; public ModelRenderer gun; public ModelTurret() { this.textureWidth = 64; this.textureHeight = 32; this.base = new ModelRenderer(this, 0, 10); this.base.setRotationPoint(-6.0F, 22.0F, -6.0F); this.base.addBox(0.0F, 0.0F, 0.0F, 12, 2, 12); this.swivel = new ModelRenderer(this, 2, 0); this.swivel.setRotationPoint(-4.0F, 21.0F, -4.0F); this.swivel.addBox(0.0F, 0.0F, 0.0F, 8, 2, 8); this.westArm = new ModelRenderer(this, 26, 0); this.westArm.setRotationPoint(-2.0F, 17.0F, -2.0F); this.westArm.addBox(0.0F, 0.0F, 0.0F, 1, 4, 4); this.eastArm = new ModelRenderer(this, 0, 0); this.eastArm.setRotationPoint(1.0F, 17.0F, -2.0F); this.eastArm.addBox(0.0F, 0.0F, 0.0F, 1, 4, 4); this.gun = new ModelRenderer(this, 0, 13); this.gun.setRotationPoint(-1.0F, 12.0F, -1.0F); this.gun.addBox(0.0F, 0.0F, 0.0F, 2, 7, 2); } private float scale = 1; public void renderAll() { this.base.render(scale); this.swivel.render(scale); this.westArm.render(scale); this.eastArm.render(scale); this.gun.render(scale); } } Server-side registration: Spoiler public static BlockTurret RFTurret; private void initBlocks(){ //Called from preInit RFTurret = registerBlocks(new BlockRFTurret()); } private static <T extends Block> T registerBlocks(T block, ItemBlock itemBlock) { GameRegistry.findRegistry(Block.class).register(block); GameRegistry.findRegistry(Item.class).register(itemBlock); if (block instanceof BlockBase) { ((BlockBase) block).registerItemModel(itemBlock); } if (block instanceof BlockTileEntity) { GameRegistry.registerTileEntity(((BlockTileEntity<?>) block).getTileEntityClass(), block.getRegistryName().toString()); } return block; } private static <T extends Block> T registerBlocks(T block) { ItemBlock itemBlock = new ItemBlock(block); itemBlock.setRegistryName(block.getRegistryName()); return registerBlocks(block, itemBlock); } Client-side registration: Spoiler public void registerRenderers() { //Called from preInit ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTurret.class, new TESRTurret()); } What's going on? (I guess not going on, more specifically.) ---SOLUTION--- Edited July 12, 20178 yr by OttselKid god help us...
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.