Jump to content

[SOLVED][1.15.2] Tile Entity Render doesn't work


DcZipPL

Recommended Posts

I tried make tile entity render but nothing work,

//doClientStuff(final FMLClientSetupEvent event)
ClientRegistry.bindTileEntityRenderer(TileEntityType.Builder.create(TankTileEntity::new,
                ModBlocks.TANK
        ).build(null), TankTileEntityRender::new);
//ModTileEntities
public static final DeferredRegister<TileEntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.TILE_ENTITIES, Reference.MOD_ID);
public static RegistryObject<TileEntityType<?>> TANK_TE = ENTITY_TYPES.register("tank_te", () ->
            TileEntityType.Builder.create(TankTileEntity::new,ModBlocks.TANK).build(null)
    );

 

public class TankTileEntityRender extends TileEntityRenderer<TankTileEntity>
{
    public TankTileEntityRender(TileEntityRendererDispatcher p_i226006_1_)
    {
        super(p_i226006_1_);
    }

    @Override
    public void render(TankTileEntity tankTileEntity, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1)
    {
        matrixStack.push();
        matrixStack.translate(tankTileEntity.getPos().getX(),tankTileEntity.getPos().getY(),tankTileEntity.getPos().getZ());
        matrixStack.rotate(new Quaternion(0,0,0,0));
        matrixStack.translate(0.5,0.1,0);
        Minecraft.getInstance().getItemRenderer().renderItem(new ItemStack(Items.REDSTONE_TORCH), ItemCameraTransforms.TransformType.GROUND,i,i1,matrixStack,iRenderTypeBuffer);
        matrixStack.pop();
    }
}
public class TankTileEntity extends TileEntity
{
    public TankTileEntity()
    {
        super(ModTileEntities.TANK_TE.get());
    }
}
public class TankBlock extends Block
{
    public VoxelShape SHAPE = Block.makeCuboidShape(1,0,1,15,16,15);

    public TankBlock(Properties properties)
    {
        super(properties);
    }

    @Override
    public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
    {
        return SHAPE;
    }

    @Override
    public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
    {
        return SHAPE;
    }
}

 

Link to comment
Share on other sites

  • DcZipPL changed the title to [SOLVED][1.15.2] Tile Entity Render doesn't work

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.