Posted March 13, 20205 yr 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; } }
March 15, 20205 yr Author Ok I fixed, I'm creating new tile entity instead of using existing TE. ClientRegistry.bindTileEntityRenderer(ModTileEntities.INFUSER_TE.get(), InfuserTileEntityRender::new);
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.